var _He=Object.defineProperty;var v2e=t=>{throw TypeError(t)};var bHe=(t,e,n)=>e in t?_He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Wn=(t,e,n)=>bHe(t,typeof e!="symbol"?e+"":e,n),Poe=(t,e,n)=>e.has(t)||v2e("Cannot "+n);var Yt=(t,e,n)=>(Poe(t,e,"read from private field"),n?n.call(t):e.get(t)),ii=(t,e,n)=>e.has(t)?v2e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),cs=(t,e,n,s)=>(Poe(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),ia=(t,e,n)=>(Poe(t,e,"access private method"),n);var M6=(t,e,n,s)=>({set _(i){cs(t,e,i,n)},get _(){return Yt(t,e,s)}});function wHe(t,e){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var wx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Da(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function j3e(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}),n}var k3e={exports:{}},ine={},N3e={exports:{}},wa={};/** * @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 WE=Symbol.for("react.element"),jHe=Symbol.for("react.portal"),kHe=Symbol.for("react.fragment"),NHe=Symbol.for("react.strict_mode"),SHe=Symbol.for("react.profiler"),CHe=Symbol.for("react.provider"),MHe=Symbol.for("react.context"),THe=Symbol.for("react.forward_ref"),AHe=Symbol.for("react.suspense"),EHe=Symbol.for("react.memo"),IHe=Symbol.for("react.lazy"),_2e=Symbol.iterator;function PHe(t){return t===null||typeof t!="object"?null:(t=_2e&&t[_2e]||t["@@iterator"],typeof t=="function"?t:null)}var S3e={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C3e=Object.assign,M3e={};function BC(t,e,n){this.props=t,this.context=e,this.refs=M3e,this.updater=n||S3e}BC.prototype.isReactComponent={};BC.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};BC.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function T3e(){}T3e.prototype=BC.prototype;function Ipe(t,e,n){this.props=t,this.context=e,this.refs=M3e,this.updater=n||S3e}var Ppe=Ipe.prototype=new T3e;Ppe.constructor=Ipe;C3e(Ppe,BC.prototype);Ppe.isPureReactComponent=!0;var b2e=Array.isArray,A3e=Object.prototype.hasOwnProperty,Lpe={current:null},E3e={key:!0,ref:!0,__self:!0,__source:!0};function I3e(t,e,n){var s,i={},o=null,c=null;if(e!=null)for(s in e.ref!==void 0&&(c=e.ref),e.key!==void 0&&(o=""+e.key),e)A3e.call(e,s)&&!E3e.hasOwnProperty(s)&&(i[s]=e[s]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,oe=fe[Se];if(0>>1;Sei(Te,Ie))Bei(Le,Te)?(fe[Se]=Le,fe[Be]=Ie,Se=Be):(fe[Se]=Te,fe[Ne]=Ie,Se=Ne);else if(Bei(Le,Ie))fe[Se]=Le,fe[Be]=Ie,Se=Be;else break e}}return ve}function i(fe,ve){var Ie=fe.sortIndex-ve.sortIndex;return Ie!==0?Ie:fe.id-ve.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var c=Date,a=c.now();t.unstable_now=function(){return c.now()-a}}var h=[],m=[],x=1,v=null,w=3,k=!1,C=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function D(fe){for(var ve=n(m);ve!==null;){if(ve.callback===null)s(m);else if(ve.startTime<=fe)s(m),ve.sortIndex=ve.expirationTime,e(h,ve);else break;ve=n(m)}}function $(fe){if(S=!1,D(fe),!C)if(n(h)!==null)C=!0,ie(F);else{var ve=n(m);ve!==null&&me($,ve.startTime-fe)}}function F(fe,ve){C=!1,S&&(S=!1,I(K),K=-1),k=!0;var Ie=w;try{for(D(ve),v=n(h);v!==null&&(!(v.expirationTime>ve)||fe&&!he());){var Se=v.callback;if(typeof Se=="function"){v.callback=null,w=v.priorityLevel;var oe=Se(v.expirationTime<=ve);ve=t.unstable_now(),typeof oe=="function"?v.callback=oe:v===n(h)&&s(h),D(ve)}else s(h);v=n(h)}if(v!==null)var ae=!0;else{var Ne=n(m);Ne!==null&&me($,Ne.startTime-ve),ae=!1}return ae}finally{v=null,w=Ie,k=!1}}var q=!1,W=null,K=-1,Z=5,re=-1;function he(){return!(t.unstable_now()-refe||125Se?(fe.sortIndex=Ie,e(m,fe),n(h)===null&&fe===n(m)&&(S?(I(K),K=-1):S=!0,me($,Ie-Se))):(fe.sortIndex=oe,e(h,fe),C||k||(C=!0,ie(F))),fe},t.unstable_shouldYield=he,t.unstable_wrapCallback=function(fe){var ve=w;return function(){var Ie=w;w=ve;try{return fe.apply(this,arguments)}finally{w=Ie}}}})(R3e);D3e.exports=R3e;var VHe=D3e.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 HHe=P,Zh=VHe;function Sn(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ade=Object.prototype.hasOwnProperty,WHe=/^[: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]*$/,j2e={},k2e={};function GHe(t){return ade.call(k2e,t)?!0:ade.call(j2e,t)?!1:WHe.test(t)?k2e[t]=!0:(j2e[t]=!0,!1)}function KHe(t,e,n,s){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function ZHe(t,e,n,s){if(e===null||typeof e>"u"||KHe(t,e,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ou(t,e,n,s,i,o,c){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=s,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=c}var Ed={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ed[t]=new Ou(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ed[e]=new Ou(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ed[t]=new Ou(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ed[t]=new Ou(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){Ed[t]=new Ou(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ed[t]=new Ou(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ed[t]=new Ou(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ed[t]=new Ou(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ed[t]=new Ou(t,5,!1,t.toLowerCase(),null,!1,!1)});var Rpe=/[\-:]([a-z])/g;function Fpe(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Rpe,Fpe);Ed[e]=new Ou(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Rpe,Fpe);Ed[e]=new Ou(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Rpe,Fpe);Ed[e]=new Ou(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ed[t]=new Ou(t,1,!1,t.toLowerCase(),null,!1,!1)});Ed.xlinkHref=new Ou("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ed[t]=new Ou(t,1,!1,t.toLowerCase(),null,!0,!0)});function zpe(t,e,n,s){var i=Ed.hasOwnProperty(e)?Ed[e]:null;(i!==null?i.type!==0:s||!(2a||i[c]!==o[a]){var h=` `+i[c].replace(" at new "," at ");return t.displayName&&h.includes("")&&(h=h.replace("",t.displayName)),h}while(1<=c&&0<=a);break}}}finally{Doe=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?YM(t):""}function YHe(t){switch(t.tag){case 5:return YM(t.type);case 16:return YM("Lazy");case 13:return YM("Suspense");case 19:return YM("SuspenseList");case 0:case 2:case 15:return t=Roe(t.type,!1),t;case 11:return t=Roe(t.type.render,!1),t;case 1:return t=Roe(t.type,!0),t;default:return""}}function dde(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 gS:return"Fragment";case mS:return"Portal";case ode:return"Profiler";case Bpe:return"StrictMode";case lde:return"Suspense";case cde:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case B3e:return(t.displayName||"Context")+".Consumer";case z3e:return(t._context.displayName||"Context")+".Provider";case $pe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Upe:return e=t.displayName||null,e!==null?e:dde(t.type)||"Memo";case t0:e=t._payload,t=t._init;try{return dde(t(e))}catch{}}return null}function XHe(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dde(e);case 8:return e===Bpe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function j1(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function U3e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function QHe(t){var e=U3e(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),s=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(c){s=""+c,o.call(this,c)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(c){s=""+c},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function E6(t){t._valueTracker||(t._valueTracker=QHe(t))}function q3e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=U3e(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function uee(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 ude(t,e){var n=e.checked;return Il({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function S2e(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=j1(e.value!=null?e.value:n),t._wrapperState={initialChecked:s,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function V3e(t,e){e=e.checked,e!=null&&zpe(t,"checked",e,!1)}function hde(t,e){V3e(t,e);var n=j1(e.value),s=e.type;if(n!=null)s==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(s==="submit"||s==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?fde(t,e.type,n):e.hasOwnProperty("defaultValue")&&fde(t,e.type,j1(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function C2e(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var s=e.type;if(!(s!=="submit"&&s!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function fde(t,e,n){(e!=="number"||uee(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var XM=Array.isArray;function LS(t,e,n,s){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=I6.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function xA(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dT={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},JHe=["Webkit","ms","Moz","O"];Object.keys(dT).forEach(function(t){JHe.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dT[e]=dT[t]})});function K3e(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dT.hasOwnProperty(t)&&dT[t]?(""+e).trim():e+"px"}function Z3e(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=K3e(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,i):t[n]=i}}var eWe=Il({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 gde(t,e){if(e){if(eWe[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Sn(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Sn(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Sn(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Sn(62))}}function xde(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yde=null;function qpe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var vde=null,OS=null,DS=null;function A2e(t){if(t=ZE(t)){if(typeof vde!="function")throw Error(Sn(280));var e=t.stateNode;e&&(e=dne(e),vde(t.stateNode,t.type,e))}}function Y3e(t){OS?DS?DS.push(t):DS=[t]:OS=t}function X3e(){if(OS){var t=OS,e=DS;if(DS=OS=null,A2e(t),e)for(t=0;t>>=0,t===0?32:31-(uWe(t)/hWe|0)|0}var P6=64,L6=4194304;function QM(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 mee(t,e){var n=t.pendingLanes;if(n===0)return 0;var s=0,i=t.suspendedLanes,o=t.pingedLanes,c=n&268435455;if(c!==0){var a=c&~i;a!==0?s=QM(a):(o&=c,o!==0&&(s=QM(o)))}else c=n&~i,c!==0?s=QM(c):o!==0&&(s=QM(o));if(s===0)return 0;if(e!==0&&e!==s&&!(e&i)&&(i=s&-s,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(s&4&&(s|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=s;0n;n++)e.push(t);return e}function GE(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-tm(e),t[e]=n}function gWe(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var s=t.eventTimes;for(t=t.expirationTimes;0=hT),z2e=" ",B2e=!1;function xMe(t,e){switch(t){case"keyup":return VWe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yMe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var xS=!1;function WWe(t,e){switch(t){case"compositionend":return yMe(e);case"keypress":return e.which!==32?null:(B2e=!0,z2e);case"textInput":return t=e.data,t===z2e&&B2e?null:t;default:return null}}function GWe(t,e){if(xS)return t==="compositionend"||!Xpe&&xMe(t,e)?(t=mMe(),KL=Kpe=A0=null,xS=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=V2e(n)}}function wMe(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?wMe(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function jMe(){for(var t=window,e=uee();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=uee(t.document)}return e}function Qpe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function rGe(t){var e=jMe(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&wMe(n.ownerDocument.documentElement,n)){if(s!==null&&Qpe(n)){if(e=s.start,t=s.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(s.start,i);s=s.end===void 0?o:Math.min(s.end,i),!t.extend&&o>s&&(i=s,s=o,o=i),i=H2e(n,o);var c=H2e(n,s);i&&c&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==c.node||t.focusOffset!==c.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>s?(t.addRange(e),t.extend(c.node,c.offset)):(e.setEnd(c.node,c.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,yS=null,Nde=null,pT=null,Sde=!1;function W2e(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sde||yS==null||yS!==uee(s)||(s=yS,"selectionStart"in s&&Qpe(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),pT&&jA(pT,s)||(pT=s,s=yee(Nde,"onSelect"),0bS||(t.current=Ide[bS],Ide[bS]=null,bS--)}function Go(t,e){bS++,Ide[bS]=t.current,t.current=e}var k1={},Jd=L1(k1),ch=L1(!1),mj=k1;function V4(t,e){var n=t.type.contextTypes;if(!n)return k1;var s=t.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===e)return s.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return s&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function dh(t){return t=t.childContextTypes,t!=null}function _ee(){ll(ch),ll(Jd)}function J2e(t,e,n){if(Jd.current!==k1)throw Error(Sn(168));Go(Jd,e),Go(ch,n)}function IMe(t,e,n){var s=t.stateNode;if(e=e.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in e))throw Error(Sn(108,XHe(t)||"Unknown",i));return Il({},n,s)}function bee(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||k1,mj=Jd.current,Go(Jd,t),Go(ch,ch.current),!0}function ebe(t,e,n){var s=t.stateNode;if(!s)throw Error(Sn(169));n?(t=IMe(t,e,mj),s.__reactInternalMemoizedMergedChildContext=t,ll(ch),ll(Jd),Go(Jd,t)):ll(ch),Go(ch,n)}var gx=null,une=!1,Xoe=!1;function PMe(t){gx===null?gx=[t]:gx.push(t)}function pGe(t){une=!0,PMe(t)}function O1(){if(!Xoe&&gx!==null){Xoe=!0;var t=0,e=_o;try{var n=gx;for(_o=1;t>=c,i-=c,jx=1<<32-tm(e)+i|n<K?(Z=W,W=null):Z=W.sibling;var re=w(I,W,D[K],$);if(re===null){W===null&&(W=Z);break}t&&W&&re.alternate===null&&e(I,W),A=o(re,A,K),q===null?F=re:q.sibling=re,q=re,W=Z}if(K===D.length)return n(I,W),xl&&Kv(I,K),F;if(W===null){for(;KK?(Z=W,W=null):Z=W.sibling;var he=w(I,W,re.value,$);if(he===null){W===null&&(W=Z);break}t&&W&&he.alternate===null&&e(I,W),A=o(he,A,K),q===null?F=he:q.sibling=he,q=he,W=Z}if(re.done)return n(I,W),xl&&Kv(I,K),F;if(W===null){for(;!re.done;K++,re=D.next())re=v(I,re.value,$),re!==null&&(A=o(re,A,K),q===null?F=re:q.sibling=re,q=re);return xl&&Kv(I,K),F}for(W=s(I,W);!re.done;K++,re=D.next())re=k(W,I,K,re.value,$),re!==null&&(t&&re.alternate!==null&&W.delete(re.key===null?K:re.key),A=o(re,A,K),q===null?F=re:q.sibling=re,q=re);return t&&W.forEach(function(ue){return e(I,ue)}),xl&&Kv(I,K),F}function T(I,A,D,$){if(typeof D=="object"&&D!==null&&D.type===gS&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case A6:e:{for(var F=D.key,q=A;q!==null;){if(q.key===F){if(F=D.type,F===gS){if(q.tag===7){n(I,q.sibling),A=i(q,D.props.children),A.return=I,I=A;break e}}else if(q.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===t0&&nbe(F)===q.type){n(I,q.sibling),A=i(q,D.props),A.ref=bM(I,q,D),A.return=I,I=A;break e}n(I,q);break}else e(I,q);q=q.sibling}D.type===gS?(A=Vw(D.props.children,I.mode,$,D.key),A.return=I,I=A):($=rO(D.type,D.key,D.props,null,I.mode,$),$.ref=bM(I,A,D),$.return=I,I=$)}return c(I);case mS:e:{for(q=D.key;A!==null;){if(A.key===q)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){n(I,A.sibling),A=i(A,D.children||[]),A.return=I,I=A;break e}else{n(I,A);break}else e(I,A);A=A.sibling}A=ile(D,I.mode,$),A.return=I,I=A}return c(I);case t0:return q=D._init,T(I,A,q(D._payload),$)}if(XM(D))return C(I,A,D,$);if(gM(D))return S(I,A,D,$);$6(I,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,A!==null&&A.tag===6?(n(I,A.sibling),A=i(A,D),A.return=I,I=A):(n(I,A),A=sle(D,I.mode,$),A.return=I,I=A),c(I)):n(I,A)}return T}var W4=RMe(!0),FMe=RMe(!1),kee=L1(null),Nee=null,kS=null,rme=null;function nme(){rme=kS=Nee=null}function sme(t){var e=kee.current;ll(kee),t._currentValue=e}function Ode(t,e,n){for(;t!==null;){var s=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,s!==null&&(s.childLanes|=e)):s!==null&&(s.childLanes&e)!==e&&(s.childLanes|=e),t===n)break;t=t.return}}function FS(t,e){Nee=t,rme=kS=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ih=!0),t.firstContext=null)}function Kf(t){var e=t._currentValue;if(rme!==t)if(t={context:t,memoizedValue:e,next:null},kS===null){if(Nee===null)throw Error(Sn(308));kS=t,Nee.dependencies={lanes:0,firstContext:t}}else kS=kS.next=t;return e}var _w=null;function ime(t){_w===null?_w=[t]:_w.push(t)}function zMe(t,e,n,s){var i=e.interleaved;return i===null?(n.next=n,ime(e)):(n.next=i.next,i.next=n),e.interleaved=n,Wx(t,s)}function Wx(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var r0=!1;function ame(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function BMe(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ax(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function V0(t,e,n){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,Wa&2){var i=s.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),s.pending=e,Wx(t,n)}return i=s.interleaved,i===null?(e.next=e,ime(s)):(e.next=i.next,i.next=e),s.interleaved=e,Wx(t,n)}function YL(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Hpe(t,n)}}function sbe(t,e){var n=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var c={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=c:o=o.next=c,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:s.shared,effects:s.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function See(t,e,n,s){var i=t.updateQueue;r0=!1;var o=i.firstBaseUpdate,c=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var h=a,m=h.next;h.next=null,c===null?o=m:c.next=m,c=h;var x=t.alternate;x!==null&&(x=x.updateQueue,a=x.lastBaseUpdate,a!==c&&(a===null?x.firstBaseUpdate=m:a.next=m,x.lastBaseUpdate=h))}if(o!==null){var v=i.baseState;c=0,x=m=h=null,a=o;do{var w=a.lane,k=a.eventTime;if((s&w)===w){x!==null&&(x=x.next={eventTime:k,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var C=t,S=a;switch(w=e,k=n,S.tag){case 1:if(C=S.payload,typeof C=="function"){v=C.call(k,v,w);break e}v=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=S.payload,w=typeof C=="function"?C.call(k,v,w):C,w==null)break e;v=Il({},v,w);break e;case 2:r0=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,w=i.effects,w===null?i.effects=[a]:w.push(a))}else k={eventTime:k,lane:w,tag:a.tag,payload:a.payload,callback:a.callback,next:null},x===null?(m=x=k,h=v):x=x.next=k,c|=w;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;w=a,a=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);if(x===null&&(h=v),i.baseState=h,i.firstBaseUpdate=m,i.lastBaseUpdate=x,e=i.shared.interleaved,e!==null){i=e;do c|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);yj|=c,t.lanes=c,t.memoizedState=v}}function ibe(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var s=Joe.transition;Joe.transition={};try{t(!1),e()}finally{_o=n,Joe.transition=s}}function nTe(){return Zf().memoizedState}function yGe(t,e,n){var s=W0(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},sTe(t))iTe(e,n);else if(n=zMe(t,e,n,s),n!==null){var i=Mu();rm(n,t,s,i),aTe(n,e,s)}}function vGe(t,e,n){var s=W0(t),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(sTe(t))iTe(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var c=e.lastRenderedState,a=o(c,n);if(i.hasEagerState=!0,i.eagerState=a,hm(a,c)){var h=e.interleaved;h===null?(i.next=i,ime(e)):(i.next=h.next,h.next=i),e.interleaved=i;return}}catch{}finally{}n=zMe(t,e,i,s),n!==null&&(i=Mu(),rm(n,t,s,i),aTe(n,e,s))}}function sTe(t){var e=t.alternate;return t===Tl||e!==null&&e===Tl}function iTe(t,e){mT=Mee=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function aTe(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Hpe(t,n)}}var Tee={readContext:Kf,useCallback:zd,useContext:zd,useEffect:zd,useImperativeHandle:zd,useInsertionEffect:zd,useLayoutEffect:zd,useMemo:zd,useReducer:zd,useRef:zd,useState:zd,useDebugValue:zd,useDeferredValue:zd,useTransition:zd,useMutableSource:zd,useSyncExternalStore:zd,useId:zd,unstable_isNewReconciler:!1},_Ge={readContext:Kf,useCallback:function(t,e){return Hm().memoizedState=[t,e===void 0?null:e],t},useContext:Kf,useEffect:obe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,QL(4194308,4,QMe.bind(null,e,t),n)},useLayoutEffect:function(t,e){return QL(4194308,4,t,e)},useInsertionEffect:function(t,e){return QL(4,2,t,e)},useMemo:function(t,e){var n=Hm();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=Hm();return e=n!==void 0?n(e):e,s.memoizedState=s.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},s.queue=t,t=t.dispatch=yGe.bind(null,Tl,t),[s.memoizedState,t]},useRef:function(t){var e=Hm();return t={current:t},e.memoizedState=t},useState:abe,useDebugValue:pme,useDeferredValue:function(t){return Hm().memoizedState=t},useTransition:function(){var t=abe(!1),e=t[0];return t=xGe.bind(null,t[1]),Hm().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=Tl,i=Hm();if(xl){if(n===void 0)throw Error(Sn(407));n=n()}else{if(n=e(),sd===null)throw Error(Sn(349));xj&30||VMe(s,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,obe(WMe.bind(null,s,o,t),[t]),s.flags|=2048,EA(9,HMe.bind(null,s,o,n,e),void 0,null),n},useId:function(){var t=Hm(),e=sd.identifierPrefix;if(xl){var n=kx,s=jx;n=(s&~(1<<32-tm(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=TA++,0<\/script>",t=t.removeChild(t.firstChild)):typeof s.is=="string"?t=c.createElement(n,{is:s.is}):(t=c.createElement(n),n==="select"&&(c=t,s.multiple?c.multiple=!0:s.size&&(c.size=s.size))):t=c.createElementNS(t,n),t[eg]=e,t[SA]=s,gTe(t,e,!1,!1),e.stateNode=t;e:{switch(c=xde(n,s),n){case"dialog":sl("cancel",t),sl("close",t),i=s;break;case"iframe":case"object":case"embed":sl("load",t),i=s;break;case"video":case"audio":for(i=0;iZ4&&(e.flags|=128,s=!0,wM(o,!1),e.lanes=4194304)}else{if(!s)if(t=Cee(c),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),wM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!c.alternate&&!xl)return Bd(e),null}else 2*rc()-o.renderingStartTime>Z4&&n!==1073741824&&(e.flags|=128,s=!0,wM(o,!1),e.lanes=4194304);o.isBackwards?(c.sibling=e.child,e.child=c):(n=o.last,n!==null?n.sibling=c:e.child=c,o.last=c)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rc(),e.sibling=null,n=Sl.current,Go(Sl,s?n&1|2:n&1),e):(Bd(e),null);case 22:case 23:return _me(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?Eh&1073741824&&(Bd(e),e.subtreeFlags&6&&(e.flags|=8192)):Bd(e),null;case 24:return null;case 25:return null}throw Error(Sn(156,e.tag))}function MGe(t,e){switch(eme(e),e.tag){case 1:return dh(e.type)&&_ee(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return G4(),ll(ch),ll(Jd),cme(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return lme(e),null;case 13:if(ll(Sl),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Sn(340));H4()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ll(Sl),null;case 4:return G4(),null;case 10:return sme(e.type._context),null;case 22:case 23:return _me(),null;case 24:return null;default:return null}}var q6=!1,Vd=!1,TGe=typeof WeakSet=="function"?WeakSet:Set,xs=null;function NS(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Rl(t,e,s)}else n.current=null}function Vde(t,e,n){try{n()}catch(s){Rl(t,e,s)}}var ybe=!1;function AGe(t,e){if(Cde=gee,t=jMe(),Qpe(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var c=0,a=-1,h=-1,m=0,x=0,v=t,w=null;t:for(;;){for(var k;v!==n||i!==0&&v.nodeType!==3||(a=c+i),v!==o||s!==0&&v.nodeType!==3||(h=c+s),v.nodeType===3&&(c+=v.nodeValue.length),(k=v.firstChild)!==null;)w=v,v=k;for(;;){if(v===t)break t;if(w===n&&++m===i&&(a=c),w===o&&++x===s&&(h=c),(k=v.nextSibling)!==null)break;v=w,w=v.parentNode}v=k}n=a===-1||h===-1?null:{start:a,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Mde={focusedElem:t,selectionRange:n},gee=!1,xs=e;xs!==null;)if(e=xs,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,xs=t;else for(;xs!==null;){e=xs;try{var C=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var S=C.memoizedProps,T=C.memoizedState,I=e.stateNode,A=I.getSnapshotBeforeUpdate(e.elementType===e.type?S:zp(e.type,S),T);I.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var D=e.stateNode.containerInfo;D.nodeType===1?D.textContent="":D.nodeType===9&&D.documentElement&&D.removeChild(D.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Sn(163))}}catch($){Rl(e,e.return,$)}if(t=e.sibling,t!==null){t.return=e.return,xs=t;break}xs=e.return}return C=ybe,ybe=!1,C}function gT(t,e,n){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Vde(e,n,o)}i=i.next}while(i!==s)}}function pne(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var s=n.create;n.destroy=s()}n=n.next}while(n!==e)}}function Hde(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function vTe(t){var e=t.alternate;e!==null&&(t.alternate=null,vTe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[eg],delete e[SA],delete e[Ede],delete e[hGe],delete e[fGe])),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 _Te(t){return t.tag===5||t.tag===3||t.tag===4}function vbe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_Te(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 Wde(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=vee));else if(s!==4&&(t=t.child,t!==null))for(Wde(t,e,n),t=t.sibling;t!==null;)Wde(t,e,n),t=t.sibling}function Gde(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(s!==4&&(t=t.child,t!==null))for(Gde(t,e,n),t=t.sibling;t!==null;)Gde(t,e,n),t=t.sibling}var wd=null,qp=!1;function Hy(t,e,n){for(n=n.child;n!==null;)bTe(t,e,n),n=n.sibling}function bTe(t,e,n){if(og&&typeof og.onCommitFiberUnmount=="function")try{og.onCommitFiberUnmount(ane,n)}catch{}switch(n.tag){case 5:Vd||NS(n,e);case 6:var s=wd,i=qp;wd=null,Hy(t,e,n),wd=s,qp=i,wd!==null&&(qp?(t=wd,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):wd.removeChild(n.stateNode));break;case 18:wd!==null&&(qp?(t=wd,n=n.stateNode,t.nodeType===8?Yoe(t.parentNode,n):t.nodeType===1&&Yoe(t,n),bA(t)):Yoe(wd,n.stateNode));break;case 4:s=wd,i=qp,wd=n.stateNode.containerInfo,qp=!0,Hy(t,e,n),wd=s,qp=i;break;case 0:case 11:case 14:case 15:if(!Vd&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var o=i,c=o.destroy;o=o.tag,c!==void 0&&(o&2||o&4)&&Vde(n,e,c),i=i.next}while(i!==s)}Hy(t,e,n);break;case 1:if(!Vd&&(NS(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){Rl(n,e,a)}Hy(t,e,n);break;case 21:Hy(t,e,n);break;case 22:n.mode&1?(Vd=(s=Vd)||n.memoizedState!==null,Hy(t,e,n),Vd=s):Hy(t,e,n);break;default:Hy(t,e,n)}}function _be(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new TGe),e.forEach(function(s){var i=zGe.bind(null,t,s);n.has(s)||(n.add(s),s.then(i,i))})}}function Ip(t,e){var n=e.deletions;if(n!==null)for(var s=0;si&&(i=c),s&=~o}if(s=i,s=rc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*IGe(s/1960))-s,10t?16:t,E0===null)var s=!1;else{if(t=E0,E0=null,Iee=0,Wa&6)throw Error(Sn(331));var i=Wa;for(Wa|=4,xs=t.current;xs!==null;){var o=xs,c=o.child;if(xs.flags&16){var a=o.deletions;if(a!==null){for(var h=0;hrc()-yme?qw(t,0):xme|=n),uh(t,e)}function TTe(t,e){e===0&&(t.mode&1?(e=L6,L6<<=1,!(L6&130023424)&&(L6=4194304)):e=1);var n=Mu();t=Wx(t,e),t!==null&&(GE(t,e,n),uh(t,n))}function FGe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),TTe(t,n)}function zGe(t,e){var n=0;switch(t.tag){case 13:var s=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=t.stateNode;break;default:throw Error(Sn(314))}s!==null&&s.delete(e),TTe(t,n)}var ATe;ATe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ch.current)ih=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ih=!1,SGe(t,e,n);ih=!!(t.flags&131072)}else ih=!1,xl&&e.flags&1048576&&LMe(e,jee,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;JL(t,e),t=e.pendingProps;var i=V4(e,Jd.current);FS(e,n),i=ume(null,e,s,t,i,n);var o=hme();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,dh(s)?(o=!0,bee(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ame(e),i.updater=fne,e.stateNode=i,i._reactInternals=e,Rde(e,s,t,n),e=Bde(null,e,s,!0,o,n)):(e.tag=0,xl&&o&&Jpe(e),mu(null,e,i,n),e=e.child),e;case 16:s=e.elementType;e:{switch(JL(t,e),t=e.pendingProps,i=s._init,s=i(s._payload),e.type=s,i=e.tag=$Ge(s),t=zp(s,t),i){case 0:e=zde(null,e,s,t,n);break e;case 1:e=mbe(null,e,s,t,n);break e;case 11:e=fbe(null,e,s,t,n);break e;case 14:e=pbe(null,e,s,zp(s.type,t),n);break e}throw Error(Sn(306,s,""))}return e;case 0:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:zp(s,i),zde(t,e,s,i,n);case 1:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:zp(s,i),mbe(t,e,s,i,n);case 3:e:{if(fTe(e),t===null)throw Error(Sn(387));s=e.pendingProps,o=e.memoizedState,i=o.element,BMe(t,e),See(e,s,null,n);var c=e.memoizedState;if(s=c.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:c.cache,pendingSuspenseBoundaries:c.pendingSuspenseBoundaries,transitions:c.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=K4(Error(Sn(423)),e),e=gbe(t,e,s,n,i);break e}else if(s!==i){i=K4(Error(Sn(424)),e),e=gbe(t,e,s,n,i);break e}else for(Bh=q0(e.stateNode.containerInfo.firstChild),$h=e,xl=!0,Gp=null,n=FMe(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(H4(),s===i){e=Gx(t,e,n);break e}mu(t,e,s,n)}e=e.child}return e;case 5:return $Me(e),t===null&&Lde(e),s=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,c=i.children,Tde(s,i)?c=null:o!==null&&Tde(s,o)&&(e.flags|=32),hTe(t,e),mu(t,e,c,n),e.child;case 6:return t===null&&Lde(e),null;case 13:return pTe(t,e,n);case 4:return ome(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=W4(e,null,s,n):mu(t,e,s,n),e.child;case 11:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:zp(s,i),fbe(t,e,s,i,n);case 7:return mu(t,e,e.pendingProps,n),e.child;case 8:return mu(t,e,e.pendingProps.children,n),e.child;case 12:return mu(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(s=e.type._context,i=e.pendingProps,o=e.memoizedProps,c=i.value,Go(kee,s._currentValue),s._currentValue=c,o!==null)if(hm(o.value,c)){if(o.children===i.children&&!ch.current){e=Gx(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){c=o.child;for(var h=a.firstContext;h!==null;){if(h.context===s){if(o.tag===1){h=Ax(-1,n&-n),h.tag=2;var m=o.updateQueue;if(m!==null){m=m.shared;var x=m.pending;x===null?h.next=h:(h.next=x.next,x.next=h),m.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Ode(o.return,n,e),a.lanes|=n;break}h=h.next}}else if(o.tag===10)c=o.type===e.type?null:o.child;else if(o.tag===18){if(c=o.return,c===null)throw Error(Sn(341));c.lanes|=n,a=c.alternate,a!==null&&(a.lanes|=n),Ode(c,n,e),c=o.sibling}else c=o.child;if(c!==null)c.return=o;else for(c=o;c!==null;){if(c===e){c=null;break}if(o=c.sibling,o!==null){o.return=c.return,c=o;break}c=c.return}o=c}mu(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,s=e.pendingProps.children,FS(e,n),i=Kf(i),s=s(i),e.flags|=1,mu(t,e,s,n),e.child;case 14:return s=e.type,i=zp(s,e.pendingProps),i=zp(s.type,i),pbe(t,e,s,i,n);case 15:return dTe(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,i=e.pendingProps,i=e.elementType===s?i:zp(s,i),JL(t,e),e.tag=1,dh(s)?(t=!0,bee(e)):t=!1,FS(e,n),oTe(e,s,i),Rde(e,s,i,n),Bde(null,e,s,!0,t,n);case 19:return mTe(t,e,n);case 22:return uTe(t,e,n)}throw Error(Sn(156,e.tag))};function ETe(t,e){return sMe(t,e)}function BGe(t,e,n,s){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lf(t,e,n,s){return new BGe(t,e,n,s)}function wme(t){return t=t.prototype,!(!t||!t.isReactComponent)}function $Ge(t){if(typeof t=="function")return wme(t)?1:0;if(t!=null){if(t=t.$$typeof,t===$pe)return 11;if(t===Upe)return 14}return 2}function G0(t,e){var n=t.alternate;return n===null?(n=Lf(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function rO(t,e,n,s,i,o){var c=2;if(s=t,typeof t=="function")wme(t)&&(c=1);else if(typeof t=="string")c=5;else e:switch(t){case gS:return Vw(n.children,i,o,e);case Bpe:c=8,i|=8;break;case ode:return t=Lf(12,n,e,i|2),t.elementType=ode,t.lanes=o,t;case lde:return t=Lf(13,n,e,i),t.elementType=lde,t.lanes=o,t;case cde:return t=Lf(19,n,e,i),t.elementType=cde,t.lanes=o,t;case $3e:return gne(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case z3e:c=10;break e;case B3e:c=9;break e;case $pe:c=11;break e;case Upe:c=14;break e;case t0:c=16,s=null;break e}throw Error(Sn(130,t==null?t:typeof t,""))}return e=Lf(c,n,e,i),e.elementType=t,e.type=s,e.lanes=o,e}function Vw(t,e,n,s){return t=Lf(7,t,s,e),t.lanes=n,t}function gne(t,e,n,s){return t=Lf(22,t,s,e),t.elementType=$3e,t.lanes=n,t.stateNode={isHidden:!1},t}function sle(t,e,n){return t=Lf(6,t,null,e),t.lanes=n,t}function ile(t,e,n){return e=Lf(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function UGe(t,e,n,s,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zoe(0),this.expirationTimes=zoe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zoe(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function jme(t,e,n,s,i,o,c,a,h){return t=new UGe(t,e,n,a,h),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Lf(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ame(o),t}function qGe(t,e,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OTe)}catch(t){console.error(t)}}OTe(),O3e.exports=tf;var ny=O3e.exports;const Cme=Da(ny);var DTe,Mbe=ny;DTe=Mbe.createRoot,Mbe.hydrateRoot;const KGe=1,ZGe=1e6;let ale=0;function YGe(){return ale=(ale+1)%Number.MAX_SAFE_INTEGER,ale.toString()}const ole=new Map,Tbe=t=>{if(ole.has(t))return;const e=setTimeout(()=>{ole.delete(t),vT({type:"REMOVE_TOAST",toastId:t})},ZGe);ole.set(t,e)},XGe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,KGe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?Tbe(n):t.toasts.forEach(s=>{Tbe(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},nO=[];let sO={toasts:[]};function vT(t){sO=XGe(sO,t),nO.forEach(e=>{e(sO)})}function Yi({...t}){const e=YGe(),n=i=>vT({type:"UPDATE_TOAST",toast:{...i,id:e}}),s=()=>vT({type:"DISMISS_TOAST",toastId:e});return vT({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||s()}}}),{id:e,dismiss:s,update:n}}function ua(){const[t,e]=P.useState(sO);return P.useEffect(()=>(nO.push(e),()=>{const n=nO.indexOf(e);n>-1&&nO.splice(n,1)}),[t]),{...t,toast:Yi,dismiss:n=>vT({type:"DISMISS_TOAST",toastId:n})}}function an(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Abe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Kx(...t){return e=>{let n=!1;const s=t.map(i=>{const o=Abe(i,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:c,...a}=o,h=P.useMemo(()=>a,Object.values(a));return r.jsx(n.Provider,{value:h,children:c})};s.displayName=t+"Provider";function i(o){const c=P.useContext(n);if(c)return c;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[s,i]}function Zl(t,e=[]){let n=[];function s(o,c){const a=P.createContext(c),h=n.length;n=[...n,c];const m=v=>{var I;const{scope:w,children:k,...C}=v,S=((I=w==null?void 0:w[t])==null?void 0:I[h])||a,T=P.useMemo(()=>C,Object.values(C));return r.jsx(S.Provider,{value:T,children:k})};m.displayName=o+"Provider";function x(v,w){var S;const k=((S=w==null?void 0:w[t])==null?void 0:S[h])||a,C=P.useContext(k);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${v}\` must be used within \`${o}\``)}return[m,x]}const i=()=>{const o=n.map(c=>P.createContext(c));return function(a){const h=(a==null?void 0:a[t])||o;return P.useMemo(()=>({[`__scope${t}`]:{...a,[t]:h}}),[a,h])}};return i.scopeName=t,[s,JGe(i,...e)]}function JGe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const c=s.reduce((a,{useScope:h,scopeName:m})=>{const v=h(o)[`__scope${m}`];return{...a,...v}},{});return P.useMemo(()=>({[`__scope${e.scopeName}`]:c}),[c])}};return n.scopeName=e.scopeName,n}function N1(t){const e=eKe(t),n=P.forwardRef((s,i)=>{const{children:o,...c}=s,a=P.Children.toArray(o),h=a.find(tKe);if(h){const m=h.props.children,x=a.map(v=>v===h?P.Children.count(m)>1?P.Children.only(null):P.isValidElement(m)?m.props.children:null:v);return r.jsx(e,{...c,ref:i,children:P.isValidElement(m)?P.cloneElement(m,void 0,x):null})}return r.jsx(e,{...c,ref:i,children:o})});return n.displayName=`${t}.Slot`,n}var Mme=N1("Slot");function eKe(t){const e=P.forwardRef((n,s)=>{const{children:i,...o}=n;if(P.isValidElement(i)){const c=nKe(i),a=rKe(o,i.props);return i.type!==P.Fragment&&(a.ref=s?Kx(s,c):c),P.cloneElement(i,a)}return P.Children.count(i)>1?P.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var RTe=Symbol("radix.slottable");function FTe(t){const e=({children:n})=>r.jsx(r.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=RTe,e}function tKe(t){return P.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===RTe}function rKe(t,e){const n={...e};for(const s in e){const i=t[s],o=e[s];/^on[A-Z]/.test(s)?i&&o?n[s]=(...a)=>{const h=o(...a);return i(...a),h}:i&&(n[s]=i):s==="style"?n[s]={...i,...o}:s==="className"&&(n[s]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function nKe(t){var s,i;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function XE(t){const e=t+"CollectionProvider",[n,s]=Zl(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),c=S=>{const{scope:T,children:I}=S,A=lt.useRef(null),D=lt.useRef(new Map).current;return r.jsx(i,{scope:T,itemMap:D,collectionRef:A,children:I})};c.displayName=e;const a=t+"CollectionSlot",h=N1(a),m=lt.forwardRef((S,T)=>{const{scope:I,children:A}=S,D=o(a,I),$=Xs(T,D.collectionRef);return r.jsx(h,{ref:$,children:A})});m.displayName=a;const x=t+"CollectionItemSlot",v="data-radix-collection-item",w=N1(x),k=lt.forwardRef((S,T)=>{const{scope:I,children:A,...D}=S,$=lt.useRef(null),F=Xs(T,$),q=o(x,I);return lt.useEffect(()=>(q.itemMap.set($,{ref:$,...D}),()=>void q.itemMap.delete($))),r.jsx(w,{[v]:"",ref:F,children:A})});k.displayName=x;function C(S){const T=o(t+"CollectionConsumer",S);return lt.useCallback(()=>{const A=T.collectionRef.current;if(!A)return[];const D=Array.from(A.querySelectorAll(`[${v}]`));return Array.from(T.itemMap.values()).sort((q,W)=>D.indexOf(q.ref.current)-D.indexOf(W.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:c,Slot:m,ItemSlot:k},C,s]}var sKe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dn=sKe.reduce((t,e)=>{const n=N1(`Primitive.${e}`),s=P.forwardRef((i,o)=>{const{asChild:c,...a}=i,h=c?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(h,{...a,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Tme(t,e){t&&ny.flushSync(()=>t.dispatchEvent(e))}function ql(t){const e=P.useRef(t);return P.useEffect(()=>{e.current=t}),P.useMemo(()=>(...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)},[])}function iKe(t,e=globalThis==null?void 0:globalThis.document){const n=ql(t);P.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[n,e])}var aKe="DismissableLayer",Qde="dismissableLayer.update",oKe="dismissableLayer.pointerDownOutside",lKe="dismissableLayer.focusOutside",Ebe,zTe=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D1=P.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:c,onDismiss:a,...h}=t,m=P.useContext(zTe),[x,v]=P.useState(null),w=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,k]=P.useState({}),C=Xs(e,W=>v(W)),S=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),I=S.indexOf(T),A=x?S.indexOf(x):-1,D=m.layersWithOutsidePointerEventsDisabled.size>0,$=A>=I,F=dKe(W=>{const K=W.target,Z=[...m.branches].some(re=>re.contains(K));!$||Z||(i==null||i(W),c==null||c(W),W.defaultPrevented||a==null||a())},w),q=uKe(W=>{const K=W.target;[...m.branches].some(re=>re.contains(K))||(o==null||o(W),c==null||c(W),W.defaultPrevented||a==null||a())},w);return iKe(W=>{A===m.layers.size-1&&(s==null||s(W),!W.defaultPrevented&&a&&(W.preventDefault(),a()))},w),P.useEffect(()=>{if(x)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Ebe=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(x)),m.layers.add(x),Ibe(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Ebe)}},[x,w,n,m]),P.useEffect(()=>()=>{x&&(m.layers.delete(x),m.layersWithOutsidePointerEventsDisabled.delete(x),Ibe())},[x,m]),P.useEffect(()=>{const W=()=>k({});return document.addEventListener(Qde,W),()=>document.removeEventListener(Qde,W)},[]),r.jsx(Dn.div,{...h,ref:C,style:{pointerEvents:D?$?"auto":"none":void 0,...t.style},onFocusCapture:an(t.onFocusCapture,q.onFocusCapture),onBlurCapture:an(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:an(t.onPointerDownCapture,F.onPointerDownCapture)})});D1.displayName=aKe;var cKe="DismissableLayerBranch",BTe=P.forwardRef((t,e)=>{const n=P.useContext(zTe),s=P.useRef(null),i=Xs(e,s);return P.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Dn.div,{...t,ref:i})});BTe.displayName=cKe;function dKe(t,e=globalThis==null?void 0:globalThis.document){const n=ql(t),s=P.useRef(!1),i=P.useRef(()=>{});return P.useEffect(()=>{const o=a=>{if(a.target&&!s.current){let h=function(){$Te(oKe,n,m,{discrete:!0})};const m={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=h,e.addEventListener("click",i.current,{once:!0})):h()}else e.removeEventListener("click",i.current);s.current=!1},c=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>s.current=!0}}function uKe(t,e=globalThis==null?void 0:globalThis.document){const n=ql(t),s=P.useRef(!1);return P.useEffect(()=>{const i=o=>{o.target&&!s.current&&$Te(lKe,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Ibe(){const t=new CustomEvent(Qde);document.dispatchEvent(t)}function $Te(t,e,n,{discrete:s}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),s?Tme(i,o):i.dispatchEvent(o)}var hKe=D1,fKe=BTe,Gl=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},pKe="Portal",qC=P.forwardRef((t,e)=>{var a;const{container:n,...s}=t,[i,o]=P.useState(!1);Gl(()=>o(!0),[]);const c=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return c?Cme.createPortal(r.jsx(Dn.div,{...s,ref:e}),c):null});qC.displayName=pKe;function mKe(t,e){return P.useReducer((n,s)=>e[n][s]??n,t)}var lc=t=>{const{present:e,children:n}=t,s=gKe(e),i=typeof n=="function"?n({present:s.isPresent}):P.Children.only(n),o=Xs(s.ref,xKe(i));return typeof n=="function"||s.isPresent?P.cloneElement(i,{ref:o}):null};lc.displayName="Presence";function gKe(t){const[e,n]=P.useState(),s=P.useRef(null),i=P.useRef(t),o=P.useRef("none"),c=t?"mounted":"unmounted",[a,h]=mKe(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const m=W6(s.current);o.current=a==="mounted"?m:"none"},[a]),Gl(()=>{const m=s.current,x=i.current;if(x!==t){const w=o.current,k=W6(m);t?h("MOUNT"):k==="none"||(m==null?void 0:m.display)==="none"?h("UNMOUNT"):h(x&&w!==k?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,h]),Gl(()=>{if(e){let m;const x=e.ownerDocument.defaultView??window,v=k=>{const S=W6(s.current).includes(k.animationName);if(k.target===e&&S&&(h("ANIMATION_END"),!i.current)){const T=e.style.animationFillMode;e.style.animationFillMode="forwards",m=x.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=T)})}},w=k=>{k.target===e&&(o.current=W6(s.current))};return e.addEventListener("animationstart",w),e.addEventListener("animationcancel",v),e.addEventListener("animationend",v),()=>{x.clearTimeout(m),e.removeEventListener("animationstart",w),e.removeEventListener("animationcancel",v),e.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[e,h]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:P.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function W6(t){return(t==null?void 0:t.animationName)||"none"}function xKe(t){var s,i;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var yKe=Dpe[" useInsertionEffect ".trim().toString()]||Gl;function Eu({prop:t,defaultProp:e,onChange:n=()=>{},caller:s}){const[i,o,c]=vKe({defaultProp:e,onChange:n}),a=t!==void 0,h=a?t:i;{const x=P.useRef(t!==void 0);P.useEffect(()=>{const v=x.current;v!==a&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=a},[a,s])}const m=P.useCallback(x=>{var v;if(a){const w=_Ke(x)?x(t):x;w!==t&&((v=c.current)==null||v.call(c,w))}else o(x)},[a,t,o,c]);return[h,m]}function vKe({defaultProp:t,onChange:e}){const[n,s]=P.useState(t),i=P.useRef(n),o=P.useRef(e);return yKe(()=>{o.current=e},[e]),P.useEffect(()=>{var c;i.current!==n&&((c=o.current)==null||c.call(o,n),i.current=n)},[n,i]),[n,s,o]}function _Ke(t){return typeof t=="function"}var UTe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),bKe="VisuallyHidden",bne=P.forwardRef((t,e)=>r.jsx(Dn.span,{...t,ref:e,style:{...UTe,...t.style}}));bne.displayName=bKe;var wKe=bne,Ame="ToastProvider",[Eme,jKe,kKe]=XE("Toast"),[qTe]=Zl("Toast",[kKe]),[NKe,wne]=qTe(Ame),VTe=t=>{const{__scopeToast:e,label:n="Notification",duration:s=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:c}=t,[a,h]=P.useState(null),[m,x]=P.useState(0),v=P.useRef(!1),w=P.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ame}\`. Expected non-empty \`string\`.`),r.jsx(Eme.Provider,{scope:e,children:r.jsx(NKe,{scope:e,label:n,duration:s,swipeDirection:i,swipeThreshold:o,toastCount:m,viewport:a,onViewportChange:h,onToastAdd:P.useCallback(()=>x(k=>k+1),[]),onToastRemove:P.useCallback(()=>x(k=>k-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:w,children:c})})};VTe.displayName=Ame;var HTe="ToastViewport",SKe=["F8"],Jde="toast.viewportPause",eue="toast.viewportResume",WTe=P.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:s=SKe,label:i="Notifications ({hotkey})",...o}=t,c=wne(HTe,n),a=jKe(n),h=P.useRef(null),m=P.useRef(null),x=P.useRef(null),v=P.useRef(null),w=Xs(e,v,c.onViewportChange),k=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=c.toastCount>0;P.useEffect(()=>{const T=I=>{var D;s.length!==0&&s.every($=>I[$]||I.code===$)&&((D=v.current)==null||D.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[s]),P.useEffect(()=>{const T=h.current,I=v.current;if(C&&T&&I){const A=()=>{if(!c.isClosePausedRef.current){const q=new CustomEvent(Jde);I.dispatchEvent(q),c.isClosePausedRef.current=!0}},D=()=>{if(c.isClosePausedRef.current){const q=new CustomEvent(eue);I.dispatchEvent(q),c.isClosePausedRef.current=!1}},$=q=>{!T.contains(q.relatedTarget)&&D()},F=()=>{T.contains(document.activeElement)||D()};return T.addEventListener("focusin",A),T.addEventListener("focusout",$),T.addEventListener("pointermove",A),T.addEventListener("pointerleave",F),window.addEventListener("blur",A),window.addEventListener("focus",D),()=>{T.removeEventListener("focusin",A),T.removeEventListener("focusout",$),T.removeEventListener("pointermove",A),T.removeEventListener("pointerleave",F),window.removeEventListener("blur",A),window.removeEventListener("focus",D)}}},[C,c.isClosePausedRef]);const S=P.useCallback(({tabbingDirection:T})=>{const A=a().map(D=>{const $=D.ref.current,F=[$,...zKe($)];return T==="forwards"?F:F.reverse()});return(T==="forwards"?A.reverse():A).flat()},[a]);return P.useEffect(()=>{const T=v.current;if(T){const I=A=>{var F,q,W;const D=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!D){const K=document.activeElement,Z=A.shiftKey;if(A.target===T&&Z){(F=m.current)==null||F.focus();return}const ue=S({tabbingDirection:Z?"backwards":"forwards"}),je=ue.findIndex(ne=>ne===K);lle(ue.slice(je+1))?A.preventDefault():Z?(q=m.current)==null||q.focus():(W=x.current)==null||W.focus()}};return T.addEventListener("keydown",I),()=>T.removeEventListener("keydown",I)}},[a,S]),r.jsxs(fKe,{ref:h,role:"region","aria-label":i.replace("{hotkey}",k),tabIndex:-1,style:{pointerEvents:C?void 0:"none"},children:[C&&r.jsx(tue,{ref:m,onFocusFromOutsideViewport:()=>{const T=S({tabbingDirection:"forwards"});lle(T)}}),r.jsx(Eme.Slot,{scope:n,children:r.jsx(Dn.ol,{tabIndex:-1,...o,ref:w})}),C&&r.jsx(tue,{ref:x,onFocusFromOutsideViewport:()=>{const T=S({tabbingDirection:"backwards"});lle(T)}})]})});WTe.displayName=HTe;var GTe="ToastFocusProxy",tue=P.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...i}=t,o=wne(GTe,n);return r.jsx(bne,{"aria-hidden":!0,tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:c=>{var m;const a=c.relatedTarget;!((m=o.viewport)!=null&&m.contains(a))&&s()}})});tue.displayName=GTe;var QE="Toast",CKe="toast.swipeStart",MKe="toast.swipeMove",TKe="toast.swipeCancel",AKe="toast.swipeEnd",KTe=P.forwardRef((t,e)=>{const{forceMount:n,open:s,defaultOpen:i,onOpenChange:o,...c}=t,[a,h]=Eu({prop:s,defaultProp:i??!0,onChange:o,caller:QE});return r.jsx(lc,{present:n||a,children:r.jsx(PKe,{open:a,...c,ref:e,onClose:()=>h(!1),onPause:ql(t.onPause),onResume:ql(t.onResume),onSwipeStart:an(t.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:an(t.onSwipeMove,m=>{const{x,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:an(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:an(t.onSwipeEnd,m=>{const{x,y:v}=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",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),h(!1)})})})});KTe.displayName=QE;var[EKe,IKe]=qTe(QE,{onClose(){}}),PKe=P.forwardRef((t,e)=>{const{__scopeToast:n,type:s="foreground",duration:i,open:o,onClose:c,onEscapeKeyDown:a,onPause:h,onResume:m,onSwipeStart:x,onSwipeMove:v,onSwipeCancel:w,onSwipeEnd:k,...C}=t,S=wne(QE,n),[T,I]=P.useState(null),A=Xs(e,ne=>I(ne)),D=P.useRef(null),$=P.useRef(null),F=i||S.duration,q=P.useRef(0),W=P.useRef(F),K=P.useRef(0),{onToastAdd:Z,onToastRemove:re}=S,he=ql(()=>{var ye;(T==null?void 0:T.contains(document.activeElement))&&((ye=S.viewport)==null||ye.focus()),c()}),ue=P.useCallback(ne=>{!ne||ne===1/0||(window.clearTimeout(K.current),q.current=new Date().getTime(),K.current=window.setTimeout(he,ne))},[he]);P.useEffect(()=>{const ne=S.viewport;if(ne){const ye=()=>{ue(W.current),m==null||m()},ie=()=>{const me=new Date().getTime()-q.current;W.current=W.current-me,window.clearTimeout(K.current),h==null||h()};return ne.addEventListener(Jde,ie),ne.addEventListener(eue,ye),()=>{ne.removeEventListener(Jde,ie),ne.removeEventListener(eue,ye)}}},[S.viewport,F,h,m,ue]),P.useEffect(()=>{o&&!S.isClosePausedRef.current&&ue(F)},[o,F,S.isClosePausedRef,ue]),P.useEffect(()=>(Z(),()=>re()),[Z,re]);const je=P.useMemo(()=>T?tAe(T):null,[T]);return S.viewport?r.jsxs(r.Fragment,{children:[je&&r.jsx(LKe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:je}),r.jsx(EKe,{scope:n,onClose:he,children:ny.createPortal(r.jsx(Eme.ItemSlot,{scope:n,children:r.jsx(hKe,{asChild:!0,onEscapeKeyDown:an(a,()=>{S.isFocusedToastEscapeKeyDownRef.current||he(),S.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Dn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":S.swipeDirection,...C,ref:A,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:an(t.onKeyDown,ne=>{ne.key==="Escape"&&(a==null||a(ne.nativeEvent),ne.nativeEvent.defaultPrevented||(S.isFocusedToastEscapeKeyDownRef.current=!0,he()))}),onPointerDown:an(t.onPointerDown,ne=>{ne.button===0&&(D.current={x:ne.clientX,y:ne.clientY})}),onPointerMove:an(t.onPointerMove,ne=>{if(!D.current)return;const ye=ne.clientX-D.current.x,ie=ne.clientY-D.current.y,me=!!$.current,fe=["left","right"].includes(S.swipeDirection),ve=["left","up"].includes(S.swipeDirection)?Math.min:Math.max,Ie=fe?ve(0,ye):0,Se=fe?0:ve(0,ie),oe=ne.pointerType==="touch"?10:2,ae={x:Ie,y:Se},Ne={originalEvent:ne,delta:ae};me?($.current=ae,G6(MKe,v,Ne,{discrete:!1})):Pbe(ae,S.swipeDirection,oe)?($.current=ae,G6(CKe,x,Ne,{discrete:!1}),ne.target.setPointerCapture(ne.pointerId)):(Math.abs(ye)>oe||Math.abs(ie)>oe)&&(D.current=null)}),onPointerUp:an(t.onPointerUp,ne=>{const ye=$.current,ie=ne.target;if(ie.hasPointerCapture(ne.pointerId)&&ie.releasePointerCapture(ne.pointerId),$.current=null,D.current=null,ye){const me=ne.currentTarget,fe={originalEvent:ne,delta:ye};Pbe(ye,S.swipeDirection,S.swipeThreshold)?G6(AKe,k,fe,{discrete:!0}):G6(TKe,w,fe,{discrete:!0}),me.addEventListener("click",ve=>ve.preventDefault(),{once:!0})}})})})}),S.viewport)})]}):null}),LKe=t=>{const{__scopeToast:e,children:n,...s}=t,i=wne(QE,e),[o,c]=P.useState(!1),[a,h]=P.useState(!1);return RKe(()=>c(!0)),P.useEffect(()=>{const m=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(m)},[]),a?null:r.jsx(qC,{asChild:!0,children:r.jsx(bne,{...s,children:o&&r.jsxs(r.Fragment,{children:[i.label," ",n]})})})},OKe="ToastTitle",ZTe=P.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Dn.div,{...s,ref:e})});ZTe.displayName=OKe;var DKe="ToastDescription",YTe=P.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Dn.div,{...s,ref:e})});YTe.displayName=DKe;var XTe="ToastAction",QTe=P.forwardRef((t,e)=>{const{altText:n,...s}=t;return n.trim()?r.jsx(eAe,{altText:n,asChild:!0,children:r.jsx(Ime,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${XTe}\`. Expected non-empty \`string\`.`),null)});QTe.displayName=XTe;var JTe="ToastClose",Ime=P.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t,i=IKe(JTe,n);return r.jsx(eAe,{asChild:!0,children:r.jsx(Dn.button,{type:"button",...s,ref:e,onClick:an(t.onClick,i.onClose)})})});Ime.displayName=JTe;var eAe=P.forwardRef((t,e)=>{const{__scopeToast:n,altText:s,...i}=t;return r.jsx(Dn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...i,ref:e})});function tAe(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),FKe(s)){const i=s.ariaHidden||s.hidden||s.style.display==="none",o=s.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const c=s.dataset.radixToastAnnounceAlt;c&&e.push(c)}else e.push(...tAe(s))}}),e}function G6(t,e,n,{discrete:s}){const i=n.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),s?Tme(i,o):i.dispatchEvent(o)}var Pbe=(t,e,n=0)=>{const s=Math.abs(t.x),i=Math.abs(t.y),o=s>i;return e==="left"||e==="right"?o&&s>n:!o&&i>n};function RKe(t=()=>{}){const e=ql(t);Gl(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[e])}function FKe(t){return t.nodeType===t.ELEMENT_NODE}function zKe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function lle(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var BKe=VTe,rAe=WTe,nAe=KTe,sAe=ZTe,iAe=YTe,aAe=QTe,oAe=Ime;function lAe(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Obe=ra,VC=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return Obe(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,c=Object.keys(i).map(m=>{const x=n==null?void 0:n[m],v=o==null?void 0:o[m];if(x===null)return null;const w=Lbe(x)||Lbe(v);return i[m][w]}),a=n&&Object.entries(n).reduce((m,x)=>{let[v,w]=x;return w===void 0||(m[v]=w),m},{}),h=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((m,x)=>{let{class:v,className:w,...k}=x;return Object.entries(k).every(C=>{let[S,T]=C;return Array.isArray(T)?T.includes({...o,...a}[S]):{...o,...a}[S]===T})?[...m,v,w]:m},[]);return Obe(t,c,h,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Ke=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cAe=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var UKe={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 dAe=P.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:o,iconNode:c,...a},h)=>P.createElement("svg",{ref:h,...UKe,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:cAe("lucide",i),...a},[...c.map(([m,x])=>P.createElement(m,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U=(t,e)=>{const n=P.forwardRef(({className:s,...i},o)=>P.createElement(dAe,{ref:o,iconNode:e,className:cAe(`lucide-${$Ke(t)}`,s),...i}));return n.displayName=`${t}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iO=U("AArrowDown",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 7v9",key:"pknjwm"}],["path",{d:"m14 12 4 4 4-4",key:"buelq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aO=U("AArrowUp",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 16V7",key:"ty0viw"}],["path",{d:"m14 11 4-4 4 4",key:"1pu57t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oO=U("ALargeSmall",[["path",{d:"M21 14h-5",key:"1vh23k"}],["path",{d:"M16 16v-3.5a2.5 2.5 0 0 1 5 0V16",key:"1wh10o"}],["path",{d:"M4.5 13h6",key:"dfilno"}],["path",{d:"m3 16 4.5-9 4.5 9",key:"2dxa0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lO=U("Accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cg=U("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cO=U("AirVent",[["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12",key:"1bo8pg"}],["path",{d:"M6.6 15.6A2 2 0 1 0 10 17v-5",key:"t9h90c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dO=U("Airplay",[["path",{d:"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",key:"ns4c3b"}],["path",{d:"m12 15 5 6H7Z",key:"14qnn2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yv=U("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xv=U("AlarmClockMinus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uO=U("AlarmClockOff",[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qv=U("AlarmClockPlus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hO=U("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fO=U("AlarmSmoke",[["path",{d:"M11 21c0-2.5 2-2.5 2-5",key:"1sicvv"}],["path",{d:"M16 21c0-2.5 2-2.5 2-5",key:"1o3eny"}],["path",{d:"m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8",key:"1bvca4"}],["path",{d:"M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z",key:"x3qr1j"}],["path",{d:"M6 21c0-2.5 2-2.5 2-5",key:"i3w1gp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pO=U("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mO=U("AlignCenterHorizontal",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gO=U("AlignCenterVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BS=U("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xO=U("AlignEndHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yO=U("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vO=U("AlignHorizontalDistributeCenter",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _O=U("AlignHorizontalDistributeEnd",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M10 2v20",key:"uyc634"}],["path",{d:"M20 2v20",key:"1tx262"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bO=U("AlignHorizontalDistributeStart",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M4 2v20",key:"gtpd5x"}],["path",{d:"M14 2v20",key:"tg6bpw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wO=U("AlignHorizontalJustifyCenter",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jO=U("AlignHorizontalJustifyEnd",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"12",y:"7",rx:"2",key:"1ht384"}],["path",{d:"M22 2v20",key:"40qfg1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kO=U("AlignHorizontalJustifyStart",[["rect",{width:"6",height:"14",x:"6",y:"5",rx:"2",key:"hsirpf"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NO=U("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SO=U("AlignHorizontalSpaceBetween",[["rect",{width:"6",height:"14",x:"3",y:"5",rx:"2",key:"j77dae"}],["rect",{width:"6",height:"10",x:"15",y:"7",rx:"2",key:"bq30hj"}],["path",{d:"M3 2v20",key:"1d2pfg"}],["path",{d:"M21 2v20",key:"p059bm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CO=U("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $S=U("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const US=U("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MO=U("AlignStartHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TO=U("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AO=U("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EO=U("AlignVerticalDistributeEnd",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IO=U("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PO=U("AlignVerticalJustifyCenter",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LO=U("AlignVerticalJustifyEnd",[["rect",{width:"14",height:"6",x:"5",y:"12",rx:"2",key:"4l4tp2"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 22h20",key:"272qi7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OO=U("AlignVerticalJustifyStart",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"6",rx:"2",key:"13squh"}],["path",{d:"M2 2h20",key:"1ennik"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DO=U("AlignVerticalSpaceAround",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RO=U("AlignVerticalSpaceBetween",[["rect",{width:"14",height:"6",x:"5",y:"15",rx:"2",key:"1w91an"}],["rect",{width:"10",height:"6",x:"7",y:"3",rx:"2",key:"17wqzy"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M2 3h20",key:"91anmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FO=U("Ambulance",[["path",{d:"M10 10H6",key:"1bsnug"}],["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14",key:"lrkjwd"}],["path",{d:"M8 8v4",key:"1fwk8c"}],["path",{d:"M9 18h6",key:"x1upvd"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zO=U("Ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BO=U("Ampersands",[["path",{d:"M10 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"12lh1k"}],["path",{d:"M22 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"173c68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $O=U("Amphora",[["path",{d:"M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8",key:"1h8rid"}],["path",{d:"M10 5H8a2 2 0 0 0 0 4h.68",key:"3ezsi6"}],["path",{d:"M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8",key:"yt6q09"}],["path",{d:"M14 5h2a2 2 0 0 1 0 4h-.68",key:"8f95yk"}],["path",{d:"M18 22H6",key:"mg6kv4"}],["path",{d:"M9 2h6",key:"1jrp98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UO=U("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qO=U("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VO=U("Annoyed",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M14 9h2",key:"116p9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HO=U("Antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WO=U("Anvil",[["path",{d:"M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4",key:"1hjpb6"}],["path",{d:"M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z",key:"1qn45f"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1",key:"1fi4x8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GO=U("Aperture",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KO=U("AppWindowMac",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _T=U("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZO=U("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YO=U("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XO=U("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QO=U("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JO=U("Armchair",[["path",{d:"M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3",key:"irtipd"}],["path",{d:"M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"1qyhux"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e8=U("ArrowBigDownDash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t8=U("ArrowBigDown",[["path",{d:"M15 6v6h4l-7 7-7-7h4V6h6z",key:"1thax2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r8=U("ArrowBigLeftDash",[["path",{d:"M19 15V9",key:"1hci5f"}],["path",{d:"M15 15h-3v4l-7-7 7-7v4h3v6z",key:"16tjna"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n8=U("ArrowBigLeft",[["path",{d:"M18 15h-6v4l-7-7 7-7v4h6v6z",key:"lbrdak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s8=U("ArrowBigRightDash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i8=U("ArrowBigRight",[["path",{d:"M6 9h6V5l7 7-7 7v-4H6V9z",key:"7fvt9c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a8=U("ArrowBigUpDash",[["path",{d:"M9 19h6",key:"456am0"}],["path",{d:"M9 15v-3H5l7-7 7 7h-4v3H9z",key:"1r2uve"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o8=U("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l8=U("ArrowDown01",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c8=U("ArrowDown10",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jv=U("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d8=U("ArrowDownFromLine",[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u8=U("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h8=U("ArrowDownNarrowWide",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f8=U("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p8=U("ArrowDownToDot",[["path",{d:"M12 2v14",key:"jyx4ut"}],["path",{d:"m19 9-7 7-7-7",key:"1oe3oy"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m8=U("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g8=U("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e_=U("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t_=U("ArrowDownZA",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hw=U("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x8=U("ArrowLeftFromLine",[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=U("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=U("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ga=U("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _8=U("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b8=U("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w8=U("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ho=U("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j8=U("ArrowUp01",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k8=U("ArrowUp10",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r_=U("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ex=U("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N8=U("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S8=U("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C8=U("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n_=U("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M8=U("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T8=U("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A8=U("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s_=U("ArrowUpZA",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ix=U("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E8=U("ArrowsUpFromLine",[["path",{d:"m4 6 3-3 3 3",key:"9aidw8"}],["path",{d:"M7 17V3",key:"19qxw1"}],["path",{d:"m14 6 3-3 3 3",key:"6iy689"}],["path",{d:"M17 17V3",key:"o0fmgi"}],["path",{d:"M4 21h16",key:"1h09gz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I8=U("Asterisk",[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P8=U("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L8=U("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O8=U("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D8=U("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ml=U("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R8=U("Axe",[["path",{d:"m14 12-8.5 8.5a2.12 2.12 0 1 1-3-3L11 9",key:"csbz4o"}],["path",{d:"M15 13 9 7l4-4 6 6h3a8 8 0 0 1-7 7z",key:"113wfo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i_=U("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F8=U("Baby",[["path",{d:"M9 12h.01",key:"157uk2"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"5yv0yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z8=U("Backpack",[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B8=U("BadgeAlert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $8=U("BadgeCent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M15.4 10a4 4 0 1 0 0 4",key:"2eqtx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a_=U("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U8=U("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q8=U("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V8=U("BadgeHelp",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H8=U("BadgeIndianRupee",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 8h8",key:"1bis0t"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m13 17-5-1h1a4 4 0 0 0 0-8",key:"nu2bwa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W8=U("BadgeInfo",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G8=U("BadgeJapaneseYen",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 8 3 3v7",key:"17yadx"}],["path",{d:"m12 11 3-3",key:"p4cfq1"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M9 16h6",key:"8wimt3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K8=U("BadgeMinus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z8=U("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y8=U("BadgePlus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X8=U("BadgePoundSterling",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 12h4",key:"qz6y1c"}],["path",{d:"M10 16V9.5a2.5 2.5 0 0 1 5 0",key:"3mlbjk"}],["path",{d:"M8 16h7",key:"sbedsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q8=U("BadgeRussianRuble",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9 16h5",key:"1syiyw"}],["path",{d:"M9 12h5a2 2 0 1 0 0-4h-3v9",key:"1ge9c1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J8=U("BadgeSwissFranc",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M11 17V8h4",key:"1bfq6y"}],["path",{d:"M11 12h3",key:"2eqnfz"}],["path",{d:"M9 16h4",key:"1skf3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eD=U("BadgeX",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tD=U("Badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rD=U("BaggageClaim",[["path",{d:"M22 18H6a2 2 0 0 1-2-2V7a2 2 0 0 0-2-2",key:"4irg2o"}],["path",{d:"M17 14V4a2 2 0 0 0-2-2h-1a2 2 0 0 0-2 2v10",key:"14fcyx"}],["rect",{width:"13",height:"8",x:"8",y:"6",rx:"1",key:"o6oiis"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"9",cy:"20",r:"2",key:"e5v82j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nD=U("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sD=U("Banana",[["path",{d:"M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5",key:"1cscit"}],["path",{d:"M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z",key:"1y1nbv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iD=U("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aD=U("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oD=U("Barcode",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lD=U("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ff=U("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cD=U("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dD=U("BatteryFull",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"13",key:"c6fn6x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uD=U("BatteryLow",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hD=U("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fD=U("BatteryWarning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 7h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1x5o8m"}],["path",{d:"M22 11v2",key:"1wo06k"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"1mdjgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pD=U("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mD=U("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gD=U("BeanOff",[["path",{d:"M9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22a13.96 13.96 0 0 0 9.9-4.1",key:"bq3udt"}],["path",{d:"M10.75 5.093A6 6 0 0 1 22 8c0 2.411-.61 4.68-1.683 6.66",key:"17ccse"}],["path",{d:"M5.341 10.62a4 4 0 0 0 6.487 1.208M10.62 5.341a4.015 4.015 0 0 1 2.039 2.04",key:"18zqgq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xD=U("Bean",[["path",{d:"M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z",key:"1tvzk7"}],["path",{d:"M5.341 10.62a4 4 0 1 0 5.279-5.28",key:"2cyri2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yD=U("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vD=U("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zf=U("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _D=U("Beef",[["circle",{cx:"12.5",cy:"8.5",r:"2.5",key:"9738u8"}],["path",{d:"M12.5 2a6.5 6.5 0 0 0-6.22 4.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3A6.5 6.5 0 0 0 12.5 2Z",key:"o0f6za"}],["path",{d:"m18.5 6 2.19 4.5a6.48 6.48 0 0 1 .31 2 6.49 6.49 0 0 1-2.6 5.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5",key:"k7p6i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bD=U("BeerOff",[["path",{d:"M13 13v5",key:"igwfh0"}],["path",{d:"M17 11.47V8",key:"16yw0g"}],["path",{d:"M17 11h1a3 3 0 0 1 2.745 4.211",key:"1xbt65"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3",key:"c55o3e"}],["path",{d:"M7.536 7.535C6.766 7.649 6.154 8 5.5 8a2.5 2.5 0 0 1-1.768-4.268",key:"1ydug7"}],["path",{d:"M8.727 3.204C9.306 2.767 9.885 2 11 2c1.56 0 2 1.5 3 1.5s1.72-.5 2.5-.5a1 1 0 1 1 0 5c-.78 0-1.5-.5-2.5-.5a3.149 3.149 0 0 0-.842.12",key:"q81o7q"}],["path",{d:"M9 14.6V18",key:"20ek98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wD=U("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jD=U("BellDot",[["path",{d:"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3",key:"xcehk"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kD=U("BellElectric",[["path",{d:"M18.8 4A6.3 8.7 0 0 1 20 9",key:"xve1fh"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["rect",{width:"10",height:"6",x:"4",y:"16",rx:"2",key:"17f3te"}],["path",{d:"M14 19c3 0 4.6-1.6 4.6-1.6",key:"n7odp6"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ND=U("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ww=U("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SD=U("BellPlus",[["path",{d:"M19.3 14.8C20.1 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 1 0 1.9.2 2.8.7",key:"guizqy"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}],["path",{d:"M18 5v6",key:"g5ayrv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CD=U("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dg=U("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o_=U("BetweenHorizontalEnd",[["rect",{width:"13",height:"7",x:"3",y:"3",rx:"1",key:"11xb64"}],["path",{d:"m22 15-3-3 3-3",key:"26chmm"}],["rect",{width:"13",height:"7",x:"3",y:"14",rx:"1",key:"k6ky7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l_=U("BetweenHorizontalStart",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MD=U("BetweenVerticalEnd",[["rect",{width:"7",height:"13",x:"3",y:"3",rx:"1",key:"1fdu0f"}],["path",{d:"m9 22 3-3 3 3",key:"17z65a"}],["rect",{width:"7",height:"13",x:"14",y:"3",rx:"1",key:"1squn4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TD=U("BetweenVerticalStart",[["rect",{width:"7",height:"13",x:"3",y:"8",rx:"1",key:"1fjrkv"}],["path",{d:"m15 2-3 3-3-3",key:"1uh6eb"}],["rect",{width:"7",height:"13",x:"14",y:"8",rx:"1",key:"w3fjg8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AD=U("BicepsFlexed",[["path",{d:"M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1",key:"1pmlyh"}],["path",{d:"M15 14a5 5 0 0 0-7.584 2",key:"5rb254"}],["path",{d:"M9.964 6.825C8.019 7.977 9.5 13 8 15",key:"kbvsx9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ED=U("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ID=U("Binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PD=U("Binoculars",[["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M19 7V4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3",key:"3apit1"}],["path",{d:"M20 21a2 2 0 0 0 2-2v-3.851c0-1.39-2-2.962-2-4.829V8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2z",key:"rhpgnw"}],["path",{d:"M 22 16 L 2 16",key:"14lkq7"}],["path",{d:"M4 21a2 2 0 0 1-2-2v-3.851c0-1.39 2-2.962 2-4.829V8a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v11a2 2 0 0 1-2 2z",key:"104b3k"}],["path",{d:"M9 7V4a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v3",key:"14fczp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LD=U("Biohazard",[["circle",{cx:"12",cy:"11.9",r:"2",key:"e8h31w"}],["path",{d:"M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6",key:"17bolr"}],["path",{d:"m8.9 10.1 1.4.8",key:"15ezny"}],["path",{d:"M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5",key:"wtwa5u"}],["path",{d:"m15.1 10.1-1.4.8",key:"1r0b28"}],["path",{d:"M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2",key:"m7qszh"}],["path",{d:"M12 13.9v1.6",key:"zfyyim"}],["path",{d:"M13.5 5.4c-1-.2-2-.2-3 0",key:"1bi9q0"}],["path",{d:"M17 16.4c.7-.7 1.2-1.6 1.5-2.5",key:"1rhjqw"}],["path",{d:"M5.5 13.9c.3.9.8 1.8 1.5 2.5",key:"8gsud3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OD=U("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DD=U("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RD=U("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FD=U("Blinds",[["path",{d:"M3 3h18",key:"o7r712"}],["path",{d:"M20 7H8",key:"gd2fo2"}],["path",{d:"M20 11H8",key:"1ynp89"}],["path",{d:"M10 19h10",key:"19hjk5"}],["path",{d:"M8 15h12",key:"1yqzne"}],["path",{d:"M4 3v14",key:"fggqzn"}],["circle",{cx:"4",cy:"19",r:"2",key:"p3m9r0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zD=U("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BD=U("BluetoothConnected",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["line",{x1:"18",x2:"21",y1:"12",y2:"12",key:"1rsjjs"}],["line",{x1:"3",x2:"6",y1:"12",y2:"12",key:"11yl8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $D=U("BluetoothOff",[["path",{d:"m17 17-5 5V12l-5 5",key:"v5aci6"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M14.5 9.5 17 7l-5-5v4.5",key:"1kddfz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UD=U("BluetoothSearching",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["path",{d:"M20.83 14.83a4 4 0 0 0 0-5.66",key:"k8tn1j"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qD=U("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qS=U("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VD=U("Bolt",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HD=U("Bomb",[["circle",{cx:"11",cy:"13",r:"9",key:"hd149"}],["path",{d:"M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",key:"jp4j1b"}],["path",{d:"m22 2-1.5 1.5",key:"ay92ug"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WD=U("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GD=U("BookA",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KD=U("BookAudio",[["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8v3",key:"gejaml"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 8v3",key:"1qzp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZD=U("BookCheck",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YD=U("BookCopy",[["path",{d:"M2 16V4a2 2 0 0 1 2-2h11",key:"spzkk5"}],["path",{d:"M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",key:"1wz07i"}],["path",{d:"M5 14H4a2 2 0 1 0 0 4h1",key:"16gqf9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c_=U("BookDashed",[["path",{d:"M12 17h2",key:"13u4lk"}],["path",{d:"M12 22h2",key:"kn7ki6"}],["path",{d:"M12 2h2",key:"cvn524"}],["path",{d:"M18 22h1a1 1 0 0 0 1-1",key:"w6gbqz"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v1",key:"1vpra5"}],["path",{d:"M20 15v2h-2",key:"fph276"}],["path",{d:"M20 8v3",key:"deu0bs"}],["path",{d:"M4 11V9",key:"v3xsx8"}],["path",{d:"M4 19.5V15",key:"6gr39e"}],["path",{d:"M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8",key:"wywhs9"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XD=U("BookDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3 3 3-3",key:"zt5b4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QD=U("BookHeadphones",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 12v-2a4 4 0 0 1 8 0v2",key:"1vsqkj"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JD=U("BookHeart",[["path",{d:"M16 8.2A2.22 2.22 0 0 0 13.8 6c-.8 0-1.4.3-1.8.9-.4-.6-1-.9-1.8-.9A2.22 2.22 0 0 0 8 8.2c0 .6.3 1.2.7 1.6A226.652 226.652 0 0 0 12 13a404 404 0 0 0 3.3-3.1 2.413 2.413 0 0 0 .7-1.7",key:"1t75a8"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eR=U("BookImage",[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tR=U("BookKey",[["path",{d:"m19 3 1 1",key:"ze14oc"}],["path",{d:"m20 2-4.5 4.5",key:"1sppr8"}],["path",{d:"M20 8v13a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1ocbpn"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H14",key:"1gfsgw"}],["circle",{cx:"14",cy:"8",r:"2",key:"u49eql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rR=U("BookLock",[["path",{d:"M18 6V4a2 2 0 1 0-4 0v2",key:"1aquzs"}],["path",{d:"M20 15v6a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1rkj32"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H10",key:"18wgow"}],["rect",{x:"12",y:"6",width:"8",height:"5",rx:"1",key:"73l30o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nR=U("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sR=U("BookMinus",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iR=U("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aR=U("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bT=U("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oR=U("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lR=U("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cR=U("BookType",[["path",{d:"M10 13h4",key:"ytezjc"}],["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8V6H8v2",key:"x8j6u4"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dR=U("BookUp2",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"161d7n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2",key:"1lorq7"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uR=U("BookUp",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hR=U("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fR=U("BookX",[["path",{d:"m14.5 7-5 5",key:"dy991v"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9.5 7 5 5",key:"s45iea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pR=U("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mR=U("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gR=U("BookmarkMinus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xR=U("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yR=U("BookmarkX",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nm=U("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vR=U("BoomBox",[["path",{d:"M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"vvzvr1"}],["path",{d:"M8 8v1",key:"xcqmfk"}],["path",{d:"M12 8v1",key:"1rj8u4"}],["path",{d:"M16 8v1",key:"1q12zr"}],["rect",{width:"20",height:"12",x:"2",y:"9",rx:"2",key:"igpb89"}],["circle",{cx:"8",cy:"15",r:"2",key:"fa4a8s"}],["circle",{cx:"16",cy:"15",r:"2",key:"14c3ya"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _R=U("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bR=U("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VS=U("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wR=U("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jR=U("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d_=U("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kR=U("Brackets",[["path",{d:"M16 3h3v18h-3",key:"1yor1f"}],["path",{d:"M8 21H5V3h3",key:"1qrfwo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NR=U("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SR=U("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wT=U("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CR=U("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MR=U("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TR=U("BriefcaseConveyorBelt",[["path",{d:"M10 20v2",key:"1n8e1g"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M18 20v2",key:"10uadw"}],["path",{d:"M21 20H3",key:"kdqkdp"}],["path",{d:"M6 20v2",key:"a9bc87"}],["path",{d:"M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12",key:"17n9tx"}],["rect",{x:"4",y:"6",width:"16",height:"10",rx:"2",key:"1097i5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AR=U("BriefcaseMedical",[["path",{d:"M12 11v4",key:"a6ujw6"}],["path",{d:"M14 13h-4",key:"1pl8zg"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M18 6v14",key:"1mu4gy"}],["path",{d:"M6 6v14",key:"1s15cj"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hh=U("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ER=U("BringToFront",[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2",key:"yj20xf"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2",key:"1ltk23"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2",key:"1q24h9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IR=U("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PR=U("BugOff",[["path",{d:"M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2",key:"vl8zik"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M22 13h-4v-2a4 4 0 0 0-4-4h-1.3",key:"1ou0bd"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13",key:"1njkjs"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LR=U("BugPlay",[["path",{d:"M12.765 21.522a.5.5 0 0 1-.765-.424v-8.196a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"17shqo"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5",key:"1tjixy"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OR=U("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const na=U("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HS=U("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DR=U("BusFront",[["path",{d:"M4 6 2 7",key:"1mqr15"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"m22 7-2-1",key:"1umjhc"}],["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 21v-2",key:"sqyl04"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RR=U("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FR=U("CableCar",[["path",{d:"M10 3h.01",key:"lbucoy"}],["path",{d:"M14 2h.01",key:"1k8aa1"}],["path",{d:"m2 9 20-5",key:"1kz0j5"}],["path",{d:"M12 12V6.5",key:"1vbrij"}],["rect",{width:"16",height:"10",x:"4",y:"12",rx:"3",key:"if91er"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zR=U("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BR=U("CakeSlice",[["circle",{cx:"9",cy:"7",r:"2",key:"1305pl"}],["path",{d:"M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6",key:"xle13f"}],["path",{d:"M16 13H3",key:"1wpj08"}],["path",{d:"M16 17H3",key:"3lvfcd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uh=U("Cake",[["path",{d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8",key:"1w3rig"}],["path",{d:"M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1",key:"n2jgmb"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M7 8v3",key:"1qtyvj"}],["path",{d:"M12 8v3",key:"hwp4zt"}],["path",{d:"M17 8v3",key:"1i6e5u"}],["path",{d:"M7 4h.01",key:"1bh4kh"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M17 4h.01",key:"1upcoc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $R=U("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UR=U("Calendar1",[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qR=U("CalendarArrowDown",[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VR=U("CalendarArrowUp",[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HR=U("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WR=U("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GR=U("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KR=U("CalendarCog",[["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"11kmuh"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sm=U("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZR=U("CalendarFold",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 17V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11Z",key:"kg77oy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M15 22v-4a2 2 0 0 1 2-2h4",key:"1gnbqr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YR=U("CalendarHeart",[["path",{d:"M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7",key:"136lmk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21.29 14.7a2.43 2.43 0 0 0-2.65-.52c-.3.12-.57.3-.8.53l-.34.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L17.5 22l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1t7hil"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XR=U("CalendarMinus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QR=U("CalendarMinus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1scpom"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JR=U("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eF=U("CalendarPlus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}],["path",{d:"M12 14v4",key:"1thi36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gw=U("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tF=U("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rF=U("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nF=U("CalendarSync",[["path",{d:"M11 10v4h4",key:"172dkj"}],["path",{d:"m11 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"vu0qm5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m21 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"1qgeyt"}],["path",{d:"M21 22v-4h-4",key:"hrummi"}],["path",{d:"M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3",key:"mctw84"}],["path",{d:"M3 10h4",key:"1el30a"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sF=U("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iF=U("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const li=U("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aF=U("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kw=U("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oF=U("CandyCane",[["path",{d:"M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2Z",key:"isaq8g"}],["path",{d:"M17.75 7 15 2.1",key:"12x7e8"}],["path",{d:"M10.9 4.8 13 9",key:"100a87"}],["path",{d:"m7.9 9.7 2 4.4",key:"ntfhaj"}],["path",{d:"M4.9 14.7 7 18.9",key:"1x43jy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lF=U("CandyOff",[["path",{d:"m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1",key:"1ff4ui"}],["path",{d:"M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657",key:"1sbrv4"}],["path",{d:"M14 16.5V14",key:"1maf8j"}],["path",{d:"M14 6.5v1.843",key:"1a6u6t"}],["path",{d:"M10 10v7.5",key:"80pj65"}],["path",{d:"m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",key:"11a9mt"}],["path",{d:"m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",key:"3mjmon"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cF=U("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dF=U("Cannabis",[["path",{d:"M12 22v-4",key:"1utk9m"}],["path",{d:"M7 12c-1.5 0-4.5 1.5-5 3 3.5 1.5 6 1 6 1-1.5 1.5-2 3.5-2 5 2.5 0 4.5-1.5 6-3 1.5 1.5 3.5 3 6 3 0-1.5-.5-3.5-2-5 0 0 2.5.5 6-1-.5-1.5-3.5-3-5-3 1.5-1 4-4 4-6-2.5 0-5.5 1.5-7 3 0-2.5-.5-5-2-7-1.5 2-2 4.5-2 7-1.5-1.5-4.5-3-7-3 0 2 2.5 5 4 6",key:"1mezod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uF=U("CaptionsOff",[["path",{d:"M10.5 5H19a2 2 0 0 1 2 2v8.5",key:"jqtk4d"}],["path",{d:"M17 11h-.5",key:"1961ue"}],["path",{d:"M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2",key:"1keqsi"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7 11h4",key:"1o1z6v"}],["path",{d:"M7 15h2.5",key:"1ina1g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u_=U("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hF=U("CarFront",[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fF=U("CarTaxiFront",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pF=U("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mF=U("Caravan",[["path",{d:"M18 19V9a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a2 2 0 0 0 2 2h2",key:"19jm3t"}],["path",{d:"M2 9h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2",key:"13hakp"}],["path",{d:"M22 17v1a1 1 0 0 1-1 1H10v-9a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v9",key:"1crci8"}],["circle",{cx:"8",cy:"19",r:"2",key:"t8fc5s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gF=U("Carrot",[["path",{d:"M2.27 21.7s9.87-3.5 12.73-6.36a4.5 4.5 0 0 0-6.36-6.37C5.77 11.84 2.27 21.7 2.27 21.7zM8.64 14l-2.05-2.04M15.34 15l-2.46-2.46",key:"rfqxbe"}],["path",{d:"M22 9s-1.33-2-3.5-2C16.86 7 15 9 15 9s1.33 2 3.5 2S22 9 22 9z",key:"6b25w4"}],["path",{d:"M15 2s-2 1.33-2 3.5S15 9 15 9s2-1.84 2-3.5C17 3.33 15 2 15 2z",key:"fn65lo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xF=U("CaseLower",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yF=U("CaseSensitive",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["circle",{cx:"18",cy:"12",r:"3",key:"1kchzo"}],["path",{d:"M21 9v6",key:"anns31"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vF=U("CaseUpper",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["path",{d:"M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4",key:"1sqfas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _F=U("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bF=U("Cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wF=U("Castle",[["path",{d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2Z",key:"109fe4"}],["path",{d:"M18 11V4H6v7",key:"mon5oj"}],["path",{d:"M15 22v-4a3 3 0 0 0-3-3a3 3 0 0 0-3 3v4",key:"1k4jtn"}],["path",{d:"M22 11V9",key:"3zbp94"}],["path",{d:"M2 11V9",key:"1x5rnq"}],["path",{d:"M6 4V2",key:"1rsq15"}],["path",{d:"M18 4V2",key:"1jsdo1"}],["path",{d:"M10 4V2",key:"75d9ly"}],["path",{d:"M14 4V2",key:"8nj3z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jF=U("Cat",[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kF=U("Cctv",[["path",{d:"M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97",key:"ir91b5"}],["path",{d:"M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z",key:"jlp8i1"}],["path",{d:"M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15",key:"19bib8"}],["path",{d:"M2 21v-4",key:"l40lih"}],["path",{d:"M7 9h.01",key:"19b3jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h_=U("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f_=U("ChartBarBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NF=U("ChartBarDecreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h3",key:"ur6vzw"}],["path",{d:"M7 6h12",key:"sz5b0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SF=U("ChartBarIncreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h12",key:"wsnu98"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CF=U("ChartBarStacked",[["path",{d:"M11 13v4",key:"vyy2rb"}],["path",{d:"M15 5v4",key:"1gx88a"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p_=U("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m_=U("ChartCandlestick",[["path",{d:"M9 5v4",key:"14uxtq"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1",key:"f4fvz0"}],["path",{d:"M9 15v2",key:"r5rk32"}],["path",{d:"M17 3v2",key:"1l2re6"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1",key:"z38je5"}],["path",{d:"M17 13v3",key:"5l0wba"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g_=U("ChartColumnBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MF=U("ChartColumnDecreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17v-3",key:"1sqioe"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17V5",key:"1wzmnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x_=U("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TF=U("ChartColumnStacked",[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nc=U("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AF=U("ChartGantt",[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y_=U("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EF=U("ChartNetwork",[["path",{d:"m13.11 7.664 1.78 2.672",key:"go2gg9"}],["path",{d:"m14.162 12.788-3.324 1.424",key:"11x848"}],["path",{d:"m20 4-6.06 1.515",key:"1wxxh7"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["circle",{cx:"12",cy:"6",r:"2",key:"1jj5th"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}],["circle",{cx:"9",cy:"15",r:"2",key:"lf2ghp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IF=U("ChartNoAxesColumnDecreasing",[["path",{d:"M12 20V10",key:"g8npz5"}],["path",{d:"M18 20v-4",key:"8uic4z"}],["path",{d:"M6 20V4",key:"1w1bmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v_=U("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const __=U("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PF=U("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b_=U("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w_=U("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j_=U("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LF=U("ChartSpline",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OF=U("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $a=U("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DF=U("ChefHat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=U("Cherry",[["path",{d:"M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"cvxqlc"}],["path",{d:"M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"1ostrc"}],["path",{d:"M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12",key:"hqx58h"}],["path",{d:"M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z",key:"eykp1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tu=U("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FF=U("ChevronFirst",[["path",{d:"m17 18-6-6 6-6",key:"1yerx2"}],["path",{d:"M7 6v12",key:"1p53r6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zF=U("ChevronLast",[["path",{d:"m7 18 6-6-6-6",key:"lwmzdw"}],["path",{d:"M17 6v12",key:"1o0aio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const id=U("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ka=U("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=U("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BF=U("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $F=U("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UF=U("ChevronsLeftRightEllipsis",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qF=U("ChevronsLeftRight",[["path",{d:"m9 7-5 5 5 5",key:"j5w590"}],["path",{d:"m15 7 5 5-5 5",key:"1bl6da"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VF=U("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HF=U("ChevronsRightLeft",[["path",{d:"m20 17-5-5 5-5",key:"30x0n2"}],["path",{d:"m4 17 5-5-5-5",key:"16spf4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WF=U("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zw=U("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GF=U("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KF=U("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZF=U("Church",[["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v5",key:"ma6bk"}],["path",{d:"M14 22v-4a2 2 0 0 0-4 0v4",key:"1pdhuj"}],["path",{d:"M18 22V5.618a1 1 0 0 0-.553-.894l-4.553-2.277a2 2 0 0 0-1.788 0L6.553 4.724A1 1 0 0 0 6 5.618V22",key:"1rkokr"}],["path",{d:"m18 7 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.618a1 1 0 0 1 .553-.894L6 7",key:"1w6esw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YF=U("CigaretteOff",[["path",{d:"M12 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h13",key:"1gdiyg"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 12a1 1 0 0 1 1 1v2a1 1 0 0 1-.5.866",key:"166zjj"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XF=U("Cigarette",[["path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14",key:"1mb5g1"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"1yl5r7"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ul=U("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k_=U("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N_=U("CircleArrowLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S_=U("CircleArrowOutDownLeft",[["path",{d:"M2 12a10 10 0 1 1 10 10",key:"1yn6ov"}],["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"M8 22H2v-6",key:"sulq54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C_=U("CircleArrowOutDownRight",[["path",{d:"M12 22a10 10 0 1 1 10-10",key:"130bv5"}],["path",{d:"M22 22 12 12",key:"131aw7"}],["path",{d:"M22 16v6h-6",key:"1gvm70"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M_=U("CircleArrowOutUpLeft",[["path",{d:"M2 8V2h6",key:"hiwtdz"}],["path",{d:"m2 2 10 10",key:"1oh8rs"}],["path",{d:"M12 2A10 10 0 1 1 2 12",key:"rrk4fa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T_=U("CircleArrowOutUpRight",[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A_=U("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E_=U("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ba=U("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ha=U("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I_=U("CircleChevronDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P_=U("CircleChevronLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L_=U("CircleChevronRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O_=U("CircleChevronUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QF=U("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D_=U("CircleDivide",[["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JF=U("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ez=U("CircleDotDashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tz=U("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rz=U("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nz=U("CircleEqual",[["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sz=U("CircleFadingArrowUp",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iz=U("CircleFadingPlus",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R_=U("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xx=U("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F_=U("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const az=U("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z_=U("CircleParkingOff",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m5 5 14 14",key:"11anup"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.34",key:"a9qo08"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B_=U("CircleParking",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=U("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U_=U("CirclePercent",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Af=U("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q_=U("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V_=U("CirclePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H_=U("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oz=U("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W_=U("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G_=U("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K_=U("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oc=U("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Au=U("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lz=U("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cz=U("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dz=U("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jT=U("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uz=U("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hz=U("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fz=U("ClipboardMinus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pz=U("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z_=U("ClipboardPenLine",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.5",key:"1but9f"}],["path",{d:"M16 4h2a2 2 0 0 1 1.73 1",key:"1p8n7l"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y_=U("ClipboardPen",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5",key:"cereej"}],["path",{d:"M4 13.5V6a2 2 0 0 1 2-2h2",key:"5ua5vh"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mz=U("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gz=U("ClipboardType",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xz=U("ClipboardX",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m15 11-6 6",key:"1toa9n"}],["path",{d:"m9 11 6 6",key:"wlibny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yz=U("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vz=U("Clock1",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 8",key:"12zbmj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _z=U("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bz=U("Clock11",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 8",key:"l5bg6f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wz=U("Clock12",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12",key:"1fub01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jz=U("Clock2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 10",key:"1g230d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kz=U("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nz=U("Clock4",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sz=U("Clock5",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 16",key:"1pcbox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cz=U("Clock6",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 12 16.5",key:"hb2qv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mz=U("Clock7",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 16",key:"ka3394"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tz=U("Clock8",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 14",key:"tmc9b4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Az=U("Clock9",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 7.5 12",key:"1k60p0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ez=U("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iz=U("ClockArrowDown",[["path",{d:"M12.338 21.994A10 10 0 1 1 21.925 13.227",key:"1i7shu"}],["path",{d:"M12 6v6l2 1",key:"19cm8n"}],["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M18 14v8",key:"irew45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pz=U("ClockArrowUp",[["path",{d:"M13.228 21.925A10 10 0 1 1 21.994 12.338",key:"1fzlyi"}],["path",{d:"M12 6v6l1.562.781",key:"1ujuk9"}],["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M18 22v-8",key:"su0gjh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gi=U("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lz=U("CloudAlert",[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oz=U("CloudCog",[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X_=U("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dz=U("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=U("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fz=U("CloudHail",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v2",key:"a1is7l"}],["path",{d:"M8 14v2",key:"1e9m6t"}],["path",{d:"M16 20h.01",key:"xwek51"}],["path",{d:"M8 20h.01",key:"1vjney"}],["path",{d:"M12 16v2",key:"z66u1j"}],["path",{d:"M12 22h.01",key:"1urd7a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zz=U("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bz=U("CloudMoonRain",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $z=U("CloudMoon",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uz=U("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qz=U("CloudRainWind",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m9.2 22 3-7",key:"sb5f6j"}],["path",{d:"m9 13-3 7",key:"500co5"}],["path",{d:"m17 13-3 7",key:"8t2fiy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vz=U("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hz=U("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wz=U("CloudSunRain",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gz=U("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q_=U("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kz=U("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zz=U("Cloudy",[["path",{d:"M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"gqqjvc"}],["path",{d:"M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5",key:"1p2s76"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nx=U("Clover",[["path",{d:"M16.17 7.83 2 22",key:"t58vo8"}],["path",{d:"M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",key:"17k36q"}],["path",{d:"m7.83 7.83 8.34 8.34",key:"1d7sxk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yz=U("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J_=U("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yw=U("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xz=U("Codepen",[["polygon",{points:"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2",key:"srzb37"}],["line",{x1:"12",x2:"12",y1:"22",y2:"15.5",key:"1t73f2"}],["polyline",{points:"22 8.5 12 15.5 2 8.5",key:"ajlxae"}],["polyline",{points:"2 15.5 12 8.5 22 15.5",key:"susrui"}],["line",{x1:"12",x2:"12",y1:"2",y2:"8.5",key:"2cldga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qz=U("Codesandbox",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xw=U("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jz=U("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e7=U("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=U("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=U("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t7=U("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r7=U("Combine",[["path",{d:"M10 18H5a3 3 0 0 1-3-3v-1",key:"ru65g8"}],["path",{d:"M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"e30een"}],["path",{d:"M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"2ahx8o"}],["path",{d:"m7 21 3-3-3-3",key:"127cv2"}],["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n7=U("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s7=U("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i7=U("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a7=U("Computer",[["rect",{width:"14",height:"8",x:"5",y:"2",rx:"2",key:"wc9tft"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h2",key:"rwmk9e"}],["path",{d:"M12 18h6",key:"aqd8w3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o7=U("ConciergeBell",[["path",{d:"M3 20a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Z",key:"1pvr1r"}],["path",{d:"M20 16a8 8 0 1 0-16 0",key:"1pa543"}],["path",{d:"M12 4v4",key:"1bq03y"}],["path",{d:"M10 4h4",key:"1xpv9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l7=U("Cone",[["path",{d:"m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98",key:"53pte7"}],["ellipse",{cx:"12",cy:"19",rx:"9",ry:"3",key:"1ji25f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c7=U("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=U("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d7=U("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u7=U("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h7=U("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f7=U("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p7=U("CookingPot",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M20 12v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"u0tga0"}],["path",{d:"m4 8 16-4",key:"16g0ng"}],["path",{d:"m8.86 6.78-.45-1.81a2 2 0 0 1 1.45-2.43l1.94-.48a2 2 0 0 1 2.43 1.46l.45 1.8",key:"12cejc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m7=U("CopyCheck",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g7=U("CopyMinus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x7=U("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y7=U("CopySlash",[["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v7=U("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vl=U("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _7=U("Copyleft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.17 14.83a4 4 0 1 0 0-5.66",key:"1sveal"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b7=U("Copyright",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w7=U("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j7=U("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k7=U("CornerLeftDown",[["polyline",{points:"14 15 9 20 4 15",key:"nkc4i"}],["path",{d:"M20 4h-7a4 4 0 0 0-4 4v12",key:"nbpdq2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N7=U("CornerLeftUp",[["polyline",{points:"14 9 9 4 4 9",key:"m9oyvo"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S7=U("CornerRightDown",[["polyline",{points:"10 15 15 20 20 15",key:"axus6l"}],["path",{d:"M4 4h7a4 4 0 0 1 4 4v12",key:"wcbgct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C7=U("CornerRightUp",[["polyline",{points:"10 9 15 4 20 9",key:"1lr6px"}],["path",{d:"M4 20h7a4 4 0 0 0 4-4V4",key:"1plgdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M7=U("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T7=U("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A7=U("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E7=U("CreativeCommons",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M10 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1ss3eq"}],["path",{d:"M17 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1od56t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z0=U("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I7=U("Croissant",[["path",{d:"m4.6 13.11 5.79-3.21c1.89-1.05 4.79 1.78 3.71 3.71l-3.22 5.81C8.8 23.16.79 15.23 4.6 13.11Z",key:"1ozxlb"}],["path",{d:"m10.5 9.5-1-2.29C9.2 6.48 8.8 6 8 6H4.5C2.79 6 2 6.5 2 8.5a7.71 7.71 0 0 0 2 4.83",key:"ffuyb5"}],["path",{d:"M8 6c0-1.55.24-4-2-4-2 0-2.5 2.17-2.5 4",key:"osnpzi"}],["path",{d:"m14.5 13.5 2.29 1c.73.3 1.21.7 1.21 1.5v3.5c0 1.71-.5 2.5-2.5 2.5a7.71 7.71 0 0 1-4.83-2",key:"1vubaw"}],["path",{d:"M18 16c1.55 0 4-.24 4 2 0 2-2.17 2.5-4 2.5",key:"wxr772"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P7=U("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L7=U("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O7=U("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y0=U("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D7=U("Cuboid",[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R7=U("CupSoda",[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F7=U("Currency",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["line",{x1:"3",x2:"6",y1:"3",y2:"6",key:"1jkytn"}],["line",{x1:"21",x2:"18",y1:"3",y2:"6",key:"14zfjt"}],["line",{x1:"3",x2:"6",y1:"21",y2:"18",key:"iusuec"}],["line",{x1:"21",x2:"18",y1:"21",y2:"18",key:"yj2dd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z7=U("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B7=U("Dam",[["path",{d:"M11 11.31c1.17.56 1.54 1.69 3.5 1.69 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"157kva"}],["path",{d:"M11.75 18c.35.5 1.45 1 2.75 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"d7q6m6"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M7 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1L10 4a1 1 0 0 0-1-1z",key:"pr6s65"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $7=U("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U7=U("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q7=U("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V7=U("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H7=U("Dessert",[["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["path",{d:"M10.2 3.2C5.5 4 2 8.1 2 13a2 2 0 0 0 4 0v-1a2 2 0 0 1 4 0v4a2 2 0 0 0 4 0v-4a2 2 0 0 1 4 0v1a2 2 0 0 0 4 0c0-4.9-3.5-9-8.2-9.8",key:"lfo06j"}],["path",{d:"M3.2 14.8a9 9 0 0 0 17.6 0",key:"12xarc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W7=U("Diameter",[["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}],["path",{d:"M6.48 3.66a10 10 0 0 1 13.86 13.86",key:"xr8kdq"}],["path",{d:"m6.41 6.41 11.18 11.18",key:"uhpjw7"}],["path",{d:"M3.66 6.48a10 10 0 0 0 13.86 13.86",key:"cldpwv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G7=U("DiamondMinus",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=U("DiamondPercent",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0Z",key:"1tpxz2"}],["path",{d:"M9.2 9.2h.01",key:"1b7bvt"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"M14.7 14.8h.01",key:"17nsh4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K7=U("DiamondPlus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z7=U("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y7=U("Dice1",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X7=U("Dice2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q7=U("Dice3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J7=U("Dice4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eB=U("Dice5",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tB=U("Dice6",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rB=U("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nB=U("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sB=U("Disc2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iB=U("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aB=U("DiscAlbum",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"5",key:"nd82uf"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oB=U("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lB=U("Divide",[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cB=U("DnaOff",[["path",{d:"M15 2c-1.35 1.5-2.092 3-2.5 4.5L14 8",key:"1bivrr"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c3.333-3 6.667-3 10-3",key:"nxix30"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M22 9c-1.5 1.35-3 2.092-4.5 2.5l-1-1",key:"18cutr"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.35-1.5 2.092-3 2.5-4.5L10 16",key:"rlvei3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dB=U("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uB=U("Dock",[["path",{d:"M2 8h20",key:"d11cs7"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 16h12",key:"u522kt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hB=U("Dog",[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ad=U("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fB=U("Donut",[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",key:"19sr3x"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pB=U("DoorClosed",[["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M14 12v.01",key:"xfcn54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X0=U("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mB=U("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mo=U("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gB=U("DraftingCompass",[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xB=U("Drama",[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yB=U("Dribbble",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M19.13 5.09C15.22 9.14 10 10.44 2.25 10.94",key:"hpej1"}],["path",{d:"M21.75 12.84c-6.62-1.41-12.14 1-16.38 6.32",key:"1tr44o"}],["path",{d:"M8.56 2.75c4.37 6 6 9.42 8 17.72",key:"kbh691"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vB=U("Drill",[["path",{d:"M10 18a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a3 3 0 0 1-3-3 1 1 0 0 1 1-1z",key:"ioqxb1"}],["path",{d:"M13 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1l-.81 3.242a1 1 0 0 1-.97.758H8",key:"1rs59n"}],["path",{d:"M14 4h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-3",key:"105ega"}],["path",{d:"M18 6h4",key:"66u95g"}],["path",{d:"m5 10-2 8",key:"xt2lic"}],["path",{d:"m7 18 2-8",key:"1bzku2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _B=U("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bB=U("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wB=U("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jB=U("Drumstick",[["path",{d:"M15.4 15.63a7.875 6 135 1 1 6.23-6.23 4.5 3.43 135 0 0-6.23 6.23",key:"1dtqwm"}],["path",{d:"m8.29 12.71-2.6 2.6a2.5 2.5 0 1 0-1.65 4.65A2.5 2.5 0 1 0 8.7 18.3l2.59-2.59",key:"1oq1fw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kB=U("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NB=U("EarOff",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SB=U("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CB=U("EarthLock",[["path",{d:"M7 3.34V5a3 3 0 0 0 3 3",key:"w732o8"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"f02343"}],["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M12 2a10 10 0 1 0 9.54 13",key:"zjsr6q"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=U("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MB=U("Eclipse",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a7 7 0 1 0 10 10",key:"1yuj32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TB=U("EggFried",[["circle",{cx:"11.5",cy:"12.5",r:"3.5",key:"1cl1mi"}],["path",{d:"M3 8c0-3.5 2.5-6 6.5-6 5 0 4.83 3 7.5 5s5 2 5 6c0 4.5-2.5 6.5-7 6.5-2.5 0-2.5 2.5-6 2.5s-7-2-7-5.5c0-3 1.5-3 1.5-5C3.5 10 3 9 3 8Z",key:"165ef9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AB=U("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WS=U("Egg",[["path",{d:"M12 22c6.23-.05 7.87-5.57 7.5-10-.36-4.34-3.95-9.96-7.5-10-3.55.04-7.14 5.66-7.5 10-.37 4.43 1.27 9.95 7.5 10z",key:"1c39pg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yx=U("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jm=U("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EB=U("EqualApproximately",[["path",{d:"M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"yrdkhy"}],["path",{d:"M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"gzkvyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IB=U("EqualNot",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PB=U("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LB=U("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OB=U("EthernetPort",[["path",{d:"m15 20 3-3h2a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2l3 3z",key:"rbahqx"}],["path",{d:"M6 8v1",key:"1636ez"}],["path",{d:"M10 8v1",key:"1talb4"}],["path",{d:"M14 8v1",key:"1rsfgr"}],["path",{d:"M18 8v1",key:"gnkwox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DB=U("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RB=U("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $s=U("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FB=U("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qw=U("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Al=U("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Td=U("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zB=U("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BB=U("Fan",[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $B=U("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UB=U("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qB=U("Fence",[["path",{d:"M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"1n2rgs"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M6 18h4",key:"12yh4b"}],["path",{d:"m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"3ha7mj"}],["path",{d:"M14 8h4",key:"1r8wg2"}],["path",{d:"M14 18h4",key:"1t3kbu"}],["path",{d:"m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"dfd4e2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VB=U("FerrisWheel",[["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m6.8 15-3.5 2",key:"hjy98k"}],["path",{d:"m20.7 7-3.5 2",key:"f08gto"}],["path",{d:"M6.8 9 3.3 7",key:"1aevh4"}],["path",{d:"m20.7 17-3.5-2",key:"1liqo3"}],["path",{d:"m9 22 3-8 3 8",key:"wees03"}],["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M18 18.7a9 9 0 1 0-12 0",key:"dhzg4g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HB=U("Figma",[["path",{d:"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z",key:"1340ok"}],["path",{d:"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z",key:"1hz3m3"}],["path",{d:"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z",key:"1oz8n2"}],["path",{d:"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z",key:"1ff65i"}],["path",{d:"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z",key:"pdip6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WB=U("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GB=U("FileAudio2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KB=U("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=U("FileAxis3d",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 18 4-4",key:"12zab0"}],["path",{d:"M8 10v8h8",key:"tlaukw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZB=U("FileBadge2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14 12.5 1 5.5-3-1-3 1 1-5.5",key:"14xlky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YB=U("FileBadge",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"12ixgl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"u0c8gj"}],["path",{d:"M7 16.5 8 22l-3-1-3 1 1-5.5",key:"5gm2nr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XB=U("FileBox",[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=U("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=U("FileChartColumn",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-1",key:"zg0ygc"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"M16 18v-3",key:"j5jt4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=U("FileChartLine",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=U("FileChartPie",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5",key:"13ddob"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QB=U("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JB=U("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=U("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t9=U("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r9=U("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=U("FileCog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=U("FileDiff",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=U("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=U("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=U("FileHeart",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.29 10.7a2.43 2.43 0 0 0-2.66-.52c-.29.12-.56.3-.78.53l-.35.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L6.5 18l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1c1fso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q0=U("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=U("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=U("FileJson2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=U("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=U("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u9=U("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=U("FileLock2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=U("FileLock",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["rect",{width:"8",height:"6",x:"8",y:"12",rx:"1",key:"3yr8at"}],["path",{d:"M10 12v-2a2 2 0 1 1 4 0v2",key:"j4i8d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=U("FileMinus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=U("FileMinus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=U("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=U("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=U("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=U("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=U("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=U("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=U("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=U("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=U("FileSearch2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=U("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k9=U("FileSliders",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M10 11v2",key:"1s651w"}],["path",{d:"M8 17h8",key:"wh5c61"}],["path",{d:"M14 16v2",key:"12fp5e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J0=U("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N9=U("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S9=U("FileSymlink",[["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"50q2rw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C9=U("FileTerminal",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Si=U("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M9=U("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=U("FileType",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A9=U("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=U("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I9=U("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=U("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L9=U("FileVolume2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M11.5 13.5a2.5 2.5 0 0 1 0 3",key:"1fccat"}],["path",{d:"M15 12a5 5 0 0 1 0 6",key:"ps46cm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=U("FileVolume",[["path",{d:"M11 11a5 5 0 0 1 0 6",key:"193qb2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 6.765V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-.93-.23",key:"ifyjnl"}],["path",{d:"M7 10.51a.5.5 0 0 0-.826-.38l-1.893 1.628A1 1 0 0 1 3.63 12H2.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h1.129a1 1 0 0 1 .652.242l1.893 1.63a.5.5 0 0 0 .826-.38z",key:"mk8rxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D9=U("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R9=U("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F9=U("FileX",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z9=U("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B9=U("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kd=U("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $9=U("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jw=U("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=U("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q9=U("FireExtinguisher",[["path",{d:"M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5",key:"sqyvz"}],["path",{d:"M9 18h8",key:"i7pszb"}],["path",{d:"M18 3h-3",key:"7idoqj"}],["path",{d:"M11 3a6 6 0 0 0-6 6v11",key:"1v5je3"}],["path",{d:"M5 13h4",key:"svpcxo"}],["path",{d:"M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z",key:"vsjego"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V9=U("FishOff",[["path",{d:"M18 12.47v.03m0-.5v.47m-.475 5.056A6.744 6.744 0 0 1 15 18c-3.56 0-7.56-2.53-8.5-6 .348-1.28 1.114-2.433 2.121-3.38m3.444-2.088A8.802 8.802 0 0 1 15 6c3.56 0 6.06 2.54 7 6-.309 1.14-.786 2.177-1.413 3.058",key:"1j1hse"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33m7.48-4.372A9.77 9.77 0 0 1 16 6.07m0 11.86a9.77 9.77 0 0 1-1.728-3.618",key:"1q46z8"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98M8.53 3h5.27a2 2 0 0 1 1.98 1.67l.23 1.4M2 2l20 20",key:"1407gh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H9=U("FishSymbol",[["path",{d:"M2 16s9-15 20-4C11 23 2 8 2 8",key:"h4oh4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W9=U("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=U("FlagOff",[["path",{d:"M8 2c3 0 5 2 8 2s4-1 4-1v11",key:"9rwyz9"}],["path",{d:"M4 22V4",key:"1plyxx"}],["path",{d:"M4 15s1-1 4-1 5 2 8 2",key:"1myooe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K9=U("FlagTriangleLeft",[["path",{d:"M17 22V2L7 7l10 5",key:"1rmf0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z9=U("FlagTriangleRight",[["path",{d:"M7 22V2l10 5-10 5",key:"17n18y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Px=U("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y9=U("FlameKindling",[["path",{d:"M12 2c1 3 2.5 3.5 3.5 4.5A5 5 0 0 1 17 10a5 5 0 1 1-10 0c0-.3 0-.6.1-.9a2 2 0 1 0 3.3-2C8 4.5 11 2 12 2Z",key:"1ir223"}],["path",{d:"m5 22 14-4",key:"1brv4h"}],["path",{d:"m5 18 14 4",key:"lgyyje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qh=U("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X9=U("FlashlightOff",[["path",{d:"M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4",key:"1r120k"}],["path",{d:"M7 2h11v4c0 2-2 2-2 4v1",key:"dz1920"}],["line",{x1:"11",x2:"18",y1:"6",y2:"6",key:"bi1vpe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q9=U("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J9=U("FlaskConicalOff",[["path",{d:"M10 10 4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-1.272-2.542",key:"59ek9y"}],["path",{d:"M10 2v2.343",key:"15t272"}],["path",{d:"M14 2v6.343",key:"sxr80q"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h9",key:"t5njau"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ej=U("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e$=U("FlaskRound",[["path",{d:"M10 2v7.31",key:"5d1hyh"}],["path",{d:"M14 9.3V1.99",key:"14k4l0"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14 9.3a6.5 6.5 0 1 1-4 0",key:"1r8fvy"}],["path",{d:"M5.52 16h12.96",key:"46hh1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t$=U("FlipHorizontal2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r$=U("FlipHorizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n$=U("FlipVertical2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s$=U("FlipVertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qp=U("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i$=U("Flower",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a$=U("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o$=U("FoldHorizontal",[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l$=U("FoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c$=U("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d$=U("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u$=U("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h$=U("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f$=U("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=U("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p$=U("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m$=U("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g$=U("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x$=U("FolderGit",[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y$=U("FolderHeart",[["path",{d:"M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",key:"6hud8k"}],["path",{d:"M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",key:"wpff58"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v$=U("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _$=U("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b$=U("FolderKey",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w$=U("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j$=U("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k$=U("FolderOpenDot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lx=U("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N$=U("FolderOutput",[["path",{d:"M2 7.5V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-1.5",key:"1yk7aj"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m5 10-3 3 3 3",key:"1r8ie0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=U("FolderPen",[["path",{d:"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5",key:"a8xqs0"}],["path",{d:"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1saktj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S$=U("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C$=U("FolderRoot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M12 15v5",key:"11xva1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M$=U("FolderSearch2",[["circle",{cx:"11.5",cy:"12.5",r:"2.5",key:"1ea5ju"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M13.3 14.3 15 16",key:"1y4v1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T$=U("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A$=U("FolderSymlink",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"x1c07l"}],["path",{d:"m8 16 3-3-3-3",key:"rlqrt1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E$=U("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I$=U("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P$=U("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L$=U("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O$=U("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D$=U("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R$=U("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F$=U("Forklift",[["path",{d:"M12 12H5a2 2 0 0 0-2 2v5",key:"7zsz91"}],["circle",{cx:"13",cy:"19",r:"2",key:"wjnkru"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M8 19h3m5-17v17h6M6 12V7c0-1.1.9-2 2-2h3l5 5",key:"13bk1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z$=U("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=U("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $$=U("Framer",[["path",{d:"M5 16V9h14V2H5l14 14h-7m-7 0 7 7v-7m-7 0h7",key:"1a2nng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U$=U("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q$=U("Fuel",[["line",{x1:"3",x2:"15",y1:"22",y2:"22",key:"xegly4"}],["line",{x1:"4",x2:"14",y1:"9",y2:"9",key:"xcnuvu"}],["path",{d:"M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18",key:"16j0yd"}],["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5",key:"7cu91f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V$=U("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H$=U("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W$=U("GalleryHorizontal",[["path",{d:"M2 3v18",key:"pzttux"}],["rect",{width:"12",height:"18",x:"6",y:"3",rx:"2",key:"btr8bg"}],["path",{d:"M22 3v18",key:"6jf3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G$=U("GalleryThumbnails",[["rect",{width:"18",height:"14",x:"3",y:"3",rx:"2",key:"74y24f"}],["path",{d:"M4 21h1",key:"16zlid"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M19 21h1",key:"edywat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K$=U("GalleryVerticalEnd",[["path",{d:"M7 2h10",key:"nczekb"}],["path",{d:"M5 6h14",key:"u2x4p"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z$=U("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y$=U("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X$=U("Gamepad",[["line",{x1:"6",x2:"10",y1:"12",y2:"12",key:"161bw2"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"15",x2:"15.01",y1:"13",y2:"13",key:"dqpgro"}],["line",{x1:"18",x2:"18.01",y1:"11",y2:"11",key:"meh2c"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q$=U("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=U("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eU=U("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tj=U("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ua=U("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tU=U("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rU=U("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=U("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nU=U("GitCommitVertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sU=U("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iU=U("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aU=U("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oU=U("GitGraph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lU=U("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cU=U("GitPullRequestArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dU=U("GitPullRequestClosed",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uU=U("GitPullRequestCreateArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v3",key:"1rbwk6"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M22 18h-6",key:"1d5gi5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hU=U("GitPullRequestCreate",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fU=U("GitPullRequestDraft",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pU=U("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mU=U("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gU=U("Gitlab",[["path",{d:"m22 13.29-3.33-10a.42.42 0 0 0-.14-.18.38.38 0 0 0-.22-.11.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18l-2.26 6.67H8.32L6.1 3.26a.42.42 0 0 0-.1-.18.38.38 0 0 0-.26-.08.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18L2 13.29a.74.74 0 0 0 .27.83L12 21l9.69-6.88a.71.71 0 0 0 .31-.83Z",key:"148pdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xU=U("GlassWater",[["path",{d:"M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",key:"p55z4y"}],["path",{d:"M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0",key:"mjntcy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yU=U("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vU=U("GlobeLock",[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rj=U("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _U=U("Goal",[["path",{d:"M12 13V2l8 4-8 4",key:"5wlwwj"}],["path",{d:"M20.561 10.222a9 9 0 1 1-12.55-5.29",key:"1c0wjv"}],["path",{d:"M8.002 9.997a5 5 0 1 0 8.9 2.02",key:"gb1g7m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bU=U("Grab",[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e1=U("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wU=U("Grape",[["path",{d:"M22 5V2l-5.89 5.89",key:"1eenpo"}],["circle",{cx:"16.6",cy:"15.89",r:"3",key:"xjtalx"}],["circle",{cx:"8.11",cy:"7.4",r:"3",key:"u2fv6i"}],["circle",{cx:"12.35",cy:"11.65",r:"3",key:"i6i8g7"}],["circle",{cx:"13.91",cy:"5.85",r:"3",key:"6ye0dv"}],["circle",{cx:"18.15",cy:"10.09",r:"3",key:"snx9no"}],["circle",{cx:"6.56",cy:"13.2",r:"3",key:"17x4xg"}],["circle",{cx:"10.8",cy:"17.44",r:"3",key:"1hogw9"}],["circle",{cx:"5",cy:"19",r:"3",key:"1sn6vo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jU=U("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=U("Grid2x2Plus",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 22v-6",key:"qhmiwi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kU=U("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=U("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ah=U("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NU=U("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GS=U("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SU=U("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CU=U("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MU=U("Guitar",[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TU=U("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AU=U("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EU=U("HandCoins",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IU=U("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=U("HandHelping",[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PU=U("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LU=U("HandPlatter",[["path",{d:"M12 3V2",key:"ar7q03"}],["path",{d:"m15.4 17.4 3.2-2.8a2 2 0 1 1 2.8 2.9l-3.6 3.3c-.7.8-1.7 1.2-2.8 1.2h-4c-1.1 0-2.1-.4-2.8-1.2l-1.302-1.464A1 1 0 0 0 6.151 19H5",key:"n2g93r"}],["path",{d:"M2 14h12a2 2 0 0 1 0 4h-2",key:"1o2jem"}],["path",{d:"M4 10h16",key:"img6z1"}],["path",{d:"M5 10a7 7 0 0 1 14 0",key:"1ega1o"}],["path",{d:"M5 14v6a1 1 0 0 1-1 1H2",key:"1hescx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OU=U("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DU=U("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=U("HardDriveDownload",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FU=U("HardDriveUpload",[["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M12 2v8",key:"1q4o3n"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kT=U("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zU=U("HardHat",[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KS=U("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BU=U("Haze",[["path",{d:"m5.2 6.2 1.4 1.4",key:"17imol"}],["path",{d:"M2 13h2",key:"13gyu8"}],["path",{d:"M20 13h2",key:"16rner"}],["path",{d:"m17.4 7.6 1.4-1.4",key:"t4xlah"}],["path",{d:"M22 17H2",key:"1gtaj3"}],["path",{d:"M22 21H2",key:"1gy6en"}],["path",{d:"M16 13a4 4 0 0 0-8 0",key:"1dyczq"}],["path",{d:"M12 5V2.5",key:"1vytko"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=U("HdmiPort",[["path",{d:"M22 9a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h1l2 2h12l2-2h1a1 1 0 0 0 1-1Z",key:"2128wb"}],["path",{d:"M7.5 12h9",key:"1t0ckc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NT=U("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ST=U("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UU=U("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qU=U("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VU=U("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HU=U("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WU=U("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GU=U("HeadphoneOff",[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KU=U("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZU=U("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YU=U("HeartCrack",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"m12 13-1-1 2-2-3-3 2-2",key:"xjdxli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XU=U("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QU=U("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JU=U("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oa=U("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=U("Heater",[["path",{d:"M11 8c2-3-2-3 0-6",key:"1ldv5m"}],["path",{d:"M15.5 8c2-3-2-3 0-6",key:"1otqoz"}],["path",{d:"M6 10h.01",key:"1lbq93"}],["path",{d:"M6 14h.01",key:"zudwn7"}],["path",{d:"M10 16v-4",key:"1c25yv"}],["path",{d:"M14 16v-4",key:"1dkbt8"}],["path",{d:"M18 16v-4",key:"1yg9me"}],["path",{d:"M20 6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3",key:"1ubg90"}],["path",{d:"M5 20v2",key:"1abpe8"}],["path",{d:"M19 20v2",key:"kqn6ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=U("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=U("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZS=U("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=U("HopOff",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.28.01.53-.09.7-.27",key:"qyzcap"}],["path",{d:"M11.14 20.57c.52.24 2.44 1.12 4.08 1.37.46.06.86-.25.9-.71.12-1.52-.3-3.43-.5-4.28",key:"y078lb"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .7-.26",key:"1utre3"}],["path",{d:"M17.99 5.52a20.83 20.83 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-1.17.1-2.5.02-3.9-.25",key:"17o9hm"}],["path",{d:"M20.57 11.14c.24.52 1.12 2.44 1.37 4.08.04.3-.08.59-.31.75",key:"1d1n4p"}],["path",{d:"M4.93 4.93a10 10 0 0 0-.67 13.4c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.85.85 0 0 0 .48-.24",key:"9uv3tt"}],["path",{d:"M5.52 17.99c1.05.95 2.91 2.42 4.5 3.15a.8.8 0 0 0 1.13-.68c.2-2.34-.33-5.3-1.57-8.28",key:"1292wz"}],["path",{d:"M8.35 2.68a10 10 0 0 1 9.98 1.58c.43.35.4.96-.12 1.17-1.5.6-4.3.98-6.07 1.05",key:"7ozu9p"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sq=U("Hop",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18",key:"18lxf1"}],["path",{d:"M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88",key:"vtfxrw"}],["path",{d:"M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36",key:"13hl71"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87",key:"1sl8oj"}],["path",{d:"M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08",key:"19c6kt"}],["path",{d:"M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57",key:"85ghs3"}],["path",{d:"M4.93 4.93 3 3a.7.7 0 0 1 0-1",key:"x087yj"}],["path",{d:"M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15",key:"11xdqo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=U("Hospital",[["path",{d:"M12 6v4",key:"16clxf"}],["path",{d:"M14 14h-4",key:"esezmu"}],["path",{d:"M14 18h-4",key:"16mqa2"}],["path",{d:"M14 8h-4",key:"z8ypaz"}],["path",{d:"M18 12h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h2",key:"b1k337"}],["path",{d:"M18 22V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v18",key:"16g51d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=U("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=U("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lq=U("HousePlug",[["path",{d:"M10 12V8.964",key:"1vll13"}],["path",{d:"M14 12V8.964",key:"1x3qvg"}],["path",{d:"M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z",key:"ppykja"}],["path",{d:"M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-2",key:"1gvg2z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cq=U("HousePlus",[["path",{d:"M13.22 2.416a2 2 0 0 0-2.511.057l-7 5.999A2 2 0 0 0 3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7.354",key:"5phn05"}],["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 3v6",key:"x1uolp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ui=U("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=U("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=U("IceCreamCone",[["path",{d:"m7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11",key:"1v6356"}],["path",{d:"M17 7A5 5 0 0 0 7 7",key:"151p3v"}],["path",{d:"M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4",key:"1sdaij"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dq=U("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uq=U("ImageDown",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hq=U("ImageMinus",[["path",{d:"M21 9v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"m87ecr"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fq=U("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pq=U("ImagePlay",[["path",{d:"m11 16-5 5",key:"j5f7ct"}],["path",{d:"M11 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6.5",key:"7s81lt"}],["path",{d:"M15.765 22a.5.5 0 0 1-.765-.424V13.38a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"1omb6s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YS=U("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mq=U("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gq=U("ImageUpscale",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M17 21h2a2 2 0 0 0 2-2",key:"130fy9"}],["path",{d:"M21 12v3",key:"1wzk3p"}],["path",{d:"m21 3-5 5",key:"1g5oa7"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2",key:"kk3yz1"}],["path",{d:"m5 21 4.144-4.144a1.21 1.21 0 0 1 1.712 0L13 19",key:"fyekpt"}],["path",{d:"M9 3h3",key:"d52fa"}],["rect",{x:"3",y:"11",width:"10",height:"10",rx:"1",key:"1wpmix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wo=U("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xq=U("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yq=U("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vq=U("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=U("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=U("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _q=U("IndianRupee",[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bq=U("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wq=U("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jq=U("InspectionPanel",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h.01",key:"7u93v4"}],["path",{d:"M17 7h.01",key:"14a9sn"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zd=U("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XS=U("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kq=U("IterationCcw",[["path",{d:"M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8",key:"4znkd0"}],["polyline",{points:"16 14 20 18 16 22",key:"11njsm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nq=U("IterationCw",[["path",{d:"M4 10c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8H4",key:"tuf4su"}],["polyline",{points:"8 22 4 18 8 14",key:"evkj9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sq=U("JapaneseYen",[["path",{d:"M12 9.5V21m0-11.5L6 3m6 6.5L18 3",key:"2ej80x"}],["path",{d:"M6 15h12",key:"1hwgt5"}],["path",{d:"M6 11h12",key:"wf4gp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cq=U("Joystick",[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t1=U("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nj=U("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=U("KeySquare",[["path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",key:"165ttr"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814",key:"1ubxi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vh=U("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tq=U("KeyboardMusic",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M6 12v4",key:"dy92yo"}],["path",{d:"M10 12v4",key:"1fxnav"}],["path",{d:"M14 12v4",key:"1hft58"}],["path",{d:"M18 12v4",key:"tjjnbz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aq=U("KeyboardOff",[["path",{d:"M 20 4 A2 2 0 0 1 22 6",key:"1g1fkt"}],["path",{d:"M 22 6 L 22 16.41",key:"1qjg3w"}],["path",{d:"M 7 16 L 16 16",key:"n0yqwb"}],["path",{d:"M 9.69 4 L 20 4",key:"kbpcgx"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2",key:"s23sx2"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M8 12h.01",key:"czm47f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eq=U("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iq=U("LampCeiling",[["path",{d:"M12 2v5",key:"nd4vlx"}],["path",{d:"M6 7h12l4 9H2l4-9Z",key:"123d64"}],["path",{d:"M9.17 16a3 3 0 1 0 5.66 0",key:"1061mw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pq=U("LampDesk",[["path",{d:"m14 5-3 3 2 7 8-8-7-2Z",key:"1b0msb"}],["path",{d:"m14 5-3 3-3-3 3-3 3 3Z",key:"1uemms"}],["path",{d:"M9.5 6.5 4 12l3 6",key:"1bx08v"}],["path",{d:"M3 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H3Z",key:"wap775"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lq=U("LampFloor",[["path",{d:"M9 2h6l3 7H6l3-7Z",key:"wcx6mj"}],["path",{d:"M12 9v13",key:"3n1su1"}],["path",{d:"M9 22h6",key:"1rlq3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=U("LampWallDown",[["path",{d:"M11 13h6l3 7H8l3-7Z",key:"9n3qlo"}],["path",{d:"M14 13V8a2 2 0 0 0-2-2H8",key:"1hu4hb"}],["path",{d:"M4 9h2a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H4v6Z",key:"s053bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dq=U("LampWallUp",[["path",{d:"M11 4h6l3 7H8l3-7Z",key:"11x1ee"}],["path",{d:"M14 11v5a2 2 0 0 1-2 2H8",key:"eutp5o"}],["path",{d:"M4 15h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H4v-6Z",key:"1iuthr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=U("Lamp",[["path",{d:"M8 2h8l4 10H4L8 2Z",key:"9dma5w"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M8 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H8Z",key:"mwf4oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=U("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zq=U("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=U("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=U("LaptopMinimalCheck",[["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{x:"3",y:"4",width:"18",height:"12",rx:"2",key:"8ur36m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=U("LaptopMinimal",[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uq=U("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qq=U("LassoSelect",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M7 16.93c.96.43 1.96.74 2.99.91",key:"ybbtv3"}],["path",{d:"M3.34 14A6.8 6.8 0 0 1 2 10c0-4.42 4.48-8 10-8s10 3.58 10 8a7.19 7.19 0 0 1-.33 2",key:"gt5e1w"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}],["path",{d:"M14.33 22h-.09a.35.35 0 0 1-.24-.32v-10a.34.34 0 0 1 .33-.34c.08 0 .15.03.21.08l7.34 6a.33.33 0 0 1-.21.59h-4.49l-2.57 3.85a.35.35 0 0 1-.28.14z",key:"72q637"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vq=U("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hq=U("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wq=U("Layers2",[["path",{d:"m16.02 12 5.48 3.13a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74L7.98 12",key:"1cuww1"}],["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74Z",key:"pdlvxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gq=U("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kq=U("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QS=U("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const im=U("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zq=U("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yq=U("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=U("LayoutPanelTop",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qq=U("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jq=U("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eV=U("LeafyGreen",[["path",{d:"M2 22c1.25-.987 2.27-1.975 3.9-2.2a5.56 5.56 0 0 1 3.8 1.5 4 4 0 0 0 6.187-2.353 3.5 3.5 0 0 0 3.69-5.116A3.5 3.5 0 0 0 20.95 8 3.5 3.5 0 1 0 16 3.05a3.5 3.5 0 0 0-5.831 1.373 3.5 3.5 0 0 0-5.116 3.69 4 4 0 0 0-2.348 6.155C3.499 15.42 4.409 16.712 4.2 18.1 3.926 19.743 3.014 20.732 2 22",key:"1134nt"}],["path",{d:"M2 22 17 7",key:"1q7jp2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tV=U("Lectern",[["path",{d:"M16 12h3a2 2 0 0 0 1.902-1.38l1.056-3.333A1 1 0 0 0 21 6H3a1 1 0 0 0-.958 1.287l1.056 3.334A2 2 0 0 0 5 12h3",key:"13jjxg"}],["path",{d:"M18 6V3a1 1 0 0 0-1-1h-3",key:"1550fe"}],["rect",{width:"8",height:"12",x:"8",y:"10",rx:"1",key:"qmu8b6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rV=U("LetterText",[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nV=U("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JS=U("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e4=U("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sV=U("Ligature",[["path",{d:"M8 20V8c0-2.2 1.8-4 4-4 1.5 0 2.8.8 3.5 2",key:"1rtphz"}],["path",{d:"M6 12h4",key:"a4o3ry"}],["path",{d:"M14 12h2v8",key:"c1fccl"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 20h4",key:"lzx1xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iV=U("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r1=U("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aV=U("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bf=U("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bo=U("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const am=U("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oV=U("ListCheck",[["path",{d:"M11 18H3",key:"n3j2dh"}],["path",{d:"m15 18 2 2 4-4",key:"1szwhi"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lV=U("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cV=U("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dV=U("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uV=U("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hV=U("ListMinus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fV=U("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t4=U("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pV=U("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mV=U("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gV=U("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xV=U("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yV=U("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vV=U("ListVideo",[["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}],["path",{d:"m16 12 5 3-5 3v-6Z",key:"zpskkp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _V=U("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $f=U("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sn=U("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bV=U("LoaderPinwheel",[["path",{d:"M22 12a1 1 0 0 1-10 0 1 1 0 0 0-10 0",key:"1lzz15"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wV=U("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jV=U("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kV=U("LocateOff",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["path",{d:"M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",key:"1oh7ia"}],["path",{d:"M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",key:"3qdecy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CT=U("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=U("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NV=U("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=U("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uf=U("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r4=U("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n4=U("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SV=U("Logs",[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CV=U("Lollipop",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0",key:"107gwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MV=U("Luggage",[["path",{d:"M6 20a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1m57jg"}],["path",{d:"M8 18V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v14",key:"1l99gc"}],["path",{d:"M10 20h4",key:"ni2waw"}],["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=U("Magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AV=U("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EV=U("MailMinus",[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IV=U("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PV=U("MailPlus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LV=U("MailQuestion",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=U("MailSearch",[["path",{d:"M22 12.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h7.5",key:"w80f2v"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"8lzu5m"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.5-1.5",key:"1x83k4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DV=U("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=U("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oi=U("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RV=U("Mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FV=U("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zV=U("MapPinCheckInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BV=U("MapPinCheck",[["path",{d:"M19.43 12.935c.357-.967.57-1.955.57-2.935a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32.197 32.197 0 0 0 .813-.728",key:"1dq61d"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m16 18 2 2 4-4",key:"1mkfmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $V=U("MapPinHouse",[["path",{d:"M15 22a1 1 0 0 1-1-1v-4a1 1 0 0 1 .445-.832l3-2a1 1 0 0 1 1.11 0l3 2A1 1 0 0 1 22 17v4a1 1 0 0 1-1 1z",key:"1p1rcz"}],["path",{d:"M18 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 .601.2",key:"mcbcs9"}],["path",{d:"M18 22v-3",key:"1t1ugv"}],["circle",{cx:"10",cy:"10",r:"3",key:"1ns7v1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UV=U("MapPinMinusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qV=U("MapPinMinus",[["path",{d:"M18.977 14C19.6 12.701 20 11.343 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"11uxia"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VV=U("MapPinOff",[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16",key:"1d4wjd"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",key:"12yil7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",key:"lhrkcz"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74",key:"13wojd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HV=U("MapPinPlusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WV=U("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GV=U("MapPinXInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KV=U("MapPinX",[["path",{d:"M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",key:"y0ewhp"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m21.5 15.5-5 5",key:"11iqnx"}],["path",{d:"m21.5 20.5-5-5",key:"1bylgx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cl=U("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZV=U("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YV=U("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=U("Martini",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M12 11v11",key:"ur9y6a"}],["path",{d:"m19 3-7 8-7-8Z",key:"1sgpiw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QV=U("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n1=U("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ox=U("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JV=U("MegaphoneOff",[["path",{d:"M9.26 9.26 3 11v3l14.14 3.14",key:"3429n"}],["path",{d:"M21 15.34V6l-7.31 2.03",key:"4o1dh8"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const om=U("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eH=U("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tH=U("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=U("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rH=U("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nH=U("MessageCircleCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",key:"k85zhp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sH=U("MessageCircleDashed",[["path",{d:"M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1",key:"16ll65"}],["path",{d:"M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1",key:"1nq77a"}],["path",{d:"M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5",key:"1sf7wn"}],["path",{d:"M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1",key:"x1hs5g"}],["path",{d:"M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1",key:"19m18z"}],["path",{d:"M3.5 17.5 2 22l4.5-1.5",key:"1f36qi"}],["path",{d:"M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5",key:"1vz3ju"}],["path",{d:"M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1",key:"19f9do"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s4=U("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iH=U("MessageCircleMore",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aH=U("MessageCircleOff",[["path",{d:"M20.5 14.9A9 9 0 0 0 9.1 3.5",key:"1iebmn"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7",key:"1ov8ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oH=U("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=U("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lH=U("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cH=U("MessageCircleWarning",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dH=U("MessageCircleX",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wl=U("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uH=U("MessageSquareCode",[["path",{d:"M10 7.5 8 10l2 2.5",key:"xb17xw"}],["path",{d:"m14 7.5 2 2.5-2 2.5",key:"5rap1v"}],["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hH=U("MessageSquareDashed",[["path",{d:"M10 17H7l-4 4v-7",key:"1r71xu"}],["path",{d:"M14 17h1",key:"nufu4t"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1a2 2 0 0 1-2 2",key:"29akq3"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fH=U("MessageSquareDiff",[["path",{d:"m5 19-2 2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1xuzuj"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=U("MessageSquareDot",[["path",{d:"M11.7 3H5a2 2 0 0 0-2 2v16l4-4h12a2 2 0 0 0 2-2v-2.7",key:"uodpkb"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mH=U("MessageSquareHeart",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M14.8 7.5a1.84 1.84 0 0 0-2.6 0l-.2.3-.3-.3a1.84 1.84 0 1 0-2.4 2.8L12 13l2.7-2.7c.9-.9.8-2.1.1-2.8",key:"1blaws"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=U("MessageSquareLock",[["path",{d:"M19 15v-2a2 2 0 1 0-4 0v2",key:"h3d1vz"}],["path",{d:"M9 17H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3.5",key:"xsnnhn"}],["rect",{x:"13",y:"15",width:"8",height:"5",rx:"1",key:"1ccwuk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=U("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=U("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=U("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=U("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=U("MessageSquareReply",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=U("MessageSquareShare",[["path",{d:"M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7",key:"tqtdkg"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m16 8 5-5",key:"15mbrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=U("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=U("MessageSquareWarning",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NH=U("MessageSquareX",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vl=U("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=U("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=U("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=U("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=U("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=U("Microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=U("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=U("Microwave",[["rect",{width:"20",height:"15",x:"2",y:"4",rx:"2",key:"2no95f"}],["rect",{width:"8",height:"7",x:"6",y:"8",rx:"1",key:"zh9wx"}],["path",{d:"M18 8v7",key:"o5zi4n"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 19v2",key:"1dawf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EH=U("Milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=U("MilkOff",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v1.343M15 2v2.789a4 4 0 0 0 .672 2.219l.656.984a4 4 0 0 1 .672 2.22v1.131M7.8 7.8l-.128.192A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3",key:"y0ejgx"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.472 6.472 0 0 0 3.435.435",key:"iaxqsy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=U("Milk",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=U("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=U("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s1=U("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=U("MonitorCheck",[["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RH=U("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=U("MonitorDot",[["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9",key:"1fet9y"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=U("MonitorDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"m15 10-3 3-3-3",key:"lzhmyn"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=U("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $H=U("MonitorPause",[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=U("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=U("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=U("MonitorSpeaker",[["path",{d:"M5.5 20H8",key:"1k40s5"}],["path",{d:"M17 9h.01",key:"1j24nn"}],["rect",{width:"10",height:"16",x:"12",y:"4",rx:"2",key:"ixliua"}],["path",{d:"M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4",key:"1mp6e1"}],["circle",{cx:"17",cy:"15",r:"1",key:"tqvash"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=U("MonitorStop",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}],["rect",{x:"9",y:"7",width:"6",height:"6",rx:"1",key:"5m2oou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WH=U("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=U("MonitorX",[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i4=U("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=U("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=U("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=U("MountainSnow",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=U("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=U("MouseOff",[["path",{d:"M12 6v.343",key:"1gyhex"}],["path",{d:"M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218",key:"ukzz01"}],["path",{d:"M19 13.343V9A7 7 0 0 0 8.56 2.902",key:"104jy9"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=U("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eW=U("MousePointerBan",[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tW=U("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rW=U("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nW=U("Mouse",[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=U("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sW=U("MoveDiagonal2",[["path",{d:"M19 13v6h-6",key:"1hxl6d"}],["path",{d:"M5 11V5h6",key:"12e2xe"}],["path",{d:"m5 5 14 14",key:"11anup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iW=U("MoveDiagonal",[["path",{d:"M11 19H5v-6",key:"8awifj"}],["path",{d:"M13 5h6v6",key:"7voy1q"}],["path",{d:"M19 5 5 19",key:"wwaj1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aW=U("MoveDownLeft",[["path",{d:"M11 19H5V13",key:"1akmht"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oW=U("MoveDownRight",[["path",{d:"M19 13V19H13",key:"10vkzq"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lW=U("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cW=U("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dW=U("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uW=U("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hW=U("MoveUpLeft",[["path",{d:"M5 11V5H11",key:"3q78g9"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fW=U("MoveUpRight",[["path",{d:"M13 5H19V11",key:"1n1gyv"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pW=U("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mW=U("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gW=U("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xW=U("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yW=U("Music3",[["circle",{cx:"12",cy:"18",r:"4",key:"m3r9ws"}],["path",{d:"M16 18V2",key:"40x2m5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vW=U("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _W=U("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bW=U("Navigation2Off",[["path",{d:"M9.31 9.31 5 21l7-4 7 4-1.17-3.17",key:"qoq2o2"}],["path",{d:"M14.53 8.88 12 2l-1.17 3.17",key:"k3sjzy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wW=U("Navigation2",[["polygon",{points:"12 2 19 21 12 17 5 21 12 2",key:"x8c0qg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jW=U("NavigationOff",[["path",{d:"M8.43 8.43 3 11l8 2 2 8 2.57-5.43",key:"1vdtb7"}],["path",{d:"M17.39 11.73 22 2l-9.73 4.61",key:"tya3r6"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IT=U("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kW=U("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dx=U("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NW=U("Nfc",[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SW=U("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CW=U("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MW=U("NotebookText",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M9.5 8h5",key:"11mslq"}],["path",{d:"M9.5 12H16",key:"ktog6x"}],["path",{d:"M9.5 16H14",key:"p1seyn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TW=U("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AW=U("NotepadTextDashed",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M20 12v2",key:"w8o0tu"}],["path",{d:"M20 18v2a2 2 0 0 1-2 2h-1",key:"1c9ggx"}],["path",{d:"M13 22h-2",key:"191ugt"}],["path",{d:"M7 22H6a2 2 0 0 1-2-2v-2",key:"1rt9px"}],["path",{d:"M4 14v-2",key:"1v0sqh"}],["path",{d:"M4 8V6a2 2 0 0 1 2-2h2",key:"1mwabg"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EW=U("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IW=U("NutOff",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592a7.01 7.01 0 0 0 4.125-2.939",key:"1xcvy9"}],["path",{d:"M19 10v3.343",key:"163tfc"}],["path",{d:"M12 12c-1.349-.573-1.905-1.005-2.5-2-.546.902-1.048 1.353-2.5 2-1.018-.644-1.46-1.08-2-2-1.028.71-1.69.918-3 1 1.081-1.048 1.757-2.03 2-3 .194-.776.84-1.551 1.79-2.21m11.654 5.997c.887-.457 1.28-.891 1.556-1.787 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4-.74 0-1.461.068-2.15.192",key:"17914v"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PW=U("Nut",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592A7.003 7.003 0 0 0 19 14v-4",key:"1tgyif"}],["path",{d:"M12 4C8 4 4.5 6 4 8c-.243.97-.919 1.952-2 3 1.31-.082 1.972-.29 3-1 .54.92.982 1.356 2 2 1.452-.647 1.954-1.098 2.5-2 .595.995 1.151 1.427 2.5 2 1.31-.621 1.862-1.058 2.5-2 .629.977 1.162 1.423 2.5 2 1.209-.548 1.68-.967 2-2 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4Z",key:"tnsqj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=U("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=U("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T2=U("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A2=U("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OW=U("Octagon",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=U("Omega",[["path",{d:"M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",key:"1x94xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RW=U("Option",[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FW=U("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zW=U("Origami",[["path",{d:"M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025",key:"1bx4vc"}],["path",{d:"m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009",key:"1h3km6"}],["path",{d:"m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027",key:"1hj4wg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BW=U("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $W=U("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UW=U("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qW=U("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VW=U("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HW=U("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WW=U("PackageX",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const El=U("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GW=U("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KW=U("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E2=U("PaintbrushVertical",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v4",key:"qmzblu"}],["path",{d:"M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z",key:"ycvu00"}],["path",{d:"M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",key:"iw4wnp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZW=U("Paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yd=U("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=U("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I2=U("PanelBottomDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 15h1",key:"171nev"}],["path",{d:"M19 15h2",key:"1vnucp"}],["path",{d:"M3 15h2",key:"8bym0q"}],["path",{d:"M9 15h1",key:"1tg3ks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XW=U("PanelBottomOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QW=U("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P2=U("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L2=U("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O2=U("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D2=U("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JW=U("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R2=U("PanelRightDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 14v1",key:"ilsfch"}],["path",{d:"M15 19v2",key:"1fst2f"}],["path",{d:"M15 3v2",key:"z204g4"}],["path",{d:"M15 9v1",key:"z2a8b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eG=U("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tG=U("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rG=U("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F2=U("PanelTopDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 9h1",key:"l0svgy"}],["path",{d:"M19 9h2",key:"te2zfg"}],["path",{d:"M3 9h2",key:"1h4ldw"}],["path",{d:"M9 9h1",key:"15jzuz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nG=U("PanelTopOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sG=U("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iG=U("PanelsLeftBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M9 15h12",key:"5ijen5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aG=U("PanelsRightBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h12",key:"1wkqb3"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n0=U("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oG=U("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lG=U("Parentheses",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cG=U("ParkingMeter",[["path",{d:"M11 15h2",key:"199qp6"}],["path",{d:"M12 12v3",key:"158kv8"}],["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15.282 19a1 1 0 0 0 .948-.68l2.37-6.988a7 7 0 1 0-13.2 0l2.37 6.988a1 1 0 0 0 .948.68z",key:"1jofit"}],["path",{d:"M9 9a3 3 0 1 1 6 0",key:"jdoeu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bc=U("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hh=U("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dG=U("PawPrint",[["circle",{cx:"11",cy:"4",r:"2",key:"vol9p0"}],["circle",{cx:"18",cy:"8",r:"2",key:"17gozi"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z",key:"1ydw1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uG=U("PcCase",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",key:"1uq1d7"}],["path",{d:"M15 14h.01",key:"1kp3bh"}],["path",{d:"M9 6h6",key:"dgm16u"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z2=U("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hG=U("PenOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sj=U("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s0=U("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fG=U("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pG=U("PencilOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mG=U("PencilRuler",[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ya=U("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gG=U("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a4=U("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xG=U("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yG=U("PhilippinePeso",[["path",{d:"M20 11H4",key:"6ut86h"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7",key:"1ana5r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vG=U("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _G=U("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bG=U("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wG=U("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jG=U("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kG=U("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ma=U("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NG=U("Pi",[["line",{x1:"9",x2:"9",y1:"4",y2:"20",key:"ovs5a5"}],["path",{d:"M4 7c0-1.7 1.3-3 3-3h13",key:"10pag4"}],["path",{d:"M18 20c-1.7 0-3-1.3-3-3V4",key:"1gaosr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SG=U("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CG=U("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MG=U("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TG=U("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AG=U("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EG=U("PilcrowLeft",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IG=U("PilcrowRight",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PG=U("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=U("PillBottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OG=U("Pill",[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z",key:"wa1lgi"}],["path",{d:"m8.5 8.5 7 7",key:"rvfmvr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PT=U("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i1=U("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=U("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RG=U("Pizza",[["path",{d:"m12 14-1 1",key:"11onhr"}],["path",{d:"m13.75 18.25-1.25 1.42",key:"1yisr3"}],["path",{d:"M17.775 5.654a15.68 15.68 0 0 0-12.121 12.12",key:"1qtqk6"}],["path",{d:"M18.8 9.3a1 1 0 0 0 2.1 7.7",key:"fbbbr2"}],["path",{d:"M21.964 20.732a1 1 0 0 1-1.232 1.232l-18-5a1 1 0 0 1-.695-1.232A19.68 19.68 0 0 1 15.732 2.037a1 1 0 0 1 1.232.695z",key:"1hyfdd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FG=U("PlaneLanding",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z",key:"1ma21e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zG=U("PlaneTakeoff",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z",key:"fkigj9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BG=U("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wc=U("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $G=U("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B2=U("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UG=U("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mn=U("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qG=U("PocketKnife",[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VG=U("Pocket",[["path",{d:"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z",key:"1mz881"}],["polyline",{points:"8 10 12 14 16 10",key:"w4mbv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HG=U("Podcast",[["path",{d:"M16.85 18.58a9 9 0 1 0-9.7 0",key:"d71mpg"}],["path",{d:"M8 14a5 5 0 1 1 8 0",key:"fc81rn"}],["circle",{cx:"12",cy:"11",r:"1",key:"1gvufo"}],["path",{d:"M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z",key:"za5kbj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WG=U("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GG=U("Pointer",[["path",{d:"M22 14a8 8 0 0 1-8 8",key:"56vcr3"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1agjmk"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1",key:"wdbh2u"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10",key:"1ibuk9"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"g6ys72"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KG=U("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZG=U("Popsicle",[["path",{d:"M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z",key:"1o68ps"}],["path",{d:"m22 22-5.5-5.5",key:"17o70y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=U("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XG=U("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QG=U("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JG=U("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eK=U("PrinterCheck",[["path",{d:"M13.5 22H7a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v.5",key:"qeb09x"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v2",key:"1md90i"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tK=U("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rK=U("Projector",[["path",{d:"M5 7 3 5",key:"1yys58"}],["path",{d:"M9 6V3",key:"1ptz9u"}],["path",{d:"m13 7 2-2",key:"1w3vmq"}],["circle",{cx:"9",cy:"13",r:"3",key:"1mma13"}],["path",{d:"M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17",key:"2frwzc"}],["path",{d:"M16 16h2",key:"dnq2od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nK=U("Proportions",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M12 9v11",key:"1fnkrn"}],["path",{d:"M2 9h13a2 2 0 0 1 2 2v9",key:"11z3ex"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sK=U("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iK=U("Pyramid",[["path",{d:"M2.5 16.88a1 1 0 0 1-.32-1.43l9-13.02a1 1 0 0 1 1.64 0l9 13.01a1 1 0 0 1-.32 1.44l-8.51 4.86a2 2 0 0 1-1.98 0Z",key:"aenxs0"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aK=U("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oK=U("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lK=U("Rabbit",[["path",{d:"M13 16a3 3 0 0 1 2.24 5",key:"1epib5"}],["path",{d:"M18 12h.01",key:"yjnet6"}],["path",{d:"M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3",key:"ue9ozu"}],["path",{d:"M20 8.54V4a2 2 0 1 0-4 0v3",key:"49iql8"}],["path",{d:"M7.612 12.524a3 3 0 1 0-1.6 4.3",key:"1e33i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cK=U("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dK=U("Radiation",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uK=U("Radical",[["path",{d:"M3 12h3.28a1 1 0 0 1 .948.684l2.298 7.934a.5.5 0 0 0 .96-.044L13.82 4.771A1 1 0 0 1 14.792 4H21",key:"1mqj8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hK=U("RadioReceiver",[["path",{d:"M5 16v2",key:"g5qcv5"}],["path",{d:"M19 16v2",key:"1gbaio"}],["rect",{width:"20",height:"8",x:"2",y:"8",rx:"2",key:"vjsjur"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fK=U("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ij=U("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pK=U("Radius",[["path",{d:"M20.34 17.52a10 10 0 1 0-2.82 2.82",key:"fydyku"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["path",{d:"m13.41 13.41 4.18 4.18",key:"1gqbwc"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mK=U("RailSymbol",[["path",{d:"M5 15h14",key:"m0yey3"}],["path",{d:"M5 9h14",key:"7tsvo6"}],["path",{d:"m14 20-5-5 6-6-5-5",key:"1jo42i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gK=U("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xK=U("Rat",[["path",{d:"M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",key:"1wq71c"}],["path",{d:"M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",key:"1crdmb"}],["path",{d:"M13.2 18a3 3 0 0 0-2.2-5",key:"1ol3lk"}],["path",{d:"M13 22H4a2 2 0 0 1 0-4h12",key:"bt3f23"}],["path",{d:"M16 9h.01",key:"1bdo4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yK=U("Ratio",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vK=U("ReceiptCent",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M12 6.5v11",key:"ecfhkf"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _K=U("ReceiptEuro",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 12h5",key:"1g6qi8"}],["path",{d:"M16 9.5a4 4 0 1 0 0 5.2",key:"b2px4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bK=U("ReceiptIndianRupee",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 7h8",key:"i86dvs"}],["path",{d:"M12 17.5 8 15h1a4 4 0 0 0 0-8",key:"grpkl4"}],["path",{d:"M8 11h8",key:"vwpz6n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wK=U("ReceiptJapaneseYen",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"m12 10 3-3",key:"1mc12w"}],["path",{d:"m9 7 3 3v7.5",key:"39i0xv"}],["path",{d:"M9 11h6",key:"1fldmi"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jK=U("ReceiptPoundSterling",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 13h5",key:"1k9z8w"}],["path",{d:"M10 17V9.5a2.5 2.5 0 0 1 5 0",key:"1dzgp0"}],["path",{d:"M8 17h7",key:"8mjdqu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kK=U("ReceiptRussianRuble",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 15h5",key:"vxg57a"}],["path",{d:"M8 11h5a2 2 0 1 0 0-4h-3v10",key:"1usi5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NK=U("ReceiptSwissFranc",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M10 17V7h5",key:"k7jq18"}],["path",{d:"M10 11h4",key:"1i0mka"}],["path",{d:"M8 15h5",key:"vxg57a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SK=U("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CK=U("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $2=U("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MK=U("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TK=U("RectangleVertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AK=U("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=U("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IK=U("RedoDot",[["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}],["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o4=U("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PK=U("RefreshCcwDot",[["path",{d:"M3 2v6h6",key:"18ldww"}],["path",{d:"M21 12A9 9 0 0 0 6 5.3L3 8",key:"1pbrqz"}],["path",{d:"M21 22v-6h-6",key:"usdfbe"}],["path",{d:"M3 12a9 9 0 0 0 15 6.7l3-2.7",key:"1hosoe"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LK=U("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OK=U("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fl=U("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DK=U("Refrigerator",[["path",{d:"M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6Z",key:"fpq118"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M15 7v6",key:"1nx30x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RK=U("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FK=U("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zK=U("Repeat1",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}],["path",{d:"M11 10h1v4",key:"70cz1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BK=U("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $K=U("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=U("ReplaceAll",[["path",{d:"M14 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"1yyzbs"}],["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"zfj4xr"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a 3 3 0 0 1 3-3h1",key:"1ageje"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qK=U("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VK=U("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LT=U("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HK=U("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WK=U("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ug=U("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=U("RockingChair",[["polyline",{points:"3.5 2 6.5 12.5 18 12.5",key:"y3iy52"}],["line",{x1:"9.5",x2:"5.5",y1:"12.5",y2:"20",key:"19vg5i"}],["line",{x1:"15",x2:"18.5",y1:"12.5",y2:"20",key:"1inpmv"}],["path",{d:"M2.75 18a13 13 0 0 0 18.5 0",key:"1nquas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KK=U("RollerCoaster",[["path",{d:"M6 19V5",key:"1r845m"}],["path",{d:"M10 19V6.8",key:"9j2tfs"}],["path",{d:"M14 19v-7.8",key:"10s8qv"}],["path",{d:"M18 5v4",key:"1tajlv"}],["path",{d:"M18 19v-6",key:"ielfq3"}],["path",{d:"M22 19V9",key:"158nzp"}],["path",{d:"M2 19V9a4 4 0 0 1 4-4c2 0 4 1.33 6 4s4 4 6 4a4 4 0 1 0-3-6.65",key:"1930oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U2=U("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZK=U("RotateCcwSquare",[["path",{d:"M20 9V7a2 2 0 0 0-2-2h-6",key:"19z8uc"}],["path",{d:"m15 2-3 3 3 3",key:"177bxs"}],["path",{d:"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2",key:"d36hnl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l4=U("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YK=U("RotateCwSquare",[["path",{d:"M12 5H6a2 2 0 0 0-2 2v3",key:"l96uqu"}],["path",{d:"m9 8 3-3-3-3",key:"1gzgc3"}],["path",{d:"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1w2k5h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OT=U("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XK=U("RouteOff",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5c.4 0 .9-.1 1.3-.2",key:"1effex"}],["path",{d:"M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12",key:"k9y2ds"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 15.3a3.5 3.5 0 0 0-3.3-3.3",key:"11nlu2"}],["path",{d:"M15 5h-4.3",key:"6537je"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QK=U("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=U("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q2=U("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V2=U("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZ=U("Rows4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tZ=U("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZ=U("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nZ=U("RussianRuble",[["path",{d:"M6 11h8a4 4 0 0 0 0-8H9v18",key:"18ai8t"}],["path",{d:"M6 15h8",key:"1y8f6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sZ=U("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iZ=U("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aZ=U("Sandwich",[["path",{d:"m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777",key:"f1wd0e"}],["path",{d:"M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25",key:"1pfu07"}],["path",{d:"M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9",key:"1oq9qw"}],["path",{d:"m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2",key:"1fnwu5"}],["rect",{width:"20",height:"4",x:"2",y:"11",rx:"1",key:"itshg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oZ=U("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lZ=U("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cZ=U("SaveAll",[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dZ=U("SaveOff",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hg=U("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H2=U("Scale3d",[["path",{d:"M5 7v11a1 1 0 0 0 1 1h11",key:"13dt1j"}],["path",{d:"M5.293 18.707 11 13",key:"ezgbsx"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uZ=U("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hZ=U("Scaling",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fZ=U("ScanBarcode",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pZ=U("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mZ=U("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gZ=U("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xZ=U("ScanQrCode",[["path",{d:"M17 12v4a1 1 0 0 1-1 1h-4",key:"uk4fdo"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M17 8V7",key:"q2g9wo"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{x:"7",y:"7",width:"5",height:"5",rx:"1",key:"m9kyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yZ=U("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vZ=U("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Z=U("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bZ=U("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZ=U("ScissorsLineDashed",[["path",{d:"M5.42 9.42 8 12",key:"12pkuq"}],["circle",{cx:"4",cy:"8",r:"2",key:"107mxr"}],["path",{d:"m14 6-8.58 8.58",key:"gvzu5l"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"M10.8 14.8 14 18",key:"ax7m9r"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jZ=U("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZ=U("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=U("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=U("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CZ=U("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MZ=U("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TZ=U("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AZ=U("SearchSlash",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EZ=U("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ei=U("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IZ=U("Section",[["path",{d:"M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0",key:"vqan6v"}],["path",{d:"M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0",key:"wdjd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W2=U("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PZ=U("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const To=U("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LZ=U("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OZ=U("SeparatorVertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DZ=U("ServerCog",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m15.7 13.4-.9-.3",key:"1jwmzr"}],["path",{d:"m9.2 10.9-.9-.3",key:"qapnim"}],["path",{d:"m10.6 15.7.3-.9",key:"quwk0k"}],["path",{d:"m13.6 15.7-.4-1",key:"cb9xp7"}],["path",{d:"m10.8 9.3-.4-1",key:"1uaiz5"}],["path",{d:"m8.3 13.6 1-.4",key:"s6srou"}],["path",{d:"m14.7 10.8 1-.4",key:"4d31cq"}],["path",{d:"m13.4 8.3-.3.9",key:"1bm987"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RZ=U("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FZ=U("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zZ=U("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BZ=U("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const od=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Z=U("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xd=U("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DT=U("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UZ=U("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qZ=U("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VZ=U("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HZ=U("ShieldBan",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RT=U("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WZ=U("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GZ=U("ShieldHalf",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 22V2",key:"zs6s6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KZ=U("ShieldMinus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZZ=U("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YZ=U("ShieldPlus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XZ=U("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G2=U("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lm=U("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QZ=U("ShipWheel",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["path",{d:"M12 2v7.5",key:"1e5rl5"}],["path",{d:"m19 5-5.23 5.23",key:"1ezxxf"}],["path",{d:"M22 12h-7.5",key:"le1719"}],["path",{d:"m19 19-5.23-5.23",key:"p3fmgn"}],["path",{d:"M12 14.5V22",key:"dgcmos"}],["path",{d:"M10.23 13.77 5 19",key:"qwopd4"}],["path",{d:"M9.5 12H2",key:"r7bup8"}],["path",{d:"M10.23 10.23 5 5",key:"k2y7lj"}],["circle",{cx:"12",cy:"12",r:"2.5",key:"ix0uyj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JZ=U("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eY=U("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fg=U("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tY=U("ShoppingBasket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ah=U("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rY=U("Shovel",[["path",{d:"M2 22v-5l5-5 5 5-5 5z",key:"1fh25c"}],["path",{d:"M9.5 14.5 16 8",key:"1smz5x"}],["path",{d:"m17 2 5 5-.5.5a3.53 3.53 0 0 1-5 0s0 0 0 0a3.53 3.53 0 0 1 0-5L17 2",key:"1q8uv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nY=U("ShowerHead",[["path",{d:"m4 4 2.5 2.5",key:"uv2vmf"}],["path",{d:"M13.5 6.5a4.95 4.95 0 0 0-7 7",key:"frdkwv"}],["path",{d:"M15 5 5 15",key:"1ag8rq"}],["path",{d:"M14 17v.01",key:"eokfpp"}],["path",{d:"M10 16v.01",key:"14uyyl"}],["path",{d:"M13 13v.01",key:"1v1k97"}],["path",{d:"M16 10v.01",key:"5169yg"}],["path",{d:"M11 20v.01",key:"cj92p8"}],["path",{d:"M17 14v.01",key:"11cswd"}],["path",{d:"M20 11v.01",key:"19e0od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sY=U("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iY=U("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aY=U("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oY=U("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lY=U("SignalHigh",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cY=U("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dY=U("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uY=U("SignalZero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hY=U("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fY=U("Signature",[["path",{d:"m21 17-2.156-1.868A.5.5 0 0 0 18 15.5v.5a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1c0-2.545-3.991-3.97-8.5-4a1 1 0 0 0 0 5c4.153 0 4.745-11.295 5.708-13.5a2.5 2.5 0 1 1 3.31 3.284",key:"y32ogt"}],["path",{d:"M3 21h18",key:"itz85i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pY=U("SignpostBig",[["path",{d:"M10 9H4L2 7l2-2h6",key:"1hq7x2"}],["path",{d:"M14 5h6l2 2-2 2h-6",key:"bv62ej"}],["path",{d:"M10 22V4a2 2 0 1 1 4 0v18",key:"eqpcf2"}],["path",{d:"M8 22h8",key:"rmew8v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mY=U("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gY=U("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xY=U("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yY=U("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vY=U("Skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Y=U("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bY=U("Slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wY=U("Slice",[["path",{d:"M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14",key:"1sllp5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FT=U("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K2=U("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jY=U("SmartphoneCharging",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12.667 8 10 12h4l-2.667 4",key:"h9lk2d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kY=U("SmartphoneNfc",[["rect",{width:"7",height:"12",x:"2",y:"6",rx:"1",key:"5nje8w"}],["path",{d:"M13 8.32a7.43 7.43 0 0 1 0 7.36",key:"1g306n"}],["path",{d:"M16.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"uqvjvo"}],["path",{d:"M19.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"ujntz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a1=U("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=U("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=U("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CY=U("Snail",[["path",{d:"M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0",key:"hneq2s"}],["circle",{cx:"10",cy:"13",r:"8",key:"194lz3"}],["path",{d:"M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6",key:"ixqyt7"}],["path",{d:"M18 3 19.1 5.2",key:"9tjm43"}],["path",{d:"M22 3 20.9 5.2",key:"j3odrs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I0=U("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MY=U("Sofa",[["path",{d:"M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3",key:"1dgpiv"}],["path",{d:"M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"xacw8m"}],["path",{d:"M4 18v2",key:"jwo5n2"}],["path",{d:"M20 18v2",key:"1ar1qi"}],["path",{d:"M12 4v9",key:"oqhhn3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TY=U("Soup",[["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M19.5 12 22 6",key:"shfsr5"}],["path",{d:"M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62",key:"rpc6vp"}],["path",{d:"M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62",key:"1lf63m"}],["path",{d:"M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62",key:"97tijn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AY=U("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EY=U("Spade",[["path",{d:"M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",key:"40bo9n"}],["path",{d:"M12 18v4",key:"jadmvz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IY=U("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const As=U("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PY=U("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LY=U("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OY=U("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DY=U("SpellCheck",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RY=U("Spline",[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FY=U("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zY=U("SprayCan",[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BY=U("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z2=U("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y2=U("SquareArrowDownLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 8-8 8",key:"166keh"}],["path",{d:"M16 16H8V8",key:"1w2ppm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X2=U("SquareArrowDownRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"M16 8v8H8",key:"1lbpgo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q2=U("SquareArrowDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J2=U("SquareArrowLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}],["path",{d:"M16 12H8",key:"1fr5h0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eb=U("SquareArrowOutDownLeft",[["path",{d:"M13 21h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6",key:"14qz4y"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tb=U("SquareArrowOutDownRight",[["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}],["path",{d:"m21 21-9-9",key:"1et2py"}],["path",{d:"M21 15v6h-6",key:"1jko0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rb=U("SquareArrowOutUpLeft",[["path",{d:"M13 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6",key:"14mv1t"}],["path",{d:"m3 3 9 9",key:"rks13r"}],["path",{d:"M3 9V3h6",key:"ira0h2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nb=U("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sb=U("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ib=U("SquareArrowUpLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8h8",key:"19xb1h"}],["path",{d:"M16 16 8 8",key:"1qdy8n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ab=U("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ob=U("SquareArrowUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lb=U("SquareAsterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cb=U("SquareBottomDashedScissors",[["path",{d:"M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2",key:"1vzg26"}],["path",{d:"M10 22H8",key:"euku7a"}],["path",{d:"M16 22h-2",key:"18d249"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vm=U("SquareChartGantt",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i0=U("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const db=U("SquareCheck",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ub=U("SquareChevronDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hb=U("SquareChevronLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fb=U("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pb=U("SquareChevronUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mb=U("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Y=U("SquareDashedBottomCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UY=U("SquareDashedBottom",[["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gb=U("SquareDashedKanban",[["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xb=U("SquareDashedMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yb=U("SquareDashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vb=U("SquareDivide",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _b=U("SquareDot",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bb=U("SquareEqual",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wb=U("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jb=U("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kb=U("SquareLibrary",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nb=U("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sb=U("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cb=U("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mb=U("SquareMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tb=U("SquareParkingOff",[["path",{d:"M3.6 3.6A2 2 0 0 1 5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-.59 1.41",key:"9l1ft6"}],["path",{d:"M3 8.7V19a2 2 0 0 0 2 2h10.3",key:"17knke"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.3",key:"1jxgo2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ab=U("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jl=U("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eb=U("SquarePercent",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ib=U("SquarePi",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h10",key:"udp07y"}],["path",{d:"M10 7v10",key:"i1d9ee"}],["path",{d:"M16 17a2 2 0 0 1-2-2V7",key:"ftwdc7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pb=U("SquarePilcrow",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 12H9.5a2.5 2.5 0 0 1 0-5H17",key:"1l9586"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M16 7v10",key:"lavkr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lb=U("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ob=U("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Db=U("SquarePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qY=U("SquareRadical",[["path",{d:"M7 12h2l2 5 2-10h4",key:"1fxv6h"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rb=U("SquareScissors",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"2",key:"1btzen"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fb=U("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zb=U("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bb=U("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $b=U("SquareSplitVertical",[["path",{d:"M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3",key:"1pi83i"}],["path",{d:"M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3",key:"ido5k7"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VY=U("SquareSquare",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HY=U("SquareStack",[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ub=U("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qb=U("SquareUserRound",[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vb=U("SquareUser",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 21v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1m6ac2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hb=U("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cm=U("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WY=U("Squircle",[["path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9",key:"garfkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GY=U("Squirrel",[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KY=U("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZY=U("StarHalf",[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YY=U("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bs=U("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XY=U("StepBack",[["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["polygon",{points:"14,20 4,12 14,4",key:"ypakod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QY=U("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JY=U("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eX=U("Sticker",[["path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z",key:"1wis1t"}],["path",{d:"M14 3v4a2 2 0 0 0 2 2h4",key:"36rjfy"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tX=U("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rX=U("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nX=U("StretchHorizontal",[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sX=U("StretchVertical",[["rect",{width:"6",height:"20",x:"4",y:"2",rx:"2",key:"19qu7m"}],["rect",{width:"6",height:"20",x:"14",y:"2",rx:"2",key:"24v0nk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iX=U("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aX=U("Subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oX=U("SunDim",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lX=U("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cX=U("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dX=U("SunSnow",[["path",{d:"M10 9a3 3 0 1 0 0 6",key:"6zmtdl"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M14 21V3",key:"1llu3z"}],["path",{d:"M10 4V3",key:"pkzwkn"}],["path",{d:"M10 21v-1",key:"1u8rkd"}],["path",{d:"m3.64 18.36.7-.7",key:"105rm9"}],["path",{d:"m4.34 6.34-.7-.7",key:"d3unjp"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 4-3 3",key:"15jcng"}],["path",{d:"m14 17 3 3",key:"6tlq38"}],["path",{d:"m21 15-3-3 3-3",key:"1nlnje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o1=U("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uX=U("Sunrise",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hX=U("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fX=U("Superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pX=U("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mX=U("SwissFranc",[["path",{d:"M10 21V3h8",key:"br2l0g"}],["path",{d:"M6 16h9",key:"2py0wn"}],["path",{d:"M10 9.5h7",key:"13dmhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gX=U("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xX=U("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yX=U("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vX=U("Syringe",[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zT=U("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _X=U("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bX=U("TableCellsSplit",[["path",{d:"M12 15V9",key:"8c7uyn"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wX=U("TableColumnsSplit",[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jX=U("TableOfContents",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M21 12h.01",key:"msek7k"}],["path",{d:"M21 18h.01",key:"1e8rq1"}],["path",{d:"M21 6h.01",key:"1koanj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kX=U("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NX=U("TableRowsSplit",[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SX=U("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CX=U("TabletSmartphone",[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MX=U("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TX=U("Tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aj=U("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AX=U("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EX=U("Tally1",[["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IX=U("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PX=U("Tally3",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LX=U("Tally4",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OX=U("Tally5",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}],["path",{d:"M22 6 2 18",key:"h9moai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DX=U("Tangent",[["circle",{cx:"17",cy:"4",r:"2",key:"y5j2s2"}],["path",{d:"M15.59 5.41 5.41 15.59",key:"l0vprr"}],["circle",{cx:"4",cy:"17",r:"2",key:"9p4efm"}],["path",{d:"M12 22s-4-9-1.5-11.5S22 12 22 12",key:"1twk4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rx=U("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RX=U("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FX=U("TentTree",[["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}],["path",{d:"m14 5 3-3 3 3",key:"1sorif"}],["path",{d:"m14 10 3-3 3 3",key:"1jyi9h"}],["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M17 14H7l-5 8h20Z",key:"13ar7p"}],["path",{d:"M8 14v8",key:"1ghmqk"}],["path",{d:"m9 14 5 8",key:"13pgi6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zX=U("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BX=U("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=U("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=U("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UX=U("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qX=U("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VX=U("TextCursor",[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HX=U("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WX=U("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=U("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GX=U("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KX=U("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZX=U("ThermometerSnowflake",[["path",{d:"M2 12h10",key:"19562f"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"m3 9 3 3-3 3",key:"1sas0l"}],["path",{d:"M12 6 9 9 6 6",key:"pfrgxu"}],["path",{d:"m6 18 3-3 1.5 1.5",key:"1e277p"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YX=U("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XX=U("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BT=U("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ad=U("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QX=U("TicketCheck",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JX=U("TicketMinus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eQ=U("TicketPercent",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tQ=U("TicketPlus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rQ=U("TicketSlash",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nQ=U("TicketX",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $T=U("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sQ=U("TicketsPlane",[["path",{d:"M10.5 17h1.227a2 2 0 0 0 1.345-.52L18 12",key:"16muxl"}],["path",{d:"m12 13.5 3.75.5",key:"1i9qhk"}],["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iQ=U("Tickets",[["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aQ=U("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oQ=U("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQ=U("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=U("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dQ=U("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uQ=U("Toilet",[["path",{d:"M7 12h13a1 1 0 0 1 1 1 5 5 0 0 1-5 5h-.598a.5.5 0 0 0-.424.765l1.544 2.47a.5.5 0 0 1-.424.765H5.402a.5.5 0 0 1-.424-.765L7 18",key:"kc4kqr"}],["path",{d:"M8 18a5 5 0 0 1-5-5V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8",key:"1tqs57"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hQ=U("Tornado",[["path",{d:"M21 4H3",key:"1hwok0"}],["path",{d:"M18 8H6",key:"41n648"}],["path",{d:"M19 12H9",key:"1g4lpz"}],["path",{d:"M16 16h-6",key:"1j5d54"}],["path",{d:"M11 20H9",key:"39obr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fQ=U("Torus",[["ellipse",{cx:"12",cy:"11",rx:"3",ry:"2",key:"1b2qxu"}],["ellipse",{cx:"12",cy:"12.5",rx:"10",ry:"8.5",key:"h8emeu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=U("TouchpadOff",[["path",{d:"M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16",key:"lnt0bk"}],["path",{d:"M2 14h12",key:"d8icqz"}],["path",{d:"M22 14h-2",key:"jrx26d"}],["path",{d:"M12 20v-6",key:"1rm09r"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M22 16V6a2 2 0 0 0-2-2H10",key:"11y8e4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=U("Touchpad",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gQ=U("TowerControl",[["path",{d:"M18.2 12.27 20 6H4l1.8 6.27a1 1 0 0 0 .95.73h10.5a1 1 0 0 0 .96-.73Z",key:"1pledb"}],["path",{d:"M8 13v9",key:"hmv0ci"}],["path",{d:"M16 22v-9",key:"ylnf1u"}],["path",{d:"m9 6 1 7",key:"dpdgam"}],["path",{d:"m15 6-1 7",key:"ls7zgu"}],["path",{d:"M12 6V2",key:"1pj48d"}],["path",{d:"M13 2h-2",key:"mj6ths"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xQ=U("ToyBrick",[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=U("Tractor",[["path",{d:"m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20",key:"she1j9"}],["path",{d:"M16 18h-5",key:"bq60fd"}],["path",{d:"M18 5a1 1 0 0 0-1 1v5.573",key:"1kv8ia"}],["path",{d:"M3 4h8.129a1 1 0 0 1 .99.863L13 11.246",key:"1q1ert"}],["path",{d:"M4 11V4",key:"9ft8pt"}],["path",{d:"M7 15h.01",key:"k5ht0j"}],["path",{d:"M8 10.1V4",key:"1jgyzo"}],["circle",{cx:"18",cy:"18",r:"2",key:"1emm8v"}],["circle",{cx:"7",cy:"15",r:"5",key:"ddtuc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=U("TrafficCone",[["path",{d:"M9.3 6.2a4.55 4.55 0 0 0 5.4 0",key:"flyxqv"}],["path",{d:"M7.9 10.7c.9.8 2.4 1.3 4.1 1.3s3.2-.5 4.1-1.3",key:"1nlxxg"}],["path",{d:"M13.9 3.5a1.93 1.93 0 0 0-3.8-.1l-3 10c-.1.2-.1.4-.1.6 0 1.7 2.2 3 5 3s5-1.3 5-3c0-.2 0-.4-.1-.5Z",key:"vz7x1l"}],["path",{d:"m7.5 12.2-4.7 2.7c-.5.3-.8.7-.8 1.1s.3.8.8 1.1l7.6 4.5c.9.5 2.1.5 3 0l7.6-4.5c.7-.3 1-.7 1-1.1s-.3-.8-.8-1.1l-4.7-2.8",key:"1xfzlw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=U("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bQ=U("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=U("TrainTrack",[["path",{d:"M2 17 17 2",key:"18b09t"}],["path",{d:"m2 14 8 8",key:"1gv9hu"}],["path",{d:"m5 11 8 8",key:"189pqp"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"m11 5 8 8",key:"ummqn6"}],["path",{d:"m14 2 8 8",key:"1vk7dn"}],["path",{d:"M7 22 22 7",key:"15mb1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=U("TramFront",[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const es=U("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jQ=U("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kQ=U("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=U("TreePalm",[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l1=U("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NQ=U("Trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=U("Trello",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["rect",{width:"3",height:"9",x:"7",y:"7",key:"14n3xi"}],["rect",{width:"3",height:"5",x:"14",y:"7",key:"s4azjd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c1=U("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CQ=U("TrendingUpDown",[["path",{d:"M14.828 14.828 21 21",key:"ar5fw7"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"m21 3-9 9-4-4-6 6",key:"1h02xo"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qf=U("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lh=U("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MQ=U("TriangleRight",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=U("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qa=U("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UT=U("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=U("Turtle",[["path",{d:"m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z",key:"1lbbv7"}],["path",{d:"M4.82 7.9 8 10",key:"m9wose"}],["path",{d:"M15.18 7.9 12 10",key:"p8dp2u"}],["path",{d:"M16.93 10H20a2 2 0 0 1 0 4H2",key:"12nsm7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EQ=U("TvMinimalPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=U("TvMinimal",[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IQ=U("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=U("Twitch",[["path",{d:"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7",key:"c0yzno"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=U("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=U("TypeOutline",[["path",{d:"M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z",key:"1reda3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=U("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=U("UmbrellaOff",[["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"M15.5 21a1.85 1.85 0 0 1-3.5-1v-8H2a10 10 0 0 1 3.428-6.575",key:"eki10q"}],["path",{d:"M17.5 12H22A10 10 0 0 0 9.004 3.455",key:"n2ayka"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FQ=U("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zQ=U("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BQ=U("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=U("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c4=U("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=U("UnfoldHorizontal",[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qQ=U("UnfoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VQ=U("Ungroup",[["rect",{width:"8",height:"6",x:"5",y:"4",rx:"1",key:"nzclkv"}],["rect",{width:"8",height:"6",x:"11",y:"14",rx:"1",key:"4tytwb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=U("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HQ=U("Unlink2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qT=U("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WQ=U("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ao=U("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GQ=U("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oj=U("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VT=U("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KQ=U("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZQ=U("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d1=U("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=U("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jb=U("UserRoundCog",[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ew=U("UserRoundMinus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YQ=U("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tw=U("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XQ=U("UserRoundSearch",[["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.9-1.9",key:"1e5ubv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rw=U("UserRoundX",[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nw=U("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QQ=U("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JQ=U("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jc=U("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sw=U("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fs=U("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iw=U("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aw=U("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eJ=U("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HT=U("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tJ=U("Vault",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["path",{d:"m7.9 7.9 2.7 2.7",key:"hpeyl3"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}],["path",{d:"m13.4 10.6 2.7-2.7",key:"264c1n"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["path",{d:"m7.9 16.1 2.7-2.7",key:"p81g5e"}],["circle",{cx:"16.5",cy:"16.5",r:".5",fill:"currentColor",key:"fubopw"}],["path",{d:"m13.4 13.4 2.7 2.7",key:"abhel3"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rJ=U("Vegan",[["path",{d:"M16 8q6 0 6-6-6 0-6 6",key:"qsyyc4"}],["path",{d:"M17.41 3.59a10 10 0 1 0 3 3",key:"41m9h7"}],["path",{d:"M2 2a26.6 26.6 0 0 1 10 20c.9-6.82 1.5-9.5 4-14",key:"qiv7li"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nJ=U("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sJ=U("VibrateOff",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["path",{d:"M8 8v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2",key:"1hbad5"}],["path",{d:"M16 10.34V6c0-.55-.45-1-1-1h-4.34",key:"1x5tf0"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iJ=U("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aJ=U("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wi=U("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oJ=U("Videotape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 8h20",key:"d11cs7"}],["circle",{cx:"8",cy:"14",r:"2",key:"1k2qr5"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"14",r:"2",key:"14k7lr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lJ=U("View",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cJ=U("Voicemail",[["circle",{cx:"6",cy:"12",r:"4",key:"1ehtga"}],["circle",{cx:"18",cy:"12",r:"4",key:"4vafl8"}],["line",{x1:"6",x2:"18",y1:"16",y2:"16",key:"pmt8us"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dJ=U("Volleyball",[["path",{d:"M11.1 7.1a16.55 16.55 0 0 1 10.9 4",key:"2880wi"}],["path",{d:"M12 12a12.6 12.6 0 0 1-8.7 5",key:"113sja"}],["path",{d:"M16.8 13.6a16.55 16.55 0 0 1-9 7.5",key:"1qmsgl"}],["path",{d:"M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10",key:"1bmeqp"}],["path",{d:"M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5",key:"iekzv9"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uJ=U("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hJ=U("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fJ=U("VolumeOff",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pJ=U("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mJ=U("Volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gJ=U("Vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xJ=U("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=U("WalletMinimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yJ=U("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vJ=U("Wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lw=U("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _J=U("Wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bJ=U("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wJ=U("WashingMachine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jJ=U("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kJ=U("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NJ=U("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SJ=U("Webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CJ=U("WebhookOff",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MJ=U("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TJ=U("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AJ=U("WheatOff",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EJ=U("Wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IJ=U("WholeWord",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PJ=U("WifiHigh",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LJ=U("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OJ=U("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DJ=U("WifiZero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RJ=U("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FJ=U("WindArrowDown",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zJ=U("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BJ=U("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $J=U("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UJ=U("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qJ=U("Worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VJ=U("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fx=U("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Es=U("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HJ=U("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WJ=U("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u1=U("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d4=U("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u4=U("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qKe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:iO,AArrowUp:aO,ALargeSmall:oO,Accessibility:lO,Activity:cg,AirVent:cO,Airplay:dO,AlarmClock:hO,AlarmClockCheck:Yv,AlarmClockMinus:Xv,AlarmClockOff:uO,AlarmClockPlus:Qv,AlarmSmoke:fO,Album:pO,AlignCenter:BS,AlignCenterHorizontal:mO,AlignCenterVertical:gO,AlignEndHorizontal:xO,AlignEndVertical:yO,AlignHorizontalDistributeCenter:vO,AlignHorizontalDistributeEnd:_O,AlignHorizontalDistributeStart:bO,AlignHorizontalJustifyCenter:wO,AlignHorizontalJustifyEnd:jO,AlignHorizontalJustifyStart:kO,AlignHorizontalSpaceAround:NO,AlignHorizontalSpaceBetween:SO,AlignJustify:CO,AlignLeft:$S,AlignRight:US,AlignStartHorizontal:MO,AlignStartVertical:TO,AlignVerticalDistributeCenter:AO,AlignVerticalDistributeEnd:EO,AlignVerticalDistributeStart:IO,AlignVerticalJustifyCenter:PO,AlignVerticalJustifyEnd:LO,AlignVerticalJustifyStart:OO,AlignVerticalSpaceAround:DO,AlignVerticalSpaceBetween:RO,Ambulance:FO,Ampersand:zO,Ampersands:BO,Amphora:$O,Anchor:UO,Angry:qO,Annoyed:VO,Antenna:HO,Anvil:WO,Aperture:GO,AppWindow:_T,AppWindowMac:KO,Apple:ZO,Archive:QO,ArchiveRestore:YO,ArchiveX:XO,Armchair:JO,ArrowBigDown:t8,ArrowBigDownDash:e8,ArrowBigLeft:n8,ArrowBigLeftDash:r8,ArrowBigRight:i8,ArrowBigRightDash:s8,ArrowBigUp:o8,ArrowBigUpDash:a8,ArrowDown:Hw,ArrowDown01:l8,ArrowDown10:c8,ArrowDownAZ:Jv,ArrowDownFromLine:d8,ArrowDownLeft:u8,ArrowDownNarrowWide:h8,ArrowDownRight:f8,ArrowDownToDot:p8,ArrowDownToLine:m8,ArrowDownUp:g8,ArrowDownWideNarrow:e_,ArrowDownZA:t_,ArrowLeft:Ga,ArrowLeftFromLine:x8,ArrowLeftRight:y8,ArrowLeftToLine:v8,ArrowRight:Ho,ArrowRightFromLine:_8,ArrowRightLeft:b8,ArrowRightToLine:w8,ArrowUp:Ix,ArrowUp01:j8,ArrowUp10:k8,ArrowUpAZ:r_,ArrowUpDown:Ex,ArrowUpFromDot:N8,ArrowUpFromLine:S8,ArrowUpLeft:C8,ArrowUpNarrowWide:n_,ArrowUpRight:M8,ArrowUpToLine:T8,ArrowUpWideNarrow:A8,ArrowUpZA:s_,ArrowsUpFromLine:E8,Asterisk:I8,AtSign:P8,Atom:L8,AudioLines:O8,AudioWaveform:D8,Award:Ml,Axe:R8,Axis3d:i_,Baby:F8,Backpack:z8,Badge:tD,BadgeAlert:B8,BadgeCent:$8,BadgeCheck:a_,BadgeDollarSign:U8,BadgeEuro:q8,BadgeHelp:V8,BadgeIndianRupee:H8,BadgeInfo:W8,BadgeJapaneseYen:G8,BadgeMinus:K8,BadgePercent:Z8,BadgePlus:Y8,BadgePoundSterling:X8,BadgeRussianRuble:Q8,BadgeSwissFranc:J8,BadgeX:eD,BaggageClaim:rD,Ban:nD,Banana:sD,Bandage:iD,Banknote:aD,Barcode:oD,Baseline:lD,Bath:Ff,Battery:pD,BatteryCharging:cD,BatteryFull:dD,BatteryLow:uD,BatteryMedium:hD,BatteryWarning:fD,Beaker:mD,Bean:xD,BeanOff:gD,Bed:zf,BedDouble:yD,BedSingle:vD,Beef:_D,Beer:wD,BeerOff:bD,Bell:dg,BellDot:jD,BellElectric:kD,BellMinus:ND,BellOff:Ww,BellPlus:SD,BellRing:CD,BetweenHorizontalEnd:o_,BetweenHorizontalStart:l_,BetweenVerticalEnd:MD,BetweenVerticalStart:TD,BicepsFlexed:AD,Bike:ED,Binary:ID,Binoculars:PD,Biohazard:LD,Bird:OD,Bitcoin:DD,Blend:RD,Blinds:FD,Blocks:zD,Bluetooth:qD,BluetoothConnected:BD,BluetoothOff:$D,BluetoothSearching:UD,Bold:qS,Bolt:VD,Bomb:HD,Bone:WD,Book:pR,BookA:GD,BookAudio:KD,BookCheck:ZD,BookCopy:YD,BookDashed:c_,BookDown:XD,BookHeadphones:QD,BookHeart:JD,BookImage:eR,BookKey:tR,BookLock:rR,BookMarked:nR,BookMinus:sR,BookOpen:bT,BookOpenCheck:iR,BookOpenText:aR,BookPlus:oR,BookText:lR,BookType:cR,BookUp:uR,BookUp2:dR,BookUser:hR,BookX:fR,Bookmark:nm,BookmarkCheck:mR,BookmarkMinus:gR,BookmarkPlus:xR,BookmarkX:yR,BoomBox:vR,Bot:VS,BotMessageSquare:_R,BotOff:bR,Box:wR,Boxes:jR,Braces:d_,Brackets:kR,Brain:wT,BrainCircuit:NR,BrainCog:SR,BrickWall:CR,Briefcase:hh,BriefcaseBusiness:MR,BriefcaseConveyorBelt:TR,BriefcaseMedical:AR,BringToFront:ER,Brush:IR,Bug:OR,BugOff:PR,BugPlay:LR,Building:HS,Building2:na,Bus:RR,BusFront:DR,Cable:zR,CableCar:FR,Cake:Uh,CakeSlice:BR,Calculator:$R,Calendar:li,Calendar1:UR,CalendarArrowDown:qR,CalendarArrowUp:VR,CalendarCheck:WR,CalendarCheck2:HR,CalendarClock:GR,CalendarCog:KR,CalendarDays:sm,CalendarFold:ZR,CalendarHeart:YR,CalendarMinus:QR,CalendarMinus2:XR,CalendarOff:JR,CalendarPlus:Gw,CalendarPlus2:eF,CalendarRange:tF,CalendarSearch:rF,CalendarSync:nF,CalendarX:iF,CalendarX2:sF,Camera:Kw,CameraOff:aF,Candy:cF,CandyCane:oF,CandyOff:lF,Cannabis:dF,Captions:u_,CaptionsOff:uF,Car:pF,CarFront:hF,CarTaxiFront:fF,Caravan:mF,Carrot:gF,CaseLower:xF,CaseSensitive:yF,CaseUpper:vF,CassetteTape:_F,Cast:bF,Castle:wF,Cat:jF,Cctv:kF,ChartArea:h_,ChartBar:p_,ChartBarBig:f_,ChartBarDecreasing:NF,ChartBarIncreasing:SF,ChartBarStacked:CF,ChartCandlestick:m_,ChartColumn:nc,ChartColumnBig:g_,ChartColumnDecreasing:MF,ChartColumnIncreasing:x_,ChartColumnStacked:TF,ChartGantt:AF,ChartLine:y_,ChartNetwork:EF,ChartNoAxesColumn:__,ChartNoAxesColumnDecreasing:IF,ChartNoAxesColumnIncreasing:v_,ChartNoAxesCombined:PF,ChartNoAxesGantt:b_,ChartPie:w_,ChartScatter:j_,ChartSpline:LF,Check:$a,CheckCheck:OF,ChefHat:DF,Cherry:RF,ChevronDown:Tu,ChevronFirst:FF,ChevronLast:zF,ChevronLeft:id,ChevronRight:Ka,ChevronUp:K0,ChevronsDown:$F,ChevronsDownUp:BF,ChevronsLeft:VF,ChevronsLeftRight:qF,ChevronsLeftRightEllipsis:UF,ChevronsRight:WF,ChevronsRightLeft:HF,ChevronsUp:GF,ChevronsUpDown:Zw,Chrome:KF,Church:ZF,Cigarette:XF,CigaretteOff:YF,Circle:Au,CircleAlert:Ul,CircleArrowDown:k_,CircleArrowLeft:N_,CircleArrowOutDownLeft:S_,CircleArrowOutDownRight:C_,CircleArrowOutUpLeft:M_,CircleArrowOutUpRight:T_,CircleArrowRight:A_,CircleArrowUp:E_,CircleCheck:Ha,CircleCheckBig:Ba,CircleChevronDown:I_,CircleChevronLeft:P_,CircleChevronRight:L_,CircleChevronUp:O_,CircleDashed:QF,CircleDivide:D_,CircleDollarSign:JF,CircleDot:tz,CircleDotDashed:ez,CircleEllipsis:rz,CircleEqual:nz,CircleFadingArrowUp:sz,CircleFadingPlus:iz,CircleGauge:R_,CircleHelp:xx,CircleMinus:F_,CircleOff:az,CircleParking:B_,CircleParkingOff:z_,CirclePause:$_,CirclePercent:U_,CirclePlay:Af,CirclePlus:q_,CirclePower:V_,CircleSlash:oz,CircleSlash2:H_,CircleStop:W_,CircleUser:K_,CircleUserRound:G_,CircleX:Oc,CircuitBoard:lz,Citrus:cz,Clapperboard:dz,Clipboard:yz,ClipboardCheck:jT,ClipboardCopy:uz,ClipboardList:hz,ClipboardMinus:fz,ClipboardPaste:pz,ClipboardPen:Y_,ClipboardPenLine:Z_,ClipboardPlus:mz,ClipboardType:gz,ClipboardX:xz,Clock:Gi,Clock1:vz,Clock10:_z,Clock11:bz,Clock12:wz,Clock2:jz,Clock3:kz,Clock4:Nz,Clock5:Sz,Clock6:Cz,Clock7:Mz,Clock8:Tz,Clock9:Az,ClockAlert:Ez,ClockArrowDown:Iz,ClockArrowUp:Pz,Cloud:Kz,CloudAlert:Lz,CloudCog:Oz,CloudDownload:X_,CloudDrizzle:Dz,CloudFog:Rz,CloudHail:Fz,CloudLightning:zz,CloudMoon:$z,CloudMoonRain:Bz,CloudOff:Uz,CloudRain:Vz,CloudRainWind:qz,CloudSnow:Hz,CloudSun:Gz,CloudSunRain:Wz,CloudUpload:Q_,Cloudy:Zz,Clover:Nx,Club:Yz,Code:Yw,CodeXml:J_,Codepen:Xz,Codesandbox:Qz,Coffee:Xw,Cog:Jz,Coins:e7,Columns2:e2,Columns3:t2,Columns4:t7,Combine:r7,Command:n7,Compass:s7,Component:i7,Computer:a7,ConciergeBell:o7,Cone:l7,Construction:c7,Contact:d7,ContactRound:r2,Container:u7,Contrast:h7,Cookie:f7,CookingPot:p7,Copy:Vl,CopyCheck:m7,CopyMinus:g7,CopyPlus:x7,CopySlash:y7,CopyX:v7,Copyleft:_7,Copyright:b7,CornerDownLeft:w7,CornerDownRight:j7,CornerLeftDown:k7,CornerLeftUp:N7,CornerRightDown:S7,CornerRightUp:C7,CornerUpLeft:M7,CornerUpRight:T7,Cpu:A7,CreativeCommons:E7,CreditCard:Z0,Croissant:I7,Crop:P7,Cross:L7,Crosshair:O7,Crown:Y0,Cuboid:D7,CupSoda:R7,Currency:F7,Cylinder:z7,Dam:B7,Database:q7,DatabaseBackup:$7,DatabaseZap:U7,Delete:V7,Dessert:H7,Diameter:W7,Diamond:Z7,DiamondMinus:G7,DiamondPercent:n2,DiamondPlus:K7,Dice1:Y7,Dice2:X7,Dice3:Q7,Dice4:J7,Dice5:eB,Dice6:tB,Dices:rB,Diff:nB,Disc:oB,Disc2:sB,Disc3:iB,DiscAlbum:aB,Divide:lB,Dna:dB,DnaOff:cB,Dock:uB,Dog:hB,DollarSign:ad,Donut:fB,DoorClosed:pB,DoorOpen:X0,Dot:mB,Download:Mo,DraftingCompass:gB,Drama:xB,Dribbble:yB,Drill:vB,Droplet:_B,Droplets:bB,Drum:wB,Drumstick:jB,Dumbbell:kB,Ear:SB,EarOff:NB,Earth:s2,EarthLock:CB,Eclipse:MB,Egg:WS,EggFried:TB,EggOff:AB,Ellipsis:Jm,EllipsisVertical:yx,Equal:PB,EqualApproximately:EB,EqualNot:IB,Eraser:LB,EthernetPort:OB,Euro:DB,Expand:RB,ExternalLink:$s,Eye:Al,EyeClosed:FB,EyeOff:Qw,Facebook:Td,Factory:zB,Fan:BB,FastForward:$B,Feather:UB,Fence:qB,FerrisWheel:VB,Figma:HB,File:z9,FileArchive:WB,FileAudio:KB,FileAudio2:GB,FileAxis3d:i2,FileBadge:YB,FileBadge2:ZB,FileBox:XB,FileChartColumn:o2,FileChartColumnIncreasing:a2,FileChartLine:l2,FileChartPie:c2,FileCheck:JB,FileCheck2:QB,FileClock:e9,FileCode:r9,FileCode2:t9,FileCog:d2,FileDiff:n9,FileDigit:s9,FileDown:i9,FileHeart:a9,FileImage:Q0,FileInput:o9,FileJson:c9,FileJson2:l9,FileKey:u9,FileKey2:d9,FileLock:f9,FileLock2:h9,FileMinus:m9,FileMinus2:p9,FileMusic:g9,FileOutput:x9,FilePen:h2,FilePenLine:u2,FilePlus:v9,FilePlus2:y9,FileQuestion:_9,FileScan:b9,FileSearch:j9,FileSearch2:w9,FileSliders:k9,FileSpreadsheet:J0,FileStack:N9,FileSymlink:S9,FileTerminal:C9,FileText:Si,FileType:T9,FileType2:M9,FileUp:A9,FileUser:E9,FileVideo:P9,FileVideo2:I9,FileVolume:O9,FileVolume2:L9,FileWarning:D9,FileX:F9,FileX2:R9,Files:B9,Film:kd,Filter:Jw,FilterX:$9,Fingerprint:U9,FireExtinguisher:q9,Fish:W9,FishOff:V9,FishSymbol:H9,Flag:Px,FlagOff:G9,FlagTriangleLeft:K9,FlagTriangleRight:Z9,Flame:qh,FlameKindling:Y9,Flashlight:Q9,FlashlightOff:X9,FlaskConical:ej,FlaskConicalOff:J9,FlaskRound:e$,FlipHorizontal:r$,FlipHorizontal2:t$,FlipVertical:s$,FlipVertical2:n$,Flower:i$,Flower2:Qp,Focus:a$,FoldHorizontal:o$,FoldVertical:l$,Folder:O$,FolderArchive:c$,FolderCheck:d$,FolderClock:u$,FolderClosed:h$,FolderCode:f$,FolderCog:f2,FolderDot:p$,FolderDown:m$,FolderGit:x$,FolderGit2:g$,FolderHeart:y$,FolderInput:v$,FolderKanban:_$,FolderKey:b$,FolderLock:w$,FolderMinus:j$,FolderOpen:Lx,FolderOpenDot:k$,FolderOutput:N$,FolderPen:p2,FolderPlus:S$,FolderRoot:C$,FolderSearch:T$,FolderSearch2:M$,FolderSymlink:A$,FolderSync:E$,FolderTree:I$,FolderUp:P$,FolderX:L$,Folders:D$,Footprints:R$,Forklift:F$,Forward:z$,Frame:B$,Framer:$$,Frown:U$,Fuel:q$,Fullscreen:V$,GalleryHorizontal:W$,GalleryHorizontalEnd:H$,GalleryThumbnails:G$,GalleryVertical:Z$,GalleryVerticalEnd:K$,Gamepad:X$,Gamepad2:Y$,Gauge:Q$,Gavel:J$,Gem:eU,Ghost:tj,Gift:Ua,GitBranch:rU,GitBranchPlus:tU,GitCommitHorizontal:m2,GitCommitVertical:nU,GitCompare:iU,GitCompareArrows:sU,GitFork:aU,GitGraph:oU,GitMerge:lU,GitPullRequest:pU,GitPullRequestArrow:cU,GitPullRequestClosed:dU,GitPullRequestCreate:hU,GitPullRequestCreateArrow:uU,GitPullRequestDraft:fU,Github:mU,Gitlab:gU,GlassWater:xU,Glasses:yU,Globe:rj,GlobeLock:vU,Goal:_U,Grab:bU,GraduationCap:e1,Grape:wU,Grid2x2:x2,Grid2x2Check:jU,Grid2x2Plus:g2,Grid2x2X:kU,Grid3x3:Ah,Grip:SU,GripHorizontal:NU,GripVertical:GS,Group:CU,Guitar:MU,Ham:TU,Hammer:AU,Hand:OU,HandCoins:EU,HandHeart:IU,HandHelping:y2,HandMetal:PU,HandPlatter:LU,Handshake:DU,HardDrive:kT,HardDriveDownload:RU,HardDriveUpload:FU,HardHat:zU,Hash:KS,Haze:BU,HdmiPort:$U,Heading:WU,Heading1:NT,Heading2:ST,Heading3:UU,Heading4:qU,Heading5:VU,Heading6:HU,HeadphoneOff:GU,Headphones:KU,Headset:ZU,Heart:oa,HeartCrack:YU,HeartHandshake:XU,HeartOff:QU,HeartPulse:JU,Heater:eq,Hexagon:tq,Highlighter:rq,History:ZS,Hop:sq,HopOff:nq,Hospital:iq,Hotel:aq,Hourglass:oq,House:ui,HousePlug:lq,HousePlus:cq,IceCreamBowl:v2,IceCreamCone:_2,IdCard:dq,Image:Wo,ImageDown:uq,ImageMinus:hq,ImageOff:fq,ImagePlay:pq,ImagePlus:YS,ImageUp:mq,ImageUpscale:gq,Images:xq,Import:yq,Inbox:vq,IndentDecrease:b2,IndentIncrease:w2,IndianRupee:_q,Infinity:bq,Info:wq,InspectionPanel:jq,Instagram:Zd,Italic:XS,IterationCcw:kq,IterationCw:Nq,JapaneseYen:Sq,Joystick:Cq,Kanban:t1,Key:Vh,KeyRound:nj,KeySquare:Mq,Keyboard:Eq,KeyboardMusic:Tq,KeyboardOff:Aq,Lamp:Rq,LampCeiling:Iq,LampDesk:Pq,LampFloor:Lq,LampWallDown:Oq,LampWallUp:Dq,LandPlot:Fq,Landmark:zq,Languages:Bq,Laptop:Uq,LaptopMinimal:j2,LaptopMinimalCheck:$q,Lasso:Vq,LassoSelect:qq,Laugh:Hq,Layers:Kq,Layers2:Wq,Layers3:Gq,LayoutDashboard:QS,LayoutGrid:im,LayoutList:Zq,LayoutPanelLeft:Yq,LayoutPanelTop:Xq,LayoutTemplate:Qq,Leaf:Jq,LeafyGreen:eV,Lectern:tV,LetterText:rV,Library:JS,LibraryBig:nV,LifeBuoy:e4,Ligature:sV,Lightbulb:r1,LightbulbOff:iV,Link:bo,Link2:Bf,Link2Off:aV,Linkedin:am,List:$f,ListCheck:oV,ListChecks:lV,ListCollapse:cV,ListEnd:dV,ListFilter:uV,ListMinus:hV,ListMusic:fV,ListOrdered:t4,ListPlus:pV,ListRestart:mV,ListStart:gV,ListTodo:xV,ListTree:yV,ListVideo:vV,ListX:_V,Loader:wV,LoaderCircle:sn,LoaderPinwheel:bV,Locate:CT,LocateFixed:jV,LocateOff:kV,Lock:Uf,LockKeyhole:NV,LockKeyholeOpen:k2,LockOpen:N2,LogIn:r4,LogOut:n4,Logs:SV,Lollipop:CV,Luggage:MV,Magnet:TV,Mail:oi,MailCheck:AV,MailMinus:EV,MailOpen:IV,MailPlus:PV,MailQuestion:LV,MailSearch:OV,MailWarning:DV,MailX:MT,Mailbox:RV,Mails:FV,Map:YV,MapPin:cl,MapPinCheck:BV,MapPinCheckInside:zV,MapPinHouse:$V,MapPinMinus:qV,MapPinMinusInside:UV,MapPinOff:VV,MapPinPlus:WV,MapPinPlusInside:HV,MapPinX:KV,MapPinXInside:GV,MapPinned:ZV,Martini:XV,Maximize:n1,Maximize2:QV,Medal:Ox,Megaphone:om,MegaphoneOff:JV,Meh:eH,MemoryStick:tH,Menu:TT,Merge:rH,MessageCircle:Wl,MessageCircleCode:nH,MessageCircleDashed:sH,MessageCircleHeart:s4,MessageCircleMore:iH,MessageCircleOff:aH,MessageCirclePlus:oH,MessageCircleQuestion:AT,MessageCircleReply:lH,MessageCircleWarning:cH,MessageCircleX:dH,MessageSquare:vl,MessageSquareCode:uH,MessageSquareDashed:hH,MessageSquareDiff:fH,MessageSquareDot:pH,MessageSquareHeart:mH,MessageSquareLock:gH,MessageSquareMore:xH,MessageSquareOff:yH,MessageSquarePlus:vH,MessageSquareQuote:_H,MessageSquareReply:bH,MessageSquareShare:wH,MessageSquareText:jH,MessageSquareWarning:kH,MessageSquareX:NH,MessagesSquare:SH,Mic:ET,MicOff:CH,MicVocal:S2,Microchip:MH,Microscope:TH,Microwave:AH,Milestone:EH,Milk:PH,MilkOff:IH,Minimize:OH,Minimize2:LH,Minus:s1,Monitor:i4,MonitorCheck:DH,MonitorCog:RH,MonitorDot:FH,MonitorDown:zH,MonitorOff:BH,MonitorPause:$H,MonitorPlay:UH,MonitorSmartphone:qH,MonitorSpeaker:VH,MonitorStop:HH,MonitorUp:WH,MonitorX:GH,Moon:ZH,MoonStar:KH,Mountain:XH,MountainSnow:YH,Mouse:nW,MouseOff:QH,MousePointer:rW,MousePointer2:JH,MousePointerBan:eW,MousePointerClick:tW,Move:gW,Move3d:C2,MoveDiagonal:iW,MoveDiagonal2:sW,MoveDown:lW,MoveDownLeft:aW,MoveDownRight:oW,MoveHorizontal:cW,MoveLeft:dW,MoveRight:uW,MoveUp:pW,MoveUpLeft:hW,MoveUpRight:fW,MoveVertical:mW,Music:_W,Music2:xW,Music3:yW,Music4:vW,Navigation:IT,Navigation2:wW,Navigation2Off:bW,NavigationOff:jW,Network:kW,Newspaper:Dx,Nfc:NW,Notebook:TW,NotebookPen:SW,NotebookTabs:CW,NotebookText:MW,NotepadText:EW,NotepadTextDashed:AW,Nut:PW,NutOff:IW,Octagon:OW,OctagonAlert:M2,OctagonMinus:LW,OctagonPause:T2,OctagonX:A2,Omega:DW,Option:RW,Orbit:FW,Origami:zW,Package:El,Package2:BW,PackageCheck:$W,PackageMinus:UW,PackageOpen:qW,PackagePlus:VW,PackageSearch:HW,PackageX:WW,PaintBucket:GW,PaintRoller:KW,Paintbrush:ZW,PaintbrushVertical:E2,Palette:Yd,PanelBottom:QW,PanelBottomClose:YW,PanelBottomDashed:I2,PanelBottomOpen:XW,PanelLeft:D2,PanelLeftClose:P2,PanelLeftDashed:L2,PanelLeftOpen:O2,PanelRight:tG,PanelRightClose:JW,PanelRightDashed:R2,PanelRightOpen:eG,PanelTop:sG,PanelTopClose:rG,PanelTopDashed:F2,PanelTopOpen:nG,PanelsLeftBottom:iG,PanelsRightBottom:aG,PanelsTopLeft:n0,Paperclip:oG,Parentheses:lG,ParkingMeter:cG,PartyPopper:bc,Pause:Hh,PawPrint:dG,PcCase:uG,Pen:s0,PenLine:z2,PenOff:hG,PenTool:sj,Pencil:ya,PencilLine:fG,PencilOff:pG,PencilRuler:mG,Pentagon:gG,Percent:a4,PersonStanding:xG,PhilippinePeso:yG,Phone:Ma,PhoneCall:vG,PhoneForwarded:_G,PhoneIncoming:bG,PhoneMissed:wG,PhoneOff:jG,PhoneOutgoing:kG,Pi:NG,Piano:SG,Pickaxe:CG,PictureInPicture:TG,PictureInPicture2:MG,PiggyBank:AG,Pilcrow:PG,PilcrowLeft:EG,PilcrowRight:IG,Pill:OG,PillBottle:LG,Pin:i1,PinOff:PT,Pipette:DG,Pizza:RG,Plane:BG,PlaneLanding:FG,PlaneTakeoff:zG,Play:wc,Plug:UG,Plug2:$G,PlugZap:B2,Plus:Mn,Pocket:VG,PocketKnife:qG,Podcast:HG,Pointer:GG,PointerOff:WG,Popcorn:KG,Popsicle:ZG,PoundSterling:YG,Power:QG,PowerOff:XG,Presentation:JG,Printer:tK,PrinterCheck:eK,Projector:rK,Proportions:nK,Puzzle:sK,Pyramid:iK,QrCode:aK,Quote:oK,Rabbit:lK,Radar:cK,Radiation:dK,Radical:uK,Radio:ij,RadioReceiver:hK,RadioTower:fK,Radius:pK,RailSymbol:mK,Rainbow:gK,Rat:xK,Ratio:yK,Receipt:CK,ReceiptCent:vK,ReceiptEuro:_K,ReceiptIndianRupee:bK,ReceiptJapaneseYen:wK,ReceiptPoundSterling:jK,ReceiptRussianRuble:kK,ReceiptSwissFranc:NK,ReceiptText:SK,RectangleEllipsis:$2,RectangleHorizontal:MK,RectangleVertical:TK,Recycle:AK,Redo:o4,Redo2:EK,RedoDot:IK,RefreshCcw:LK,RefreshCcwDot:PK,RefreshCw:Fl,RefreshCwOff:OK,Refrigerator:DK,Regex:RK,RemoveFormatting:FK,Repeat:$K,Repeat1:zK,Repeat2:BK,Replace:qK,ReplaceAll:UK,Reply:LT,ReplyAll:VK,Rewind:HK,Ribbon:WK,Rocket:ug,RockingChair:GK,RollerCoaster:KK,Rotate3d:U2,RotateCcw:l4,RotateCcwSquare:ZK,RotateCw:OT,RotateCwSquare:YK,Route:QK,RouteOff:XK,Router:JK,Rows2:q2,Rows3:V2,Rows4:eZ,Rss:tZ,Ruler:rZ,RussianRuble:nZ,Sailboat:sZ,Salad:iZ,Sandwich:aZ,Satellite:lZ,SatelliteDish:oZ,Save:hg,SaveAll:cZ,SaveOff:dZ,Scale:uZ,Scale3d:H2,Scaling:hZ,Scan:_Z,ScanBarcode:fZ,ScanEye:pZ,ScanFace:mZ,ScanLine:gZ,ScanQrCode:xZ,ScanSearch:yZ,ScanText:vZ,School:bZ,Scissors:jZ,ScissorsLineDashed:wZ,ScreenShare:NZ,ScreenShareOff:kZ,Scroll:CZ,ScrollText:SZ,Search:Ei,SearchCheck:MZ,SearchCode:TZ,SearchSlash:AZ,SearchX:EZ,Section:IZ,Send:To,SendHorizontal:W2,SendToBack:PZ,SeparatorHorizontal:LZ,SeparatorVertical:OZ,Server:zZ,ServerCog:DZ,ServerCrash:RZ,ServerOff:FZ,Settings:od,Settings2:BZ,Shapes:$Z,Share:DT,Share2:Xd,Sheet:UZ,Shell:qZ,Shield:lm,ShieldAlert:VZ,ShieldBan:HZ,ShieldCheck:RT,ShieldEllipsis:WZ,ShieldHalf:GZ,ShieldMinus:KZ,ShieldOff:ZZ,ShieldPlus:YZ,ShieldQuestion:XZ,ShieldX:G2,Ship:JZ,ShipWheel:QZ,Shirt:eY,ShoppingBag:fg,ShoppingBasket:tY,ShoppingCart:ah,Shovel:rY,ShowerHead:nY,Shrink:sY,Shrub:iY,Shuffle:aY,Sigma:oY,Signal:hY,SignalHigh:lY,SignalLow:cY,SignalMedium:dY,SignalZero:uY,Signature:fY,Signpost:mY,SignpostBig:pY,Siren:gY,SkipBack:xY,SkipForward:yY,Skull:vY,Slack:_Y,Slash:bY,Slice:wY,SlidersHorizontal:FT,SlidersVertical:K2,Smartphone:a1,SmartphoneCharging:jY,SmartphoneNfc:kY,Smile:SY,SmilePlus:NY,Snail:CY,Snowflake:I0,Sofa:MY,Soup:TY,Space:AY,Spade:EY,Sparkle:IY,Sparkles:As,Speaker:PY,Speech:LY,SpellCheck:DY,SpellCheck2:OY,Spline:RY,Split:FY,SprayCan:zY,Sprout:BY,Square:cm,SquareActivity:Z2,SquareArrowDown:Q2,SquareArrowDownLeft:Y2,SquareArrowDownRight:X2,SquareArrowLeft:J2,SquareArrowOutDownLeft:eb,SquareArrowOutDownRight:tb,SquareArrowOutUpLeft:rb,SquareArrowOutUpRight:nb,SquareArrowRight:sb,SquareArrowUp:ob,SquareArrowUpLeft:ib,SquareArrowUpRight:ab,SquareAsterisk:lb,SquareBottomDashedScissors:cb,SquareChartGantt:Vm,SquareCheck:db,SquareCheckBig:i0,SquareChevronDown:ub,SquareChevronLeft:hb,SquareChevronRight:fb,SquareChevronUp:pb,SquareCode:mb,SquareDashed:yb,SquareDashedBottom:UY,SquareDashedBottomCode:$Y,SquareDashedKanban:gb,SquareDashedMousePointer:xb,SquareDivide:vb,SquareDot:_b,SquareEqual:bb,SquareFunction:wb,SquareKanban:jb,SquareLibrary:kb,SquareM:Nb,SquareMenu:Sb,SquareMinus:Cb,SquareMousePointer:Mb,SquareParking:Ab,SquareParkingOff:Tb,SquarePen:Jl,SquarePercent:Eb,SquarePi:Ib,SquarePilcrow:Pb,SquarePlay:Lb,SquarePlus:Ob,SquarePower:Db,SquareRadical:qY,SquareScissors:Rb,SquareSigma:Fb,SquareSlash:zb,SquareSplitHorizontal:Bb,SquareSplitVertical:$b,SquareSquare:VY,SquareStack:HY,SquareTerminal:Ub,SquareUser:Vb,SquareUserRound:qb,SquareX:Hb,Squircle:WY,Squirrel:GY,Stamp:KY,Star:Bs,StarHalf:ZY,StarOff:YY,StepBack:XY,StepForward:QY,Stethoscope:JY,Sticker:eX,StickyNote:tX,Store:rX,StretchHorizontal:nX,StretchVertical:sX,Strikethrough:iX,Subscript:aX,Sun:o1,SunDim:oX,SunMedium:lX,SunMoon:cX,SunSnow:dX,Sunrise:uX,Sunset:hX,Superscript:fX,SwatchBook:pX,SwissFranc:mX,SwitchCamera:gX,Sword:xX,Swords:yX,Syringe:vX,Table:SX,Table2:zT,TableCellsMerge:_X,TableCellsSplit:bX,TableColumnsSplit:wX,TableOfContents:jX,TableProperties:kX,TableRowsSplit:NX,Tablet:MX,TabletSmartphone:CX,Tablets:TX,Tag:aj,Tags:AX,Tally1:EX,Tally2:IX,Tally3:PX,Tally4:LX,Tally5:OX,Tangent:DX,Target:Rx,Telescope:RX,Tent:zX,TentTree:FX,Terminal:BX,TestTube:$X,TestTubeDiagonal:Wb,TestTubes:UX,Text:GX,TextCursor:VX,TextCursorInput:qX,TextQuote:HX,TextSearch:WX,TextSelect:Gb,Theater:KX,Thermometer:XX,ThermometerSnowflake:ZX,ThermometerSun:YX,ThumbsDown:BT,ThumbsUp:Ad,Ticket:$T,TicketCheck:QX,TicketMinus:JX,TicketPercent:eQ,TicketPlus:tQ,TicketSlash:rQ,TicketX:nQ,Tickets:iQ,TicketsPlane:sQ,Timer:lQ,TimerOff:aQ,TimerReset:oQ,ToggleLeft:cQ,ToggleRight:dQ,Toilet:uQ,Tornado:hQ,Torus:fQ,Touchpad:mQ,TouchpadOff:pQ,TowerControl:gQ,ToyBrick:xQ,Tractor:yQ,TrafficCone:vQ,TrainFront:bQ,TrainFrontTunnel:_Q,TrainTrack:wQ,TramFront:Kb,Trash:jQ,Trash2:es,TreeDeciduous:kQ,TreePalm:Zb,TreePine:l1,Trees:NQ,Trello:SQ,TrendingDown:c1,TrendingUp:qf,TrendingUpDown:CQ,Triangle:TQ,TriangleAlert:Lh,TriangleRight:MQ,Trophy:qa,Truck:UT,Turtle:AQ,Tv:IQ,TvMinimal:Yb,TvMinimalPlay:EQ,Twitch:PQ,Twitter:LQ,Type:DQ,TypeOutline:OQ,Umbrella:FQ,UmbrellaOff:RQ,Underline:zQ,Undo:c4,Undo2:BQ,UndoDot:$Q,UnfoldHorizontal:UQ,UnfoldVertical:qQ,Ungroup:VQ,University:Xb,Unlink:qT,Unlink2:HQ,Unplug:WQ,Upload:Ao,Usb:GQ,User:jc,UserCheck:oj,UserCog:VT,UserMinus:KQ,UserPen:ZQ,UserPlus:d1,UserRound:nw,UserRoundCheck:Qb,UserRoundCog:Jb,UserRoundMinus:ew,UserRoundPen:YQ,UserRoundPlus:tw,UserRoundSearch:XQ,UserRoundX:rw,UserSearch:QQ,UserX:JQ,Users:fs,UsersRound:sw,Utensils:aw,UtensilsCrossed:iw,UtilityPole:eJ,Variable:HT,Vault:tJ,Vegan:rJ,VenetianMask:nJ,Vibrate:iJ,VibrateOff:sJ,Video:Wi,VideoOff:aJ,Videotape:oJ,View:lJ,Voicemail:cJ,Volleyball:dJ,Volume:mJ,Volume1:uJ,Volume2:hJ,VolumeOff:fJ,VolumeX:pJ,Vote:gJ,Wallet:yJ,WalletCards:xJ,WalletMinimal:ow,Wallpaper:vJ,Wand:_J,WandSparkles:lw,Warehouse:bJ,WashingMachine:wJ,Watch:jJ,Waves:kJ,Waypoints:NJ,Webcam:SJ,Webhook:MJ,WebhookOff:CJ,Weight:TJ,Wheat:EJ,WheatOff:AJ,WholeWord:IJ,Wifi:RJ,WifiHigh:PJ,WifiLow:LJ,WifiOff:OJ,WifiZero:DJ,Wind:zJ,WindArrowDown:FJ,Wine:$J,WineOff:BJ,Workflow:UJ,Worm:qJ,WrapText:VJ,Wrench:Fx,X:Es,Youtube:HJ,Zap:u1,ZapOff:WJ,ZoomIn:d4,ZoomOut:u4},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 uAe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:iO,AArrowDownIcon:iO,AArrowUp:aO,AArrowUpIcon:aO,ALargeSmall:oO,ALargeSmallIcon:oO,Accessibility:lO,AccessibilityIcon:lO,Activity:cg,ActivityIcon:cg,ActivitySquare:Z2,ActivitySquareIcon:Z2,AirVent:cO,AirVentIcon:cO,Airplay:dO,AirplayIcon:dO,AlarmCheck:Yv,AlarmCheckIcon:Yv,AlarmClock:hO,AlarmClockCheck:Yv,AlarmClockCheckIcon:Yv,AlarmClockIcon:hO,AlarmClockMinus:Xv,AlarmClockMinusIcon:Xv,AlarmClockOff:uO,AlarmClockOffIcon:uO,AlarmClockPlus:Qv,AlarmClockPlusIcon:Qv,AlarmMinus:Xv,AlarmMinusIcon:Xv,AlarmPlus:Qv,AlarmPlusIcon:Qv,AlarmSmoke:fO,AlarmSmokeIcon:fO,Album:pO,AlbumIcon:pO,AlertCircle:Ul,AlertCircleIcon:Ul,AlertOctagon:M2,AlertOctagonIcon:M2,AlertTriangle:Lh,AlertTriangleIcon:Lh,AlignCenter:BS,AlignCenterHorizontal:mO,AlignCenterHorizontalIcon:mO,AlignCenterIcon:BS,AlignCenterVertical:gO,AlignCenterVerticalIcon:gO,AlignEndHorizontal:xO,AlignEndHorizontalIcon:xO,AlignEndVertical:yO,AlignEndVerticalIcon:yO,AlignHorizontalDistributeCenter:vO,AlignHorizontalDistributeCenterIcon:vO,AlignHorizontalDistributeEnd:_O,AlignHorizontalDistributeEndIcon:_O,AlignHorizontalDistributeStart:bO,AlignHorizontalDistributeStartIcon:bO,AlignHorizontalJustifyCenter:wO,AlignHorizontalJustifyCenterIcon:wO,AlignHorizontalJustifyEnd:jO,AlignHorizontalJustifyEndIcon:jO,AlignHorizontalJustifyStart:kO,AlignHorizontalJustifyStartIcon:kO,AlignHorizontalSpaceAround:NO,AlignHorizontalSpaceAroundIcon:NO,AlignHorizontalSpaceBetween:SO,AlignHorizontalSpaceBetweenIcon:SO,AlignJustify:CO,AlignJustifyIcon:CO,AlignLeft:$S,AlignLeftIcon:$S,AlignRight:US,AlignRightIcon:US,AlignStartHorizontal:MO,AlignStartHorizontalIcon:MO,AlignStartVertical:TO,AlignStartVerticalIcon:TO,AlignVerticalDistributeCenter:AO,AlignVerticalDistributeCenterIcon:AO,AlignVerticalDistributeEnd:EO,AlignVerticalDistributeEndIcon:EO,AlignVerticalDistributeStart:IO,AlignVerticalDistributeStartIcon:IO,AlignVerticalJustifyCenter:PO,AlignVerticalJustifyCenterIcon:PO,AlignVerticalJustifyEnd:LO,AlignVerticalJustifyEndIcon:LO,AlignVerticalJustifyStart:OO,AlignVerticalJustifyStartIcon:OO,AlignVerticalSpaceAround:DO,AlignVerticalSpaceAroundIcon:DO,AlignVerticalSpaceBetween:RO,AlignVerticalSpaceBetweenIcon:RO,Ambulance:FO,AmbulanceIcon:FO,Ampersand:zO,AmpersandIcon:zO,Ampersands:BO,AmpersandsIcon:BO,Amphora:$O,AmphoraIcon:$O,Anchor:UO,AnchorIcon:UO,Angry:qO,AngryIcon:qO,Annoyed:VO,AnnoyedIcon:VO,Antenna:HO,AntennaIcon:HO,Anvil:WO,AnvilIcon:WO,Aperture:GO,ApertureIcon:GO,AppWindow:_T,AppWindowIcon:_T,AppWindowMac:KO,AppWindowMacIcon:KO,Apple:ZO,AppleIcon:ZO,Archive:QO,ArchiveIcon:QO,ArchiveRestore:YO,ArchiveRestoreIcon:YO,ArchiveX:XO,ArchiveXIcon:XO,AreaChart:h_,AreaChartIcon:h_,Armchair:JO,ArmchairIcon:JO,ArrowBigDown:t8,ArrowBigDownDash:e8,ArrowBigDownDashIcon:e8,ArrowBigDownIcon:t8,ArrowBigLeft:n8,ArrowBigLeftDash:r8,ArrowBigLeftDashIcon:r8,ArrowBigLeftIcon:n8,ArrowBigRight:i8,ArrowBigRightDash:s8,ArrowBigRightDashIcon:s8,ArrowBigRightIcon:i8,ArrowBigUp:o8,ArrowBigUpDash:a8,ArrowBigUpDashIcon:a8,ArrowBigUpIcon:o8,ArrowDown:Hw,ArrowDown01:l8,ArrowDown01Icon:l8,ArrowDown10:c8,ArrowDown10Icon:c8,ArrowDownAZ:Jv,ArrowDownAZIcon:Jv,ArrowDownAz:Jv,ArrowDownAzIcon:Jv,ArrowDownCircle:k_,ArrowDownCircleIcon:k_,ArrowDownFromLine:d8,ArrowDownFromLineIcon:d8,ArrowDownIcon:Hw,ArrowDownLeft:u8,ArrowDownLeftFromCircle:S_,ArrowDownLeftFromCircleIcon:S_,ArrowDownLeftFromSquare:eb,ArrowDownLeftFromSquareIcon:eb,ArrowDownLeftIcon:u8,ArrowDownLeftSquare:Y2,ArrowDownLeftSquareIcon:Y2,ArrowDownNarrowWide:h8,ArrowDownNarrowWideIcon:h8,ArrowDownRight:f8,ArrowDownRightFromCircle:C_,ArrowDownRightFromCircleIcon:C_,ArrowDownRightFromSquare:tb,ArrowDownRightFromSquareIcon:tb,ArrowDownRightIcon:f8,ArrowDownRightSquare:X2,ArrowDownRightSquareIcon:X2,ArrowDownSquare:Q2,ArrowDownSquareIcon:Q2,ArrowDownToDot:p8,ArrowDownToDotIcon:p8,ArrowDownToLine:m8,ArrowDownToLineIcon:m8,ArrowDownUp:g8,ArrowDownUpIcon:g8,ArrowDownWideNarrow:e_,ArrowDownWideNarrowIcon:e_,ArrowDownZA:t_,ArrowDownZAIcon:t_,ArrowDownZa:t_,ArrowDownZaIcon:t_,ArrowLeft:Ga,ArrowLeftCircle:N_,ArrowLeftCircleIcon:N_,ArrowLeftFromLine:x8,ArrowLeftFromLineIcon:x8,ArrowLeftIcon:Ga,ArrowLeftRight:y8,ArrowLeftRightIcon:y8,ArrowLeftSquare:J2,ArrowLeftSquareIcon:J2,ArrowLeftToLine:v8,ArrowLeftToLineIcon:v8,ArrowRight:Ho,ArrowRightCircle:A_,ArrowRightCircleIcon:A_,ArrowRightFromLine:_8,ArrowRightFromLineIcon:_8,ArrowRightIcon:Ho,ArrowRightLeft:b8,ArrowRightLeftIcon:b8,ArrowRightSquare:sb,ArrowRightSquareIcon:sb,ArrowRightToLine:w8,ArrowRightToLineIcon:w8,ArrowUp:Ix,ArrowUp01:j8,ArrowUp01Icon:j8,ArrowUp10:k8,ArrowUp10Icon:k8,ArrowUpAZ:r_,ArrowUpAZIcon:r_,ArrowUpAz:r_,ArrowUpAzIcon:r_,ArrowUpCircle:E_,ArrowUpCircleIcon:E_,ArrowUpDown:Ex,ArrowUpDownIcon:Ex,ArrowUpFromDot:N8,ArrowUpFromDotIcon:N8,ArrowUpFromLine:S8,ArrowUpFromLineIcon:S8,ArrowUpIcon:Ix,ArrowUpLeft:C8,ArrowUpLeftFromCircle:M_,ArrowUpLeftFromCircleIcon:M_,ArrowUpLeftFromSquare:rb,ArrowUpLeftFromSquareIcon:rb,ArrowUpLeftIcon:C8,ArrowUpLeftSquare:ib,ArrowUpLeftSquareIcon:ib,ArrowUpNarrowWide:n_,ArrowUpNarrowWideIcon:n_,ArrowUpRight:M8,ArrowUpRightFromCircle:T_,ArrowUpRightFromCircleIcon:T_,ArrowUpRightFromSquare:nb,ArrowUpRightFromSquareIcon:nb,ArrowUpRightIcon:M8,ArrowUpRightSquare:ab,ArrowUpRightSquareIcon:ab,ArrowUpSquare:ob,ArrowUpSquareIcon:ob,ArrowUpToLine:T8,ArrowUpToLineIcon:T8,ArrowUpWideNarrow:A8,ArrowUpWideNarrowIcon:A8,ArrowUpZA:s_,ArrowUpZAIcon:s_,ArrowUpZa:s_,ArrowUpZaIcon:s_,ArrowsUpFromLine:E8,ArrowsUpFromLineIcon:E8,Asterisk:I8,AsteriskIcon:I8,AsteriskSquare:lb,AsteriskSquareIcon:lb,AtSign:P8,AtSignIcon:P8,Atom:L8,AtomIcon:L8,AudioLines:O8,AudioLinesIcon:O8,AudioWaveform:D8,AudioWaveformIcon:D8,Award:Ml,AwardIcon:Ml,Axe:R8,AxeIcon:R8,Axis3D:i_,Axis3DIcon:i_,Axis3d:i_,Axis3dIcon:i_,Baby:F8,BabyIcon:F8,Backpack:z8,BackpackIcon:z8,Badge:tD,BadgeAlert:B8,BadgeAlertIcon:B8,BadgeCent:$8,BadgeCentIcon:$8,BadgeCheck:a_,BadgeCheckIcon:a_,BadgeDollarSign:U8,BadgeDollarSignIcon:U8,BadgeEuro:q8,BadgeEuroIcon:q8,BadgeHelp:V8,BadgeHelpIcon:V8,BadgeIcon:tD,BadgeIndianRupee:H8,BadgeIndianRupeeIcon:H8,BadgeInfo:W8,BadgeInfoIcon:W8,BadgeJapaneseYen:G8,BadgeJapaneseYenIcon:G8,BadgeMinus:K8,BadgeMinusIcon:K8,BadgePercent:Z8,BadgePercentIcon:Z8,BadgePlus:Y8,BadgePlusIcon:Y8,BadgePoundSterling:X8,BadgePoundSterlingIcon:X8,BadgeRussianRuble:Q8,BadgeRussianRubleIcon:Q8,BadgeSwissFranc:J8,BadgeSwissFrancIcon:J8,BadgeX:eD,BadgeXIcon:eD,BaggageClaim:rD,BaggageClaimIcon:rD,Ban:nD,BanIcon:nD,Banana:sD,BananaIcon:sD,Bandage:iD,BandageIcon:iD,Banknote:aD,BanknoteIcon:aD,BarChart:v_,BarChart2:__,BarChart2Icon:__,BarChart3:nc,BarChart3Icon:nc,BarChart4:x_,BarChart4Icon:x_,BarChartBig:g_,BarChartBigIcon:g_,BarChartHorizontal:p_,BarChartHorizontalBig:f_,BarChartHorizontalBigIcon:f_,BarChartHorizontalIcon:p_,BarChartIcon:v_,Barcode:oD,BarcodeIcon:oD,Baseline:lD,BaselineIcon:lD,Bath:Ff,BathIcon:Ff,Battery:pD,BatteryCharging:cD,BatteryChargingIcon:cD,BatteryFull:dD,BatteryFullIcon:dD,BatteryIcon:pD,BatteryLow:uD,BatteryLowIcon:uD,BatteryMedium:hD,BatteryMediumIcon:hD,BatteryWarning:fD,BatteryWarningIcon:fD,Beaker:mD,BeakerIcon:mD,Bean:xD,BeanIcon:xD,BeanOff:gD,BeanOffIcon:gD,Bed:zf,BedDouble:yD,BedDoubleIcon:yD,BedIcon:zf,BedSingle:vD,BedSingleIcon:vD,Beef:_D,BeefIcon:_D,Beer:wD,BeerIcon:wD,BeerOff:bD,BeerOffIcon:bD,Bell:dg,BellDot:jD,BellDotIcon:jD,BellElectric:kD,BellElectricIcon:kD,BellIcon:dg,BellMinus:ND,BellMinusIcon:ND,BellOff:Ww,BellOffIcon:Ww,BellPlus:SD,BellPlusIcon:SD,BellRing:CD,BellRingIcon:CD,BetweenHorizonalEnd:o_,BetweenHorizonalEndIcon:o_,BetweenHorizonalStart:l_,BetweenHorizonalStartIcon:l_,BetweenHorizontalEnd:o_,BetweenHorizontalEndIcon:o_,BetweenHorizontalStart:l_,BetweenHorizontalStartIcon:l_,BetweenVerticalEnd:MD,BetweenVerticalEndIcon:MD,BetweenVerticalStart:TD,BetweenVerticalStartIcon:TD,BicepsFlexed:AD,BicepsFlexedIcon:AD,Bike:ED,BikeIcon:ED,Binary:ID,BinaryIcon:ID,Binoculars:PD,BinocularsIcon:PD,Biohazard:LD,BiohazardIcon:LD,Bird:OD,BirdIcon:OD,Bitcoin:DD,BitcoinIcon:DD,Blend:RD,BlendIcon:RD,Blinds:FD,BlindsIcon:FD,Blocks:zD,BlocksIcon:zD,Bluetooth:qD,BluetoothConnected:BD,BluetoothConnectedIcon:BD,BluetoothIcon:qD,BluetoothOff:$D,BluetoothOffIcon:$D,BluetoothSearching:UD,BluetoothSearchingIcon:UD,Bold:qS,BoldIcon:qS,Bolt:VD,BoltIcon:VD,Bomb:HD,BombIcon:HD,Bone:WD,BoneIcon:WD,Book:pR,BookA:GD,BookAIcon:GD,BookAudio:KD,BookAudioIcon:KD,BookCheck:ZD,BookCheckIcon:ZD,BookCopy:YD,BookCopyIcon:YD,BookDashed:c_,BookDashedIcon:c_,BookDown:XD,BookDownIcon:XD,BookHeadphones:QD,BookHeadphonesIcon:QD,BookHeart:JD,BookHeartIcon:JD,BookIcon:pR,BookImage:eR,BookImageIcon:eR,BookKey:tR,BookKeyIcon:tR,BookLock:rR,BookLockIcon:rR,BookMarked:nR,BookMarkedIcon:nR,BookMinus:sR,BookMinusIcon:sR,BookOpen:bT,BookOpenCheck:iR,BookOpenCheckIcon:iR,BookOpenIcon:bT,BookOpenText:aR,BookOpenTextIcon:aR,BookPlus:oR,BookPlusIcon:oR,BookTemplate:c_,BookTemplateIcon:c_,BookText:lR,BookTextIcon:lR,BookType:cR,BookTypeIcon:cR,BookUp:uR,BookUp2:dR,BookUp2Icon:dR,BookUpIcon:uR,BookUser:hR,BookUserIcon:hR,BookX:fR,BookXIcon:fR,Bookmark:nm,BookmarkCheck:mR,BookmarkCheckIcon:mR,BookmarkIcon:nm,BookmarkMinus:gR,BookmarkMinusIcon:gR,BookmarkPlus:xR,BookmarkPlusIcon:xR,BookmarkX:yR,BookmarkXIcon:yR,BoomBox:vR,BoomBoxIcon:vR,Bot:VS,BotIcon:VS,BotMessageSquare:_R,BotMessageSquareIcon:_R,BotOff:bR,BotOffIcon:bR,Box:wR,BoxIcon:wR,BoxSelect:yb,BoxSelectIcon:yb,Boxes:jR,BoxesIcon:jR,Braces:d_,BracesIcon:d_,Brackets:kR,BracketsIcon:kR,Brain:wT,BrainCircuit:NR,BrainCircuitIcon:NR,BrainCog:SR,BrainCogIcon:SR,BrainIcon:wT,BrickWall:CR,BrickWallIcon:CR,Briefcase:hh,BriefcaseBusiness:MR,BriefcaseBusinessIcon:MR,BriefcaseConveyorBelt:TR,BriefcaseConveyorBeltIcon:TR,BriefcaseIcon:hh,BriefcaseMedical:AR,BriefcaseMedicalIcon:AR,BringToFront:ER,BringToFrontIcon:ER,Brush:IR,BrushIcon:IR,Bug:OR,BugIcon:OR,BugOff:PR,BugOffIcon:PR,BugPlay:LR,BugPlayIcon:LR,Building:HS,Building2:na,Building2Icon:na,BuildingIcon:HS,Bus:RR,BusFront:DR,BusFrontIcon:DR,BusIcon:RR,Cable:zR,CableCar:FR,CableCarIcon:FR,CableIcon:zR,Cake:Uh,CakeIcon:Uh,CakeSlice:BR,CakeSliceIcon:BR,Calculator:$R,CalculatorIcon:$R,Calendar:li,Calendar1:UR,Calendar1Icon:UR,CalendarArrowDown:qR,CalendarArrowDownIcon:qR,CalendarArrowUp:VR,CalendarArrowUpIcon:VR,CalendarCheck:WR,CalendarCheck2:HR,CalendarCheck2Icon:HR,CalendarCheckIcon:WR,CalendarClock:GR,CalendarClockIcon:GR,CalendarCog:KR,CalendarCogIcon:KR,CalendarDays:sm,CalendarDaysIcon:sm,CalendarFold:ZR,CalendarFoldIcon:ZR,CalendarHeart:YR,CalendarHeartIcon:YR,CalendarIcon:li,CalendarMinus:QR,CalendarMinus2:XR,CalendarMinus2Icon:XR,CalendarMinusIcon:QR,CalendarOff:JR,CalendarOffIcon:JR,CalendarPlus:Gw,CalendarPlus2:eF,CalendarPlus2Icon:eF,CalendarPlusIcon:Gw,CalendarRange:tF,CalendarRangeIcon:tF,CalendarSearch:rF,CalendarSearchIcon:rF,CalendarSync:nF,CalendarSyncIcon:nF,CalendarX:iF,CalendarX2:sF,CalendarX2Icon:sF,CalendarXIcon:iF,Camera:Kw,CameraIcon:Kw,CameraOff:aF,CameraOffIcon:aF,CandlestickChart:m_,CandlestickChartIcon:m_,Candy:cF,CandyCane:oF,CandyCaneIcon:oF,CandyIcon:cF,CandyOff:lF,CandyOffIcon:lF,Cannabis:dF,CannabisIcon:dF,Captions:u_,CaptionsIcon:u_,CaptionsOff:uF,CaptionsOffIcon:uF,Car:pF,CarFront:hF,CarFrontIcon:hF,CarIcon:pF,CarTaxiFront:fF,CarTaxiFrontIcon:fF,Caravan:mF,CaravanIcon:mF,Carrot:gF,CarrotIcon:gF,CaseLower:xF,CaseLowerIcon:xF,CaseSensitive:yF,CaseSensitiveIcon:yF,CaseUpper:vF,CaseUpperIcon:vF,CassetteTape:_F,CassetteTapeIcon:_F,Cast:bF,CastIcon:bF,Castle:wF,CastleIcon:wF,Cat:jF,CatIcon:jF,Cctv:kF,CctvIcon:kF,ChartArea:h_,ChartAreaIcon:h_,ChartBar:p_,ChartBarBig:f_,ChartBarBigIcon:f_,ChartBarDecreasing:NF,ChartBarDecreasingIcon:NF,ChartBarIcon:p_,ChartBarIncreasing:SF,ChartBarIncreasingIcon:SF,ChartBarStacked:CF,ChartBarStackedIcon:CF,ChartCandlestick:m_,ChartCandlestickIcon:m_,ChartColumn:nc,ChartColumnBig:g_,ChartColumnBigIcon:g_,ChartColumnDecreasing:MF,ChartColumnDecreasingIcon:MF,ChartColumnIcon:nc,ChartColumnIncreasing:x_,ChartColumnIncreasingIcon:x_,ChartColumnStacked:TF,ChartColumnStackedIcon:TF,ChartGantt:AF,ChartGanttIcon:AF,ChartLine:y_,ChartLineIcon:y_,ChartNetwork:EF,ChartNetworkIcon:EF,ChartNoAxesColumn:__,ChartNoAxesColumnDecreasing:IF,ChartNoAxesColumnDecreasingIcon:IF,ChartNoAxesColumnIcon:__,ChartNoAxesColumnIncreasing:v_,ChartNoAxesColumnIncreasingIcon:v_,ChartNoAxesCombined:PF,ChartNoAxesCombinedIcon:PF,ChartNoAxesGantt:b_,ChartNoAxesGanttIcon:b_,ChartPie:w_,ChartPieIcon:w_,ChartScatter:j_,ChartScatterIcon:j_,ChartSpline:LF,ChartSplineIcon:LF,Check:$a,CheckCheck:OF,CheckCheckIcon:OF,CheckCircle:Ba,CheckCircle2:Ha,CheckCircle2Icon:Ha,CheckCircleIcon:Ba,CheckIcon:$a,CheckSquare:i0,CheckSquare2:db,CheckSquare2Icon:db,CheckSquareIcon:i0,ChefHat:DF,ChefHatIcon:DF,Cherry:RF,CherryIcon:RF,ChevronDown:Tu,ChevronDownCircle:I_,ChevronDownCircleIcon:I_,ChevronDownIcon:Tu,ChevronDownSquare:ub,ChevronDownSquareIcon:ub,ChevronFirst:FF,ChevronFirstIcon:FF,ChevronLast:zF,ChevronLastIcon:zF,ChevronLeft:id,ChevronLeftCircle:P_,ChevronLeftCircleIcon:P_,ChevronLeftIcon:id,ChevronLeftSquare:hb,ChevronLeftSquareIcon:hb,ChevronRight:Ka,ChevronRightCircle:L_,ChevronRightCircleIcon:L_,ChevronRightIcon:Ka,ChevronRightSquare:fb,ChevronRightSquareIcon:fb,ChevronUp:K0,ChevronUpCircle:O_,ChevronUpCircleIcon:O_,ChevronUpIcon:K0,ChevronUpSquare:pb,ChevronUpSquareIcon:pb,ChevronsDown:$F,ChevronsDownIcon:$F,ChevronsDownUp:BF,ChevronsDownUpIcon:BF,ChevronsLeft:VF,ChevronsLeftIcon:VF,ChevronsLeftRight:qF,ChevronsLeftRightEllipsis:UF,ChevronsLeftRightEllipsisIcon:UF,ChevronsLeftRightIcon:qF,ChevronsRight:WF,ChevronsRightIcon:WF,ChevronsRightLeft:HF,ChevronsRightLeftIcon:HF,ChevronsUp:GF,ChevronsUpDown:Zw,ChevronsUpDownIcon:Zw,ChevronsUpIcon:GF,Chrome:KF,ChromeIcon:KF,Church:ZF,ChurchIcon:ZF,Cigarette:XF,CigaretteIcon:XF,CigaretteOff:YF,CigaretteOffIcon:YF,Circle:Au,CircleAlert:Ul,CircleAlertIcon:Ul,CircleArrowDown:k_,CircleArrowDownIcon:k_,CircleArrowLeft:N_,CircleArrowLeftIcon:N_,CircleArrowOutDownLeft:S_,CircleArrowOutDownLeftIcon:S_,CircleArrowOutDownRight:C_,CircleArrowOutDownRightIcon:C_,CircleArrowOutUpLeft:M_,CircleArrowOutUpLeftIcon:M_,CircleArrowOutUpRight:T_,CircleArrowOutUpRightIcon:T_,CircleArrowRight:A_,CircleArrowRightIcon:A_,CircleArrowUp:E_,CircleArrowUpIcon:E_,CircleCheck:Ha,CircleCheckBig:Ba,CircleCheckBigIcon:Ba,CircleCheckIcon:Ha,CircleChevronDown:I_,CircleChevronDownIcon:I_,CircleChevronLeft:P_,CircleChevronLeftIcon:P_,CircleChevronRight:L_,CircleChevronRightIcon:L_,CircleChevronUp:O_,CircleChevronUpIcon:O_,CircleDashed:QF,CircleDashedIcon:QF,CircleDivide:D_,CircleDivideIcon:D_,CircleDollarSign:JF,CircleDollarSignIcon:JF,CircleDot:tz,CircleDotDashed:ez,CircleDotDashedIcon:ez,CircleDotIcon:tz,CircleEllipsis:rz,CircleEllipsisIcon:rz,CircleEqual:nz,CircleEqualIcon:nz,CircleFadingArrowUp:sz,CircleFadingArrowUpIcon:sz,CircleFadingPlus:iz,CircleFadingPlusIcon:iz,CircleGauge:R_,CircleGaugeIcon:R_,CircleHelp:xx,CircleHelpIcon:xx,CircleIcon:Au,CircleMinus:F_,CircleMinusIcon:F_,CircleOff:az,CircleOffIcon:az,CircleParking:B_,CircleParkingIcon:B_,CircleParkingOff:z_,CircleParkingOffIcon:z_,CirclePause:$_,CirclePauseIcon:$_,CirclePercent:U_,CirclePercentIcon:U_,CirclePlay:Af,CirclePlayIcon:Af,CirclePlus:q_,CirclePlusIcon:q_,CirclePower:V_,CirclePowerIcon:V_,CircleSlash:oz,CircleSlash2:H_,CircleSlash2Icon:H_,CircleSlashIcon:oz,CircleSlashed:H_,CircleSlashedIcon:H_,CircleStop:W_,CircleStopIcon:W_,CircleUser:K_,CircleUserIcon:K_,CircleUserRound:G_,CircleUserRoundIcon:G_,CircleX:Oc,CircleXIcon:Oc,CircuitBoard:lz,CircuitBoardIcon:lz,Citrus:cz,CitrusIcon:cz,Clapperboard:dz,ClapperboardIcon:dz,Clipboard:yz,ClipboardCheck:jT,ClipboardCheckIcon:jT,ClipboardCopy:uz,ClipboardCopyIcon:uz,ClipboardEdit:Y_,ClipboardEditIcon:Y_,ClipboardIcon:yz,ClipboardList:hz,ClipboardListIcon:hz,ClipboardMinus:fz,ClipboardMinusIcon:fz,ClipboardPaste:pz,ClipboardPasteIcon:pz,ClipboardPen:Y_,ClipboardPenIcon:Y_,ClipboardPenLine:Z_,ClipboardPenLineIcon:Z_,ClipboardPlus:mz,ClipboardPlusIcon:mz,ClipboardSignature:Z_,ClipboardSignatureIcon:Z_,ClipboardType:gz,ClipboardTypeIcon:gz,ClipboardX:xz,ClipboardXIcon:xz,Clock:Gi,Clock1:vz,Clock10:_z,Clock10Icon:_z,Clock11:bz,Clock11Icon:bz,Clock12:wz,Clock12Icon:wz,Clock1Icon:vz,Clock2:jz,Clock2Icon:jz,Clock3:kz,Clock3Icon:kz,Clock4:Nz,Clock4Icon:Nz,Clock5:Sz,Clock5Icon:Sz,Clock6:Cz,Clock6Icon:Cz,Clock7:Mz,Clock7Icon:Mz,Clock8:Tz,Clock8Icon:Tz,Clock9:Az,Clock9Icon:Az,ClockAlert:Ez,ClockAlertIcon:Ez,ClockArrowDown:Iz,ClockArrowDownIcon:Iz,ClockArrowUp:Pz,ClockArrowUpIcon:Pz,ClockIcon:Gi,Cloud:Kz,CloudAlert:Lz,CloudAlertIcon:Lz,CloudCog:Oz,CloudCogIcon:Oz,CloudDownload:X_,CloudDownloadIcon:X_,CloudDrizzle:Dz,CloudDrizzleIcon:Dz,CloudFog:Rz,CloudFogIcon:Rz,CloudHail:Fz,CloudHailIcon:Fz,CloudIcon:Kz,CloudLightning:zz,CloudLightningIcon:zz,CloudMoon:$z,CloudMoonIcon:$z,CloudMoonRain:Bz,CloudMoonRainIcon:Bz,CloudOff:Uz,CloudOffIcon:Uz,CloudRain:Vz,CloudRainIcon:Vz,CloudRainWind:qz,CloudRainWindIcon:qz,CloudSnow:Hz,CloudSnowIcon:Hz,CloudSun:Gz,CloudSunIcon:Gz,CloudSunRain:Wz,CloudSunRainIcon:Wz,CloudUpload:Q_,CloudUploadIcon:Q_,Cloudy:Zz,CloudyIcon:Zz,Clover:Nx,CloverIcon:Nx,Club:Yz,ClubIcon:Yz,Code:Yw,Code2:J_,Code2Icon:J_,CodeIcon:Yw,CodeSquare:mb,CodeSquareIcon:mb,CodeXml:J_,CodeXmlIcon:J_,Codepen:Xz,CodepenIcon:Xz,Codesandbox:Qz,CodesandboxIcon:Qz,Coffee:Xw,CoffeeIcon:Xw,Cog:Jz,CogIcon:Jz,Coins:e7,CoinsIcon:e7,Columns:e2,Columns2:e2,Columns2Icon:e2,Columns3:t2,Columns3Icon:t2,Columns4:t7,Columns4Icon:t7,ColumnsIcon:e2,Combine:r7,CombineIcon:r7,Command:n7,CommandIcon:n7,Compass:s7,CompassIcon:s7,Component:i7,ComponentIcon:i7,Computer:a7,ComputerIcon:a7,ConciergeBell:o7,ConciergeBellIcon:o7,Cone:l7,ConeIcon:l7,Construction:c7,ConstructionIcon:c7,Contact:d7,Contact2:r2,Contact2Icon:r2,ContactIcon:d7,ContactRound:r2,ContactRoundIcon:r2,Container:u7,ContainerIcon:u7,Contrast:h7,ContrastIcon:h7,Cookie:f7,CookieIcon:f7,CookingPot:p7,CookingPotIcon:p7,Copy:Vl,CopyCheck:m7,CopyCheckIcon:m7,CopyIcon:Vl,CopyMinus:g7,CopyMinusIcon:g7,CopyPlus:x7,CopyPlusIcon:x7,CopySlash:y7,CopySlashIcon:y7,CopyX:v7,CopyXIcon:v7,Copyleft:_7,CopyleftIcon:_7,Copyright:b7,CopyrightIcon:b7,CornerDownLeft:w7,CornerDownLeftIcon:w7,CornerDownRight:j7,CornerDownRightIcon:j7,CornerLeftDown:k7,CornerLeftDownIcon:k7,CornerLeftUp:N7,CornerLeftUpIcon:N7,CornerRightDown:S7,CornerRightDownIcon:S7,CornerRightUp:C7,CornerRightUpIcon:C7,CornerUpLeft:M7,CornerUpLeftIcon:M7,CornerUpRight:T7,CornerUpRightIcon:T7,Cpu:A7,CpuIcon:A7,CreativeCommons:E7,CreativeCommonsIcon:E7,CreditCard:Z0,CreditCardIcon:Z0,Croissant:I7,CroissantIcon:I7,Crop:P7,CropIcon:P7,Cross:L7,CrossIcon:L7,Crosshair:O7,CrosshairIcon:O7,Crown:Y0,CrownIcon:Y0,Cuboid:D7,CuboidIcon:D7,CupSoda:R7,CupSodaIcon:R7,CurlyBraces:d_,CurlyBracesIcon:d_,Currency:F7,CurrencyIcon:F7,Cylinder:z7,CylinderIcon:z7,Dam:B7,DamIcon:B7,Database:q7,DatabaseBackup:$7,DatabaseBackupIcon:$7,DatabaseIcon:q7,DatabaseZap:U7,DatabaseZapIcon:U7,Delete:V7,DeleteIcon:V7,Dessert:H7,DessertIcon:H7,Diameter:W7,DiameterIcon:W7,Diamond:Z7,DiamondIcon:Z7,DiamondMinus:G7,DiamondMinusIcon:G7,DiamondPercent:n2,DiamondPercentIcon:n2,DiamondPlus:K7,DiamondPlusIcon:K7,Dice1:Y7,Dice1Icon:Y7,Dice2:X7,Dice2Icon:X7,Dice3:Q7,Dice3Icon:Q7,Dice4:J7,Dice4Icon:J7,Dice5:eB,Dice5Icon:eB,Dice6:tB,Dice6Icon:tB,Dices:rB,DicesIcon:rB,Diff:nB,DiffIcon:nB,Disc:oB,Disc2:sB,Disc2Icon:sB,Disc3:iB,Disc3Icon:iB,DiscAlbum:aB,DiscAlbumIcon:aB,DiscIcon:oB,Divide:lB,DivideCircle:D_,DivideCircleIcon:D_,DivideIcon:lB,DivideSquare:vb,DivideSquareIcon:vb,Dna:dB,DnaIcon:dB,DnaOff:cB,DnaOffIcon:cB,Dock:uB,DockIcon:uB,Dog:hB,DogIcon:hB,DollarSign:ad,DollarSignIcon:ad,Donut:fB,DonutIcon:fB,DoorClosed:pB,DoorClosedIcon:pB,DoorOpen:X0,DoorOpenIcon:X0,Dot:mB,DotIcon:mB,DotSquare:_b,DotSquareIcon:_b,Download:Mo,DownloadCloud:X_,DownloadCloudIcon:X_,DownloadIcon:Mo,DraftingCompass:gB,DraftingCompassIcon:gB,Drama:xB,DramaIcon:xB,Dribbble:yB,DribbbleIcon:yB,Drill:vB,DrillIcon:vB,Droplet:_B,DropletIcon:_B,Droplets:bB,DropletsIcon:bB,Drum:wB,DrumIcon:wB,Drumstick:jB,DrumstickIcon:jB,Dumbbell:kB,DumbbellIcon:kB,Ear:SB,EarIcon:SB,EarOff:NB,EarOffIcon:NB,Earth:s2,EarthIcon:s2,EarthLock:CB,EarthLockIcon:CB,Eclipse:MB,EclipseIcon:MB,Edit:Jl,Edit2:s0,Edit2Icon:s0,Edit3:z2,Edit3Icon:z2,EditIcon:Jl,Egg:WS,EggFried:TB,EggFriedIcon:TB,EggIcon:WS,EggOff:AB,EggOffIcon:AB,Ellipsis:Jm,EllipsisIcon:Jm,EllipsisVertical:yx,EllipsisVerticalIcon:yx,Equal:PB,EqualApproximately:EB,EqualApproximatelyIcon:EB,EqualIcon:PB,EqualNot:IB,EqualNotIcon:IB,EqualSquare:bb,EqualSquareIcon:bb,Eraser:LB,EraserIcon:LB,EthernetPort:OB,EthernetPortIcon:OB,Euro:DB,EuroIcon:DB,Expand:RB,ExpandIcon:RB,ExternalLink:$s,ExternalLinkIcon:$s,Eye:Al,EyeClosed:FB,EyeClosedIcon:FB,EyeIcon:Al,EyeOff:Qw,EyeOffIcon:Qw,Facebook:Td,FacebookIcon:Td,Factory:zB,FactoryIcon:zB,Fan:BB,FanIcon:BB,FastForward:$B,FastForwardIcon:$B,Feather:UB,FeatherIcon:UB,Fence:qB,FenceIcon:qB,FerrisWheel:VB,FerrisWheelIcon:VB,Figma:HB,FigmaIcon:HB,File:z9,FileArchive:WB,FileArchiveIcon:WB,FileAudio:KB,FileAudio2:GB,FileAudio2Icon:GB,FileAudioIcon:KB,FileAxis3D:i2,FileAxis3DIcon:i2,FileAxis3d:i2,FileAxis3dIcon:i2,FileBadge:YB,FileBadge2:ZB,FileBadge2Icon:ZB,FileBadgeIcon:YB,FileBarChart:a2,FileBarChart2:o2,FileBarChart2Icon:o2,FileBarChartIcon:a2,FileBox:XB,FileBoxIcon:XB,FileChartColumn:o2,FileChartColumnIcon:o2,FileChartColumnIncreasing:a2,FileChartColumnIncreasingIcon:a2,FileChartLine:l2,FileChartLineIcon:l2,FileChartPie:c2,FileChartPieIcon:c2,FileCheck:JB,FileCheck2:QB,FileCheck2Icon:QB,FileCheckIcon:JB,FileClock:e9,FileClockIcon:e9,FileCode:r9,FileCode2:t9,FileCode2Icon:t9,FileCodeIcon:r9,FileCog:d2,FileCog2:d2,FileCog2Icon:d2,FileCogIcon:d2,FileDiff:n9,FileDiffIcon:n9,FileDigit:s9,FileDigitIcon:s9,FileDown:i9,FileDownIcon:i9,FileEdit:h2,FileEditIcon:h2,FileHeart:a9,FileHeartIcon:a9,FileIcon:z9,FileImage:Q0,FileImageIcon:Q0,FileInput:o9,FileInputIcon:o9,FileJson:c9,FileJson2:l9,FileJson2Icon:l9,FileJsonIcon:c9,FileKey:u9,FileKey2:d9,FileKey2Icon:d9,FileKeyIcon:u9,FileLineChart:l2,FileLineChartIcon:l2,FileLock:f9,FileLock2:h9,FileLock2Icon:h9,FileLockIcon:f9,FileMinus:m9,FileMinus2:p9,FileMinus2Icon:p9,FileMinusIcon:m9,FileMusic:g9,FileMusicIcon:g9,FileOutput:x9,FileOutputIcon:x9,FilePen:h2,FilePenIcon:h2,FilePenLine:u2,FilePenLineIcon:u2,FilePieChart:c2,FilePieChartIcon:c2,FilePlus:v9,FilePlus2:y9,FilePlus2Icon:y9,FilePlusIcon:v9,FileQuestion:_9,FileQuestionIcon:_9,FileScan:b9,FileScanIcon:b9,FileSearch:j9,FileSearch2:w9,FileSearch2Icon:w9,FileSearchIcon:j9,FileSignature:u2,FileSignatureIcon:u2,FileSliders:k9,FileSlidersIcon:k9,FileSpreadsheet:J0,FileSpreadsheetIcon:J0,FileStack:N9,FileStackIcon:N9,FileSymlink:S9,FileSymlinkIcon:S9,FileTerminal:C9,FileTerminalIcon:C9,FileText:Si,FileTextIcon:Si,FileType:T9,FileType2:M9,FileType2Icon:M9,FileTypeIcon:T9,FileUp:A9,FileUpIcon:A9,FileUser:E9,FileUserIcon:E9,FileVideo:P9,FileVideo2:I9,FileVideo2Icon:I9,FileVideoIcon:P9,FileVolume:O9,FileVolume2:L9,FileVolume2Icon:L9,FileVolumeIcon:O9,FileWarning:D9,FileWarningIcon:D9,FileX:F9,FileX2:R9,FileX2Icon:R9,FileXIcon:F9,Files:B9,FilesIcon:B9,Film:kd,FilmIcon:kd,Filter:Jw,FilterIcon:Jw,FilterX:$9,FilterXIcon:$9,Fingerprint:U9,FingerprintIcon:U9,FireExtinguisher:q9,FireExtinguisherIcon:q9,Fish:W9,FishIcon:W9,FishOff:V9,FishOffIcon:V9,FishSymbol:H9,FishSymbolIcon:H9,Flag:Px,FlagIcon:Px,FlagOff:G9,FlagOffIcon:G9,FlagTriangleLeft:K9,FlagTriangleLeftIcon:K9,FlagTriangleRight:Z9,FlagTriangleRightIcon:Z9,Flame:qh,FlameIcon:qh,FlameKindling:Y9,FlameKindlingIcon:Y9,Flashlight:Q9,FlashlightIcon:Q9,FlashlightOff:X9,FlashlightOffIcon:X9,FlaskConical:ej,FlaskConicalIcon:ej,FlaskConicalOff:J9,FlaskConicalOffIcon:J9,FlaskRound:e$,FlaskRoundIcon:e$,FlipHorizontal:r$,FlipHorizontal2:t$,FlipHorizontal2Icon:t$,FlipHorizontalIcon:r$,FlipVertical:s$,FlipVertical2:n$,FlipVertical2Icon:n$,FlipVerticalIcon:s$,Flower:i$,Flower2:Qp,Flower2Icon:Qp,FlowerIcon:i$,Focus:a$,FocusIcon:a$,FoldHorizontal:o$,FoldHorizontalIcon:o$,FoldVertical:l$,FoldVerticalIcon:l$,Folder:O$,FolderArchive:c$,FolderArchiveIcon:c$,FolderCheck:d$,FolderCheckIcon:d$,FolderClock:u$,FolderClockIcon:u$,FolderClosed:h$,FolderClosedIcon:h$,FolderCode:f$,FolderCodeIcon:f$,FolderCog:f2,FolderCog2:f2,FolderCog2Icon:f2,FolderCogIcon:f2,FolderDot:p$,FolderDotIcon:p$,FolderDown:m$,FolderDownIcon:m$,FolderEdit:p2,FolderEditIcon:p2,FolderGit:x$,FolderGit2:g$,FolderGit2Icon:g$,FolderGitIcon:x$,FolderHeart:y$,FolderHeartIcon:y$,FolderIcon:O$,FolderInput:v$,FolderInputIcon:v$,FolderKanban:_$,FolderKanbanIcon:_$,FolderKey:b$,FolderKeyIcon:b$,FolderLock:w$,FolderLockIcon:w$,FolderMinus:j$,FolderMinusIcon:j$,FolderOpen:Lx,FolderOpenDot:k$,FolderOpenDotIcon:k$,FolderOpenIcon:Lx,FolderOutput:N$,FolderOutputIcon:N$,FolderPen:p2,FolderPenIcon:p2,FolderPlus:S$,FolderPlusIcon:S$,FolderRoot:C$,FolderRootIcon:C$,FolderSearch:T$,FolderSearch2:M$,FolderSearch2Icon:M$,FolderSearchIcon:T$,FolderSymlink:A$,FolderSymlinkIcon:A$,FolderSync:E$,FolderSyncIcon:E$,FolderTree:I$,FolderTreeIcon:I$,FolderUp:P$,FolderUpIcon:P$,FolderX:L$,FolderXIcon:L$,Folders:D$,FoldersIcon:D$,Footprints:R$,FootprintsIcon:R$,ForkKnife:aw,ForkKnifeCrossed:iw,ForkKnifeCrossedIcon:iw,ForkKnifeIcon:aw,Forklift:F$,ForkliftIcon:F$,FormInput:$2,FormInputIcon:$2,Forward:z$,ForwardIcon:z$,Frame:B$,FrameIcon:B$,Framer:$$,FramerIcon:$$,Frown:U$,FrownIcon:U$,Fuel:q$,FuelIcon:q$,Fullscreen:V$,FullscreenIcon:V$,FunctionSquare:wb,FunctionSquareIcon:wb,GalleryHorizontal:W$,GalleryHorizontalEnd:H$,GalleryHorizontalEndIcon:H$,GalleryHorizontalIcon:W$,GalleryThumbnails:G$,GalleryThumbnailsIcon:G$,GalleryVertical:Z$,GalleryVerticalEnd:K$,GalleryVerticalEndIcon:K$,GalleryVerticalIcon:Z$,Gamepad:X$,Gamepad2:Y$,Gamepad2Icon:Y$,GamepadIcon:X$,GanttChart:b_,GanttChartIcon:b_,GanttChartSquare:Vm,GanttChartSquareIcon:Vm,Gauge:Q$,GaugeCircle:R_,GaugeCircleIcon:R_,GaugeIcon:Q$,Gavel:J$,GavelIcon:J$,Gem:eU,GemIcon:eU,Ghost:tj,GhostIcon:tj,Gift:Ua,GiftIcon:Ua,GitBranch:rU,GitBranchIcon:rU,GitBranchPlus:tU,GitBranchPlusIcon:tU,GitCommit:m2,GitCommitHorizontal:m2,GitCommitHorizontalIcon:m2,GitCommitIcon:m2,GitCommitVertical:nU,GitCommitVerticalIcon:nU,GitCompare:iU,GitCompareArrows:sU,GitCompareArrowsIcon:sU,GitCompareIcon:iU,GitFork:aU,GitForkIcon:aU,GitGraph:oU,GitGraphIcon:oU,GitMerge:lU,GitMergeIcon:lU,GitPullRequest:pU,GitPullRequestArrow:cU,GitPullRequestArrowIcon:cU,GitPullRequestClosed:dU,GitPullRequestClosedIcon:dU,GitPullRequestCreate:hU,GitPullRequestCreateArrow:uU,GitPullRequestCreateArrowIcon:uU,GitPullRequestCreateIcon:hU,GitPullRequestDraft:fU,GitPullRequestDraftIcon:fU,GitPullRequestIcon:pU,Github:mU,GithubIcon:mU,Gitlab:gU,GitlabIcon:gU,GlassWater:xU,GlassWaterIcon:xU,Glasses:yU,GlassesIcon:yU,Globe:rj,Globe2:s2,Globe2Icon:s2,GlobeIcon:rj,GlobeLock:vU,GlobeLockIcon:vU,Goal:_U,GoalIcon:_U,Grab:bU,GrabIcon:bU,GraduationCap:e1,GraduationCapIcon:e1,Grape:wU,GrapeIcon:wU,Grid:Ah,Grid2X2:x2,Grid2X2Icon:x2,Grid2X2Plus:g2,Grid2X2PlusIcon:g2,Grid2x2:x2,Grid2x2Check:jU,Grid2x2CheckIcon:jU,Grid2x2Icon:x2,Grid2x2Plus:g2,Grid2x2PlusIcon:g2,Grid2x2X:kU,Grid2x2XIcon:kU,Grid3X3:Ah,Grid3X3Icon:Ah,Grid3x3:Ah,Grid3x3Icon:Ah,GridIcon:Ah,Grip:SU,GripHorizontal:NU,GripHorizontalIcon:NU,GripIcon:SU,GripVertical:GS,GripVerticalIcon:GS,Group:CU,GroupIcon:CU,Guitar:MU,GuitarIcon:MU,Ham:TU,HamIcon:TU,Hammer:AU,HammerIcon:AU,Hand:OU,HandCoins:EU,HandCoinsIcon:EU,HandHeart:IU,HandHeartIcon:IU,HandHelping:y2,HandHelpingIcon:y2,HandIcon:OU,HandMetal:PU,HandMetalIcon:PU,HandPlatter:LU,HandPlatterIcon:LU,Handshake:DU,HandshakeIcon:DU,HardDrive:kT,HardDriveDownload:RU,HardDriveDownloadIcon:RU,HardDriveIcon:kT,HardDriveUpload:FU,HardDriveUploadIcon:FU,HardHat:zU,HardHatIcon:zU,Hash:KS,HashIcon:KS,Haze:BU,HazeIcon:BU,HdmiPort:$U,HdmiPortIcon:$U,Heading:WU,Heading1:NT,Heading1Icon:NT,Heading2:ST,Heading2Icon:ST,Heading3:UU,Heading3Icon:UU,Heading4:qU,Heading4Icon:qU,Heading5:VU,Heading5Icon:VU,Heading6:HU,Heading6Icon:HU,HeadingIcon:WU,HeadphoneOff:GU,HeadphoneOffIcon:GU,Headphones:KU,HeadphonesIcon:KU,Headset:ZU,HeadsetIcon:ZU,Heart:oa,HeartCrack:YU,HeartCrackIcon:YU,HeartHandshake:XU,HeartHandshakeIcon:XU,HeartIcon:oa,HeartOff:QU,HeartOffIcon:QU,HeartPulse:JU,HeartPulseIcon:JU,Heater:eq,HeaterIcon:eq,HelpCircle:xx,HelpCircleIcon:xx,HelpingHand:y2,HelpingHandIcon:y2,Hexagon:tq,HexagonIcon:tq,Highlighter:rq,HighlighterIcon:rq,History:ZS,HistoryIcon:ZS,Home:ui,HomeIcon:ui,Hop:sq,HopIcon:sq,HopOff:nq,HopOffIcon:nq,Hospital:iq,HospitalIcon:iq,Hotel:aq,HotelIcon:aq,Hourglass:oq,HourglassIcon:oq,House:ui,HouseIcon:ui,HousePlug:lq,HousePlugIcon:lq,HousePlus:cq,HousePlusIcon:cq,IceCream:_2,IceCream2:v2,IceCream2Icon:v2,IceCreamBowl:v2,IceCreamBowlIcon:v2,IceCreamCone:_2,IceCreamConeIcon:_2,IceCreamIcon:_2,Icon:dAe,IdCard:dq,IdCardIcon:dq,Image:Wo,ImageDown:uq,ImageDownIcon:uq,ImageIcon:Wo,ImageMinus:hq,ImageMinusIcon:hq,ImageOff:fq,ImageOffIcon:fq,ImagePlay:pq,ImagePlayIcon:pq,ImagePlus:YS,ImagePlusIcon:YS,ImageUp:mq,ImageUpIcon:mq,ImageUpscale:gq,ImageUpscaleIcon:gq,Images:xq,ImagesIcon:xq,Import:yq,ImportIcon:yq,Inbox:vq,InboxIcon:vq,Indent:w2,IndentDecrease:b2,IndentDecreaseIcon:b2,IndentIcon:w2,IndentIncrease:w2,IndentIncreaseIcon:w2,IndianRupee:_q,IndianRupeeIcon:_q,Infinity:bq,InfinityIcon:bq,Info:wq,InfoIcon:wq,Inspect:Mb,InspectIcon:Mb,InspectionPanel:jq,InspectionPanelIcon:jq,Instagram:Zd,InstagramIcon:Zd,Italic:XS,ItalicIcon:XS,IterationCcw:kq,IterationCcwIcon:kq,IterationCw:Nq,IterationCwIcon:Nq,JapaneseYen:Sq,JapaneseYenIcon:Sq,Joystick:Cq,JoystickIcon:Cq,Kanban:t1,KanbanIcon:t1,KanbanSquare:jb,KanbanSquareDashed:gb,KanbanSquareDashedIcon:gb,KanbanSquareIcon:jb,Key:Vh,KeyIcon:Vh,KeyRound:nj,KeyRoundIcon:nj,KeySquare:Mq,KeySquareIcon:Mq,Keyboard:Eq,KeyboardIcon:Eq,KeyboardMusic:Tq,KeyboardMusicIcon:Tq,KeyboardOff:Aq,KeyboardOffIcon:Aq,Lamp:Rq,LampCeiling:Iq,LampCeilingIcon:Iq,LampDesk:Pq,LampDeskIcon:Pq,LampFloor:Lq,LampFloorIcon:Lq,LampIcon:Rq,LampWallDown:Oq,LampWallDownIcon:Oq,LampWallUp:Dq,LampWallUpIcon:Dq,LandPlot:Fq,LandPlotIcon:Fq,Landmark:zq,LandmarkIcon:zq,Languages:Bq,LanguagesIcon:Bq,Laptop:Uq,Laptop2:j2,Laptop2Icon:j2,LaptopIcon:Uq,LaptopMinimal:j2,LaptopMinimalCheck:$q,LaptopMinimalCheckIcon:$q,LaptopMinimalIcon:j2,Lasso:Vq,LassoIcon:Vq,LassoSelect:qq,LassoSelectIcon:qq,Laugh:Hq,LaughIcon:Hq,Layers:Kq,Layers2:Wq,Layers2Icon:Wq,Layers3:Gq,Layers3Icon:Gq,LayersIcon:Kq,Layout:n0,LayoutDashboard:QS,LayoutDashboardIcon:QS,LayoutGrid:im,LayoutGridIcon:im,LayoutIcon:n0,LayoutList:Zq,LayoutListIcon:Zq,LayoutPanelLeft:Yq,LayoutPanelLeftIcon:Yq,LayoutPanelTop:Xq,LayoutPanelTopIcon:Xq,LayoutTemplate:Qq,LayoutTemplateIcon:Qq,Leaf:Jq,LeafIcon:Jq,LeafyGreen:eV,LeafyGreenIcon:eV,Lectern:tV,LecternIcon:tV,LetterText:rV,LetterTextIcon:rV,Library:JS,LibraryBig:nV,LibraryBigIcon:nV,LibraryIcon:JS,LibrarySquare:kb,LibrarySquareIcon:kb,LifeBuoy:e4,LifeBuoyIcon:e4,Ligature:sV,LigatureIcon:sV,Lightbulb:r1,LightbulbIcon:r1,LightbulbOff:iV,LightbulbOffIcon:iV,LineChart:y_,LineChartIcon:y_,Link:bo,Link2:Bf,Link2Icon:Bf,Link2Off:aV,Link2OffIcon:aV,LinkIcon:bo,Linkedin:am,LinkedinIcon:am,List:$f,ListCheck:oV,ListCheckIcon:oV,ListChecks:lV,ListChecksIcon:lV,ListCollapse:cV,ListCollapseIcon:cV,ListEnd:dV,ListEndIcon:dV,ListFilter:uV,ListFilterIcon:uV,ListIcon:$f,ListMinus:hV,ListMinusIcon:hV,ListMusic:fV,ListMusicIcon:fV,ListOrdered:t4,ListOrderedIcon:t4,ListPlus:pV,ListPlusIcon:pV,ListRestart:mV,ListRestartIcon:mV,ListStart:gV,ListStartIcon:gV,ListTodo:xV,ListTodoIcon:xV,ListTree:yV,ListTreeIcon:yV,ListVideo:vV,ListVideoIcon:vV,ListX:_V,ListXIcon:_V,Loader:wV,Loader2:sn,Loader2Icon:sn,LoaderCircle:sn,LoaderCircleIcon:sn,LoaderIcon:wV,LoaderPinwheel:bV,LoaderPinwheelIcon:bV,Locate:CT,LocateFixed:jV,LocateFixedIcon:jV,LocateIcon:CT,LocateOff:kV,LocateOffIcon:kV,Lock:Uf,LockIcon:Uf,LockKeyhole:NV,LockKeyholeIcon:NV,LockKeyholeOpen:k2,LockKeyholeOpenIcon:k2,LockOpen:N2,LockOpenIcon:N2,LogIn:r4,LogInIcon:r4,LogOut:n4,LogOutIcon:n4,Logs:SV,LogsIcon:SV,Lollipop:CV,LollipopIcon:CV,LucideAArrowDown:iO,LucideAArrowUp:aO,LucideALargeSmall:oO,LucideAccessibility:lO,LucideActivity:cg,LucideActivitySquare:Z2,LucideAirVent:cO,LucideAirplay:dO,LucideAlarmCheck:Yv,LucideAlarmClock:hO,LucideAlarmClockCheck:Yv,LucideAlarmClockMinus:Xv,LucideAlarmClockOff:uO,LucideAlarmClockPlus:Qv,LucideAlarmMinus:Xv,LucideAlarmPlus:Qv,LucideAlarmSmoke:fO,LucideAlbum:pO,LucideAlertCircle:Ul,LucideAlertOctagon:M2,LucideAlertTriangle:Lh,LucideAlignCenter:BS,LucideAlignCenterHorizontal:mO,LucideAlignCenterVertical:gO,LucideAlignEndHorizontal:xO,LucideAlignEndVertical:yO,LucideAlignHorizontalDistributeCenter:vO,LucideAlignHorizontalDistributeEnd:_O,LucideAlignHorizontalDistributeStart:bO,LucideAlignHorizontalJustifyCenter:wO,LucideAlignHorizontalJustifyEnd:jO,LucideAlignHorizontalJustifyStart:kO,LucideAlignHorizontalSpaceAround:NO,LucideAlignHorizontalSpaceBetween:SO,LucideAlignJustify:CO,LucideAlignLeft:$S,LucideAlignRight:US,LucideAlignStartHorizontal:MO,LucideAlignStartVertical:TO,LucideAlignVerticalDistributeCenter:AO,LucideAlignVerticalDistributeEnd:EO,LucideAlignVerticalDistributeStart:IO,LucideAlignVerticalJustifyCenter:PO,LucideAlignVerticalJustifyEnd:LO,LucideAlignVerticalJustifyStart:OO,LucideAlignVerticalSpaceAround:DO,LucideAlignVerticalSpaceBetween:RO,LucideAmbulance:FO,LucideAmpersand:zO,LucideAmpersands:BO,LucideAmphora:$O,LucideAnchor:UO,LucideAngry:qO,LucideAnnoyed:VO,LucideAntenna:HO,LucideAnvil:WO,LucideAperture:GO,LucideAppWindow:_T,LucideAppWindowMac:KO,LucideApple:ZO,LucideArchive:QO,LucideArchiveRestore:YO,LucideArchiveX:XO,LucideAreaChart:h_,LucideArmchair:JO,LucideArrowBigDown:t8,LucideArrowBigDownDash:e8,LucideArrowBigLeft:n8,LucideArrowBigLeftDash:r8,LucideArrowBigRight:i8,LucideArrowBigRightDash:s8,LucideArrowBigUp:o8,LucideArrowBigUpDash:a8,LucideArrowDown:Hw,LucideArrowDown01:l8,LucideArrowDown10:c8,LucideArrowDownAZ:Jv,LucideArrowDownAz:Jv,LucideArrowDownCircle:k_,LucideArrowDownFromLine:d8,LucideArrowDownLeft:u8,LucideArrowDownLeftFromCircle:S_,LucideArrowDownLeftFromSquare:eb,LucideArrowDownLeftSquare:Y2,LucideArrowDownNarrowWide:h8,LucideArrowDownRight:f8,LucideArrowDownRightFromCircle:C_,LucideArrowDownRightFromSquare:tb,LucideArrowDownRightSquare:X2,LucideArrowDownSquare:Q2,LucideArrowDownToDot:p8,LucideArrowDownToLine:m8,LucideArrowDownUp:g8,LucideArrowDownWideNarrow:e_,LucideArrowDownZA:t_,LucideArrowDownZa:t_,LucideArrowLeft:Ga,LucideArrowLeftCircle:N_,LucideArrowLeftFromLine:x8,LucideArrowLeftRight:y8,LucideArrowLeftSquare:J2,LucideArrowLeftToLine:v8,LucideArrowRight:Ho,LucideArrowRightCircle:A_,LucideArrowRightFromLine:_8,LucideArrowRightLeft:b8,LucideArrowRightSquare:sb,LucideArrowRightToLine:w8,LucideArrowUp:Ix,LucideArrowUp01:j8,LucideArrowUp10:k8,LucideArrowUpAZ:r_,LucideArrowUpAz:r_,LucideArrowUpCircle:E_,LucideArrowUpDown:Ex,LucideArrowUpFromDot:N8,LucideArrowUpFromLine:S8,LucideArrowUpLeft:C8,LucideArrowUpLeftFromCircle:M_,LucideArrowUpLeftFromSquare:rb,LucideArrowUpLeftSquare:ib,LucideArrowUpNarrowWide:n_,LucideArrowUpRight:M8,LucideArrowUpRightFromCircle:T_,LucideArrowUpRightFromSquare:nb,LucideArrowUpRightSquare:ab,LucideArrowUpSquare:ob,LucideArrowUpToLine:T8,LucideArrowUpWideNarrow:A8,LucideArrowUpZA:s_,LucideArrowUpZa:s_,LucideArrowsUpFromLine:E8,LucideAsterisk:I8,LucideAsteriskSquare:lb,LucideAtSign:P8,LucideAtom:L8,LucideAudioLines:O8,LucideAudioWaveform:D8,LucideAward:Ml,LucideAxe:R8,LucideAxis3D:i_,LucideAxis3d:i_,LucideBaby:F8,LucideBackpack:z8,LucideBadge:tD,LucideBadgeAlert:B8,LucideBadgeCent:$8,LucideBadgeCheck:a_,LucideBadgeDollarSign:U8,LucideBadgeEuro:q8,LucideBadgeHelp:V8,LucideBadgeIndianRupee:H8,LucideBadgeInfo:W8,LucideBadgeJapaneseYen:G8,LucideBadgeMinus:K8,LucideBadgePercent:Z8,LucideBadgePlus:Y8,LucideBadgePoundSterling:X8,LucideBadgeRussianRuble:Q8,LucideBadgeSwissFranc:J8,LucideBadgeX:eD,LucideBaggageClaim:rD,LucideBan:nD,LucideBanana:sD,LucideBandage:iD,LucideBanknote:aD,LucideBarChart:v_,LucideBarChart2:__,LucideBarChart3:nc,LucideBarChart4:x_,LucideBarChartBig:g_,LucideBarChartHorizontal:p_,LucideBarChartHorizontalBig:f_,LucideBarcode:oD,LucideBaseline:lD,LucideBath:Ff,LucideBattery:pD,LucideBatteryCharging:cD,LucideBatteryFull:dD,LucideBatteryLow:uD,LucideBatteryMedium:hD,LucideBatteryWarning:fD,LucideBeaker:mD,LucideBean:xD,LucideBeanOff:gD,LucideBed:zf,LucideBedDouble:yD,LucideBedSingle:vD,LucideBeef:_D,LucideBeer:wD,LucideBeerOff:bD,LucideBell:dg,LucideBellDot:jD,LucideBellElectric:kD,LucideBellMinus:ND,LucideBellOff:Ww,LucideBellPlus:SD,LucideBellRing:CD,LucideBetweenHorizonalEnd:o_,LucideBetweenHorizonalStart:l_,LucideBetweenHorizontalEnd:o_,LucideBetweenHorizontalStart:l_,LucideBetweenVerticalEnd:MD,LucideBetweenVerticalStart:TD,LucideBicepsFlexed:AD,LucideBike:ED,LucideBinary:ID,LucideBinoculars:PD,LucideBiohazard:LD,LucideBird:OD,LucideBitcoin:DD,LucideBlend:RD,LucideBlinds:FD,LucideBlocks:zD,LucideBluetooth:qD,LucideBluetoothConnected:BD,LucideBluetoothOff:$D,LucideBluetoothSearching:UD,LucideBold:qS,LucideBolt:VD,LucideBomb:HD,LucideBone:WD,LucideBook:pR,LucideBookA:GD,LucideBookAudio:KD,LucideBookCheck:ZD,LucideBookCopy:YD,LucideBookDashed:c_,LucideBookDown:XD,LucideBookHeadphones:QD,LucideBookHeart:JD,LucideBookImage:eR,LucideBookKey:tR,LucideBookLock:rR,LucideBookMarked:nR,LucideBookMinus:sR,LucideBookOpen:bT,LucideBookOpenCheck:iR,LucideBookOpenText:aR,LucideBookPlus:oR,LucideBookTemplate:c_,LucideBookText:lR,LucideBookType:cR,LucideBookUp:uR,LucideBookUp2:dR,LucideBookUser:hR,LucideBookX:fR,LucideBookmark:nm,LucideBookmarkCheck:mR,LucideBookmarkMinus:gR,LucideBookmarkPlus:xR,LucideBookmarkX:yR,LucideBoomBox:vR,LucideBot:VS,LucideBotMessageSquare:_R,LucideBotOff:bR,LucideBox:wR,LucideBoxSelect:yb,LucideBoxes:jR,LucideBraces:d_,LucideBrackets:kR,LucideBrain:wT,LucideBrainCircuit:NR,LucideBrainCog:SR,LucideBrickWall:CR,LucideBriefcase:hh,LucideBriefcaseBusiness:MR,LucideBriefcaseConveyorBelt:TR,LucideBriefcaseMedical:AR,LucideBringToFront:ER,LucideBrush:IR,LucideBug:OR,LucideBugOff:PR,LucideBugPlay:LR,LucideBuilding:HS,LucideBuilding2:na,LucideBus:RR,LucideBusFront:DR,LucideCable:zR,LucideCableCar:FR,LucideCake:Uh,LucideCakeSlice:BR,LucideCalculator:$R,LucideCalendar:li,LucideCalendar1:UR,LucideCalendarArrowDown:qR,LucideCalendarArrowUp:VR,LucideCalendarCheck:WR,LucideCalendarCheck2:HR,LucideCalendarClock:GR,LucideCalendarCog:KR,LucideCalendarDays:sm,LucideCalendarFold:ZR,LucideCalendarHeart:YR,LucideCalendarMinus:QR,LucideCalendarMinus2:XR,LucideCalendarOff:JR,LucideCalendarPlus:Gw,LucideCalendarPlus2:eF,LucideCalendarRange:tF,LucideCalendarSearch:rF,LucideCalendarSync:nF,LucideCalendarX:iF,LucideCalendarX2:sF,LucideCamera:Kw,LucideCameraOff:aF,LucideCandlestickChart:m_,LucideCandy:cF,LucideCandyCane:oF,LucideCandyOff:lF,LucideCannabis:dF,LucideCaptions:u_,LucideCaptionsOff:uF,LucideCar:pF,LucideCarFront:hF,LucideCarTaxiFront:fF,LucideCaravan:mF,LucideCarrot:gF,LucideCaseLower:xF,LucideCaseSensitive:yF,LucideCaseUpper:vF,LucideCassetteTape:_F,LucideCast:bF,LucideCastle:wF,LucideCat:jF,LucideCctv:kF,LucideChartArea:h_,LucideChartBar:p_,LucideChartBarBig:f_,LucideChartBarDecreasing:NF,LucideChartBarIncreasing:SF,LucideChartBarStacked:CF,LucideChartCandlestick:m_,LucideChartColumn:nc,LucideChartColumnBig:g_,LucideChartColumnDecreasing:MF,LucideChartColumnIncreasing:x_,LucideChartColumnStacked:TF,LucideChartGantt:AF,LucideChartLine:y_,LucideChartNetwork:EF,LucideChartNoAxesColumn:__,LucideChartNoAxesColumnDecreasing:IF,LucideChartNoAxesColumnIncreasing:v_,LucideChartNoAxesCombined:PF,LucideChartNoAxesGantt:b_,LucideChartPie:w_,LucideChartScatter:j_,LucideChartSpline:LF,LucideCheck:$a,LucideCheckCheck:OF,LucideCheckCircle:Ba,LucideCheckCircle2:Ha,LucideCheckSquare:i0,LucideCheckSquare2:db,LucideChefHat:DF,LucideCherry:RF,LucideChevronDown:Tu,LucideChevronDownCircle:I_,LucideChevronDownSquare:ub,LucideChevronFirst:FF,LucideChevronLast:zF,LucideChevronLeft:id,LucideChevronLeftCircle:P_,LucideChevronLeftSquare:hb,LucideChevronRight:Ka,LucideChevronRightCircle:L_,LucideChevronRightSquare:fb,LucideChevronUp:K0,LucideChevronUpCircle:O_,LucideChevronUpSquare:pb,LucideChevronsDown:$F,LucideChevronsDownUp:BF,LucideChevronsLeft:VF,LucideChevronsLeftRight:qF,LucideChevronsLeftRightEllipsis:UF,LucideChevronsRight:WF,LucideChevronsRightLeft:HF,LucideChevronsUp:GF,LucideChevronsUpDown:Zw,LucideChrome:KF,LucideChurch:ZF,LucideCigarette:XF,LucideCigaretteOff:YF,LucideCircle:Au,LucideCircleAlert:Ul,LucideCircleArrowDown:k_,LucideCircleArrowLeft:N_,LucideCircleArrowOutDownLeft:S_,LucideCircleArrowOutDownRight:C_,LucideCircleArrowOutUpLeft:M_,LucideCircleArrowOutUpRight:T_,LucideCircleArrowRight:A_,LucideCircleArrowUp:E_,LucideCircleCheck:Ha,LucideCircleCheckBig:Ba,LucideCircleChevronDown:I_,LucideCircleChevronLeft:P_,LucideCircleChevronRight:L_,LucideCircleChevronUp:O_,LucideCircleDashed:QF,LucideCircleDivide:D_,LucideCircleDollarSign:JF,LucideCircleDot:tz,LucideCircleDotDashed:ez,LucideCircleEllipsis:rz,LucideCircleEqual:nz,LucideCircleFadingArrowUp:sz,LucideCircleFadingPlus:iz,LucideCircleGauge:R_,LucideCircleHelp:xx,LucideCircleMinus:F_,LucideCircleOff:az,LucideCircleParking:B_,LucideCircleParkingOff:z_,LucideCirclePause:$_,LucideCirclePercent:U_,LucideCirclePlay:Af,LucideCirclePlus:q_,LucideCirclePower:V_,LucideCircleSlash:oz,LucideCircleSlash2:H_,LucideCircleSlashed:H_,LucideCircleStop:W_,LucideCircleUser:K_,LucideCircleUserRound:G_,LucideCircleX:Oc,LucideCircuitBoard:lz,LucideCitrus:cz,LucideClapperboard:dz,LucideClipboard:yz,LucideClipboardCheck:jT,LucideClipboardCopy:uz,LucideClipboardEdit:Y_,LucideClipboardList:hz,LucideClipboardMinus:fz,LucideClipboardPaste:pz,LucideClipboardPen:Y_,LucideClipboardPenLine:Z_,LucideClipboardPlus:mz,LucideClipboardSignature:Z_,LucideClipboardType:gz,LucideClipboardX:xz,LucideClock:Gi,LucideClock1:vz,LucideClock10:_z,LucideClock11:bz,LucideClock12:wz,LucideClock2:jz,LucideClock3:kz,LucideClock4:Nz,LucideClock5:Sz,LucideClock6:Cz,LucideClock7:Mz,LucideClock8:Tz,LucideClock9:Az,LucideClockAlert:Ez,LucideClockArrowDown:Iz,LucideClockArrowUp:Pz,LucideCloud:Kz,LucideCloudAlert:Lz,LucideCloudCog:Oz,LucideCloudDownload:X_,LucideCloudDrizzle:Dz,LucideCloudFog:Rz,LucideCloudHail:Fz,LucideCloudLightning:zz,LucideCloudMoon:$z,LucideCloudMoonRain:Bz,LucideCloudOff:Uz,LucideCloudRain:Vz,LucideCloudRainWind:qz,LucideCloudSnow:Hz,LucideCloudSun:Gz,LucideCloudSunRain:Wz,LucideCloudUpload:Q_,LucideCloudy:Zz,LucideClover:Nx,LucideClub:Yz,LucideCode:Yw,LucideCode2:J_,LucideCodeSquare:mb,LucideCodeXml:J_,LucideCodepen:Xz,LucideCodesandbox:Qz,LucideCoffee:Xw,LucideCog:Jz,LucideCoins:e7,LucideColumns:e2,LucideColumns2:e2,LucideColumns3:t2,LucideColumns4:t7,LucideCombine:r7,LucideCommand:n7,LucideCompass:s7,LucideComponent:i7,LucideComputer:a7,LucideConciergeBell:o7,LucideCone:l7,LucideConstruction:c7,LucideContact:d7,LucideContact2:r2,LucideContactRound:r2,LucideContainer:u7,LucideContrast:h7,LucideCookie:f7,LucideCookingPot:p7,LucideCopy:Vl,LucideCopyCheck:m7,LucideCopyMinus:g7,LucideCopyPlus:x7,LucideCopySlash:y7,LucideCopyX:v7,LucideCopyleft:_7,LucideCopyright:b7,LucideCornerDownLeft:w7,LucideCornerDownRight:j7,LucideCornerLeftDown:k7,LucideCornerLeftUp:N7,LucideCornerRightDown:S7,LucideCornerRightUp:C7,LucideCornerUpLeft:M7,LucideCornerUpRight:T7,LucideCpu:A7,LucideCreativeCommons:E7,LucideCreditCard:Z0,LucideCroissant:I7,LucideCrop:P7,LucideCross:L7,LucideCrosshair:O7,LucideCrown:Y0,LucideCuboid:D7,LucideCupSoda:R7,LucideCurlyBraces:d_,LucideCurrency:F7,LucideCylinder:z7,LucideDam:B7,LucideDatabase:q7,LucideDatabaseBackup:$7,LucideDatabaseZap:U7,LucideDelete:V7,LucideDessert:H7,LucideDiameter:W7,LucideDiamond:Z7,LucideDiamondMinus:G7,LucideDiamondPercent:n2,LucideDiamondPlus:K7,LucideDice1:Y7,LucideDice2:X7,LucideDice3:Q7,LucideDice4:J7,LucideDice5:eB,LucideDice6:tB,LucideDices:rB,LucideDiff:nB,LucideDisc:oB,LucideDisc2:sB,LucideDisc3:iB,LucideDiscAlbum:aB,LucideDivide:lB,LucideDivideCircle:D_,LucideDivideSquare:vb,LucideDna:dB,LucideDnaOff:cB,LucideDock:uB,LucideDog:hB,LucideDollarSign:ad,LucideDonut:fB,LucideDoorClosed:pB,LucideDoorOpen:X0,LucideDot:mB,LucideDotSquare:_b,LucideDownload:Mo,LucideDownloadCloud:X_,LucideDraftingCompass:gB,LucideDrama:xB,LucideDribbble:yB,LucideDrill:vB,LucideDroplet:_B,LucideDroplets:bB,LucideDrum:wB,LucideDrumstick:jB,LucideDumbbell:kB,LucideEar:SB,LucideEarOff:NB,LucideEarth:s2,LucideEarthLock:CB,LucideEclipse:MB,LucideEdit:Jl,LucideEdit2:s0,LucideEdit3:z2,LucideEgg:WS,LucideEggFried:TB,LucideEggOff:AB,LucideEllipsis:Jm,LucideEllipsisVertical:yx,LucideEqual:PB,LucideEqualApproximately:EB,LucideEqualNot:IB,LucideEqualSquare:bb,LucideEraser:LB,LucideEthernetPort:OB,LucideEuro:DB,LucideExpand:RB,LucideExternalLink:$s,LucideEye:Al,LucideEyeClosed:FB,LucideEyeOff:Qw,LucideFacebook:Td,LucideFactory:zB,LucideFan:BB,LucideFastForward:$B,LucideFeather:UB,LucideFence:qB,LucideFerrisWheel:VB,LucideFigma:HB,LucideFile:z9,LucideFileArchive:WB,LucideFileAudio:KB,LucideFileAudio2:GB,LucideFileAxis3D:i2,LucideFileAxis3d:i2,LucideFileBadge:YB,LucideFileBadge2:ZB,LucideFileBarChart:a2,LucideFileBarChart2:o2,LucideFileBox:XB,LucideFileChartColumn:o2,LucideFileChartColumnIncreasing:a2,LucideFileChartLine:l2,LucideFileChartPie:c2,LucideFileCheck:JB,LucideFileCheck2:QB,LucideFileClock:e9,LucideFileCode:r9,LucideFileCode2:t9,LucideFileCog:d2,LucideFileCog2:d2,LucideFileDiff:n9,LucideFileDigit:s9,LucideFileDown:i9,LucideFileEdit:h2,LucideFileHeart:a9,LucideFileImage:Q0,LucideFileInput:o9,LucideFileJson:c9,LucideFileJson2:l9,LucideFileKey:u9,LucideFileKey2:d9,LucideFileLineChart:l2,LucideFileLock:f9,LucideFileLock2:h9,LucideFileMinus:m9,LucideFileMinus2:p9,LucideFileMusic:g9,LucideFileOutput:x9,LucideFilePen:h2,LucideFilePenLine:u2,LucideFilePieChart:c2,LucideFilePlus:v9,LucideFilePlus2:y9,LucideFileQuestion:_9,LucideFileScan:b9,LucideFileSearch:j9,LucideFileSearch2:w9,LucideFileSignature:u2,LucideFileSliders:k9,LucideFileSpreadsheet:J0,LucideFileStack:N9,LucideFileSymlink:S9,LucideFileTerminal:C9,LucideFileText:Si,LucideFileType:T9,LucideFileType2:M9,LucideFileUp:A9,LucideFileUser:E9,LucideFileVideo:P9,LucideFileVideo2:I9,LucideFileVolume:O9,LucideFileVolume2:L9,LucideFileWarning:D9,LucideFileX:F9,LucideFileX2:R9,LucideFiles:B9,LucideFilm:kd,LucideFilter:Jw,LucideFilterX:$9,LucideFingerprint:U9,LucideFireExtinguisher:q9,LucideFish:W9,LucideFishOff:V9,LucideFishSymbol:H9,LucideFlag:Px,LucideFlagOff:G9,LucideFlagTriangleLeft:K9,LucideFlagTriangleRight:Z9,LucideFlame:qh,LucideFlameKindling:Y9,LucideFlashlight:Q9,LucideFlashlightOff:X9,LucideFlaskConical:ej,LucideFlaskConicalOff:J9,LucideFlaskRound:e$,LucideFlipHorizontal:r$,LucideFlipHorizontal2:t$,LucideFlipVertical:s$,LucideFlipVertical2:n$,LucideFlower:i$,LucideFlower2:Qp,LucideFocus:a$,LucideFoldHorizontal:o$,LucideFoldVertical:l$,LucideFolder:O$,LucideFolderArchive:c$,LucideFolderCheck:d$,LucideFolderClock:u$,LucideFolderClosed:h$,LucideFolderCode:f$,LucideFolderCog:f2,LucideFolderCog2:f2,LucideFolderDot:p$,LucideFolderDown:m$,LucideFolderEdit:p2,LucideFolderGit:x$,LucideFolderGit2:g$,LucideFolderHeart:y$,LucideFolderInput:v$,LucideFolderKanban:_$,LucideFolderKey:b$,LucideFolderLock:w$,LucideFolderMinus:j$,LucideFolderOpen:Lx,LucideFolderOpenDot:k$,LucideFolderOutput:N$,LucideFolderPen:p2,LucideFolderPlus:S$,LucideFolderRoot:C$,LucideFolderSearch:T$,LucideFolderSearch2:M$,LucideFolderSymlink:A$,LucideFolderSync:E$,LucideFolderTree:I$,LucideFolderUp:P$,LucideFolderX:L$,LucideFolders:D$,LucideFootprints:R$,LucideForkKnife:aw,LucideForkKnifeCrossed:iw,LucideForklift:F$,LucideFormInput:$2,LucideForward:z$,LucideFrame:B$,LucideFramer:$$,LucideFrown:U$,LucideFuel:q$,LucideFullscreen:V$,LucideFunctionSquare:wb,LucideGalleryHorizontal:W$,LucideGalleryHorizontalEnd:H$,LucideGalleryThumbnails:G$,LucideGalleryVertical:Z$,LucideGalleryVerticalEnd:K$,LucideGamepad:X$,LucideGamepad2:Y$,LucideGanttChart:b_,LucideGanttChartSquare:Vm,LucideGauge:Q$,LucideGaugeCircle:R_,LucideGavel:J$,LucideGem:eU,LucideGhost:tj,LucideGift:Ua,LucideGitBranch:rU,LucideGitBranchPlus:tU,LucideGitCommit:m2,LucideGitCommitHorizontal:m2,LucideGitCommitVertical:nU,LucideGitCompare:iU,LucideGitCompareArrows:sU,LucideGitFork:aU,LucideGitGraph:oU,LucideGitMerge:lU,LucideGitPullRequest:pU,LucideGitPullRequestArrow:cU,LucideGitPullRequestClosed:dU,LucideGitPullRequestCreate:hU,LucideGitPullRequestCreateArrow:uU,LucideGitPullRequestDraft:fU,LucideGithub:mU,LucideGitlab:gU,LucideGlassWater:xU,LucideGlasses:yU,LucideGlobe:rj,LucideGlobe2:s2,LucideGlobeLock:vU,LucideGoal:_U,LucideGrab:bU,LucideGraduationCap:e1,LucideGrape:wU,LucideGrid:Ah,LucideGrid2X2:x2,LucideGrid2X2Plus:g2,LucideGrid2x2:x2,LucideGrid2x2Check:jU,LucideGrid2x2Plus:g2,LucideGrid2x2X:kU,LucideGrid3X3:Ah,LucideGrid3x3:Ah,LucideGrip:SU,LucideGripHorizontal:NU,LucideGripVertical:GS,LucideGroup:CU,LucideGuitar:MU,LucideHam:TU,LucideHammer:AU,LucideHand:OU,LucideHandCoins:EU,LucideHandHeart:IU,LucideHandHelping:y2,LucideHandMetal:PU,LucideHandPlatter:LU,LucideHandshake:DU,LucideHardDrive:kT,LucideHardDriveDownload:RU,LucideHardDriveUpload:FU,LucideHardHat:zU,LucideHash:KS,LucideHaze:BU,LucideHdmiPort:$U,LucideHeading:WU,LucideHeading1:NT,LucideHeading2:ST,LucideHeading3:UU,LucideHeading4:qU,LucideHeading5:VU,LucideHeading6:HU,LucideHeadphoneOff:GU,LucideHeadphones:KU,LucideHeadset:ZU,LucideHeart:oa,LucideHeartCrack:YU,LucideHeartHandshake:XU,LucideHeartOff:QU,LucideHeartPulse:JU,LucideHeater:eq,LucideHelpCircle:xx,LucideHelpingHand:y2,LucideHexagon:tq,LucideHighlighter:rq,LucideHistory:ZS,LucideHome:ui,LucideHop:sq,LucideHopOff:nq,LucideHospital:iq,LucideHotel:aq,LucideHourglass:oq,LucideHouse:ui,LucideHousePlug:lq,LucideHousePlus:cq,LucideIceCream:_2,LucideIceCream2:v2,LucideIceCreamBowl:v2,LucideIceCreamCone:_2,LucideIdCard:dq,LucideImage:Wo,LucideImageDown:uq,LucideImageMinus:hq,LucideImageOff:fq,LucideImagePlay:pq,LucideImagePlus:YS,LucideImageUp:mq,LucideImageUpscale:gq,LucideImages:xq,LucideImport:yq,LucideInbox:vq,LucideIndent:w2,LucideIndentDecrease:b2,LucideIndentIncrease:w2,LucideIndianRupee:_q,LucideInfinity:bq,LucideInfo:wq,LucideInspect:Mb,LucideInspectionPanel:jq,LucideInstagram:Zd,LucideItalic:XS,LucideIterationCcw:kq,LucideIterationCw:Nq,LucideJapaneseYen:Sq,LucideJoystick:Cq,LucideKanban:t1,LucideKanbanSquare:jb,LucideKanbanSquareDashed:gb,LucideKey:Vh,LucideKeyRound:nj,LucideKeySquare:Mq,LucideKeyboard:Eq,LucideKeyboardMusic:Tq,LucideKeyboardOff:Aq,LucideLamp:Rq,LucideLampCeiling:Iq,LucideLampDesk:Pq,LucideLampFloor:Lq,LucideLampWallDown:Oq,LucideLampWallUp:Dq,LucideLandPlot:Fq,LucideLandmark:zq,LucideLanguages:Bq,LucideLaptop:Uq,LucideLaptop2:j2,LucideLaptopMinimal:j2,LucideLaptopMinimalCheck:$q,LucideLasso:Vq,LucideLassoSelect:qq,LucideLaugh:Hq,LucideLayers:Kq,LucideLayers2:Wq,LucideLayers3:Gq,LucideLayout:n0,LucideLayoutDashboard:QS,LucideLayoutGrid:im,LucideLayoutList:Zq,LucideLayoutPanelLeft:Yq,LucideLayoutPanelTop:Xq,LucideLayoutTemplate:Qq,LucideLeaf:Jq,LucideLeafyGreen:eV,LucideLectern:tV,LucideLetterText:rV,LucideLibrary:JS,LucideLibraryBig:nV,LucideLibrarySquare:kb,LucideLifeBuoy:e4,LucideLigature:sV,LucideLightbulb:r1,LucideLightbulbOff:iV,LucideLineChart:y_,LucideLink:bo,LucideLink2:Bf,LucideLink2Off:aV,LucideLinkedin:am,LucideList:$f,LucideListCheck:oV,LucideListChecks:lV,LucideListCollapse:cV,LucideListEnd:dV,LucideListFilter:uV,LucideListMinus:hV,LucideListMusic:fV,LucideListOrdered:t4,LucideListPlus:pV,LucideListRestart:mV,LucideListStart:gV,LucideListTodo:xV,LucideListTree:yV,LucideListVideo:vV,LucideListX:_V,LucideLoader:wV,LucideLoader2:sn,LucideLoaderCircle:sn,LucideLoaderPinwheel:bV,LucideLocate:CT,LucideLocateFixed:jV,LucideLocateOff:kV,LucideLock:Uf,LucideLockKeyhole:NV,LucideLockKeyholeOpen:k2,LucideLockOpen:N2,LucideLogIn:r4,LucideLogOut:n4,LucideLogs:SV,LucideLollipop:CV,LucideLuggage:MV,LucideMSquare:Nb,LucideMagnet:TV,LucideMail:oi,LucideMailCheck:AV,LucideMailMinus:EV,LucideMailOpen:IV,LucideMailPlus:PV,LucideMailQuestion:LV,LucideMailSearch:OV,LucideMailWarning:DV,LucideMailX:MT,LucideMailbox:RV,LucideMails:FV,LucideMap:YV,LucideMapPin:cl,LucideMapPinCheck:BV,LucideMapPinCheckInside:zV,LucideMapPinHouse:$V,LucideMapPinMinus:qV,LucideMapPinMinusInside:UV,LucideMapPinOff:VV,LucideMapPinPlus:WV,LucideMapPinPlusInside:HV,LucideMapPinX:KV,LucideMapPinXInside:GV,LucideMapPinned:ZV,LucideMartini:XV,LucideMaximize:n1,LucideMaximize2:QV,LucideMedal:Ox,LucideMegaphone:om,LucideMegaphoneOff:JV,LucideMeh:eH,LucideMemoryStick:tH,LucideMenu:TT,LucideMenuSquare:Sb,LucideMerge:rH,LucideMessageCircle:Wl,LucideMessageCircleCode:nH,LucideMessageCircleDashed:sH,LucideMessageCircleHeart:s4,LucideMessageCircleMore:iH,LucideMessageCircleOff:aH,LucideMessageCirclePlus:oH,LucideMessageCircleQuestion:AT,LucideMessageCircleReply:lH,LucideMessageCircleWarning:cH,LucideMessageCircleX:dH,LucideMessageSquare:vl,LucideMessageSquareCode:uH,LucideMessageSquareDashed:hH,LucideMessageSquareDiff:fH,LucideMessageSquareDot:pH,LucideMessageSquareHeart:mH,LucideMessageSquareLock:gH,LucideMessageSquareMore:xH,LucideMessageSquareOff:yH,LucideMessageSquarePlus:vH,LucideMessageSquareQuote:_H,LucideMessageSquareReply:bH,LucideMessageSquareShare:wH,LucideMessageSquareText:jH,LucideMessageSquareWarning:kH,LucideMessageSquareX:NH,LucideMessagesSquare:SH,LucideMic:ET,LucideMic2:S2,LucideMicOff:CH,LucideMicVocal:S2,LucideMicrochip:MH,LucideMicroscope:TH,LucideMicrowave:AH,LucideMilestone:EH,LucideMilk:PH,LucideMilkOff:IH,LucideMinimize:OH,LucideMinimize2:LH,LucideMinus:s1,LucideMinusCircle:F_,LucideMinusSquare:Cb,LucideMonitor:i4,LucideMonitorCheck:DH,LucideMonitorCog:RH,LucideMonitorDot:FH,LucideMonitorDown:zH,LucideMonitorOff:BH,LucideMonitorPause:$H,LucideMonitorPlay:UH,LucideMonitorSmartphone:qH,LucideMonitorSpeaker:VH,LucideMonitorStop:HH,LucideMonitorUp:WH,LucideMonitorX:GH,LucideMoon:ZH,LucideMoonStar:KH,LucideMoreHorizontal:Jm,LucideMoreVertical:yx,LucideMountain:XH,LucideMountainSnow:YH,LucideMouse:nW,LucideMouseOff:QH,LucideMousePointer:rW,LucideMousePointer2:JH,LucideMousePointerBan:eW,LucideMousePointerClick:tW,LucideMousePointerSquareDashed:xb,LucideMove:gW,LucideMove3D:C2,LucideMove3d:C2,LucideMoveDiagonal:iW,LucideMoveDiagonal2:sW,LucideMoveDown:lW,LucideMoveDownLeft:aW,LucideMoveDownRight:oW,LucideMoveHorizontal:cW,LucideMoveLeft:dW,LucideMoveRight:uW,LucideMoveUp:pW,LucideMoveUpLeft:hW,LucideMoveUpRight:fW,LucideMoveVertical:mW,LucideMusic:_W,LucideMusic2:xW,LucideMusic3:yW,LucideMusic4:vW,LucideNavigation:IT,LucideNavigation2:wW,LucideNavigation2Off:bW,LucideNavigationOff:jW,LucideNetwork:kW,LucideNewspaper:Dx,LucideNfc:NW,LucideNotebook:TW,LucideNotebookPen:SW,LucideNotebookTabs:CW,LucideNotebookText:MW,LucideNotepadText:EW,LucideNotepadTextDashed:AW,LucideNut:PW,LucideNutOff:IW,LucideOctagon:OW,LucideOctagonAlert:M2,LucideOctagonMinus:LW,LucideOctagonPause:T2,LucideOctagonX:A2,LucideOmega:DW,LucideOption:RW,LucideOrbit:FW,LucideOrigami:zW,LucideOutdent:b2,LucidePackage:El,LucidePackage2:BW,LucidePackageCheck:$W,LucidePackageMinus:UW,LucidePackageOpen:qW,LucidePackagePlus:VW,LucidePackageSearch:HW,LucidePackageX:WW,LucidePaintBucket:GW,LucidePaintRoller:KW,LucidePaintbrush:ZW,LucidePaintbrush2:E2,LucidePaintbrushVertical:E2,LucidePalette:Yd,LucidePalmtree:Zb,LucidePanelBottom:QW,LucidePanelBottomClose:YW,LucidePanelBottomDashed:I2,LucidePanelBottomInactive:I2,LucidePanelBottomOpen:XW,LucidePanelLeft:D2,LucidePanelLeftClose:P2,LucidePanelLeftDashed:L2,LucidePanelLeftInactive:L2,LucidePanelLeftOpen:O2,LucidePanelRight:tG,LucidePanelRightClose:JW,LucidePanelRightDashed:R2,LucidePanelRightInactive:R2,LucidePanelRightOpen:eG,LucidePanelTop:sG,LucidePanelTopClose:rG,LucidePanelTopDashed:F2,LucidePanelTopInactive:F2,LucidePanelTopOpen:nG,LucidePanelsLeftBottom:iG,LucidePanelsLeftRight:t2,LucidePanelsRightBottom:aG,LucidePanelsTopBottom:V2,LucidePanelsTopLeft:n0,LucidePaperclip:oG,LucideParentheses:lG,LucideParkingCircle:B_,LucideParkingCircleOff:z_,LucideParkingMeter:cG,LucideParkingSquare:Ab,LucideParkingSquareOff:Tb,LucidePartyPopper:bc,LucidePause:Hh,LucidePauseCircle:$_,LucidePauseOctagon:T2,LucidePawPrint:dG,LucidePcCase:uG,LucidePen:s0,LucidePenBox:Jl,LucidePenLine:z2,LucidePenOff:hG,LucidePenSquare:Jl,LucidePenTool:sj,LucidePencil:ya,LucidePencilLine:fG,LucidePencilOff:pG,LucidePencilRuler:mG,LucidePentagon:gG,LucidePercent:a4,LucidePercentCircle:U_,LucidePercentDiamond:n2,LucidePercentSquare:Eb,LucidePersonStanding:xG,LucidePhilippinePeso:yG,LucidePhone:Ma,LucidePhoneCall:vG,LucidePhoneForwarded:_G,LucidePhoneIncoming:bG,LucidePhoneMissed:wG,LucidePhoneOff:jG,LucidePhoneOutgoing:kG,LucidePi:NG,LucidePiSquare:Ib,LucidePiano:SG,LucidePickaxe:CG,LucidePictureInPicture:TG,LucidePictureInPicture2:MG,LucidePieChart:w_,LucidePiggyBank:AG,LucidePilcrow:PG,LucidePilcrowLeft:EG,LucidePilcrowRight:IG,LucidePilcrowSquare:Pb,LucidePill:OG,LucidePillBottle:LG,LucidePin:i1,LucidePinOff:PT,LucidePipette:DG,LucidePizza:RG,LucidePlane:BG,LucidePlaneLanding:FG,LucidePlaneTakeoff:zG,LucidePlay:wc,LucidePlayCircle:Af,LucidePlaySquare:Lb,LucidePlug:UG,LucidePlug2:$G,LucidePlugZap:B2,LucidePlugZap2:B2,LucidePlus:Mn,LucidePlusCircle:q_,LucidePlusSquare:Ob,LucidePocket:VG,LucidePocketKnife:qG,LucidePodcast:HG,LucidePointer:GG,LucidePointerOff:WG,LucidePopcorn:KG,LucidePopsicle:ZG,LucidePoundSterling:YG,LucidePower:QG,LucidePowerCircle:V_,LucidePowerOff:XG,LucidePowerSquare:Db,LucidePresentation:JG,LucidePrinter:tK,LucidePrinterCheck:eK,LucideProjector:rK,LucideProportions:nK,LucidePuzzle:sK,LucidePyramid:iK,LucideQrCode:aK,LucideQuote:oK,LucideRabbit:lK,LucideRadar:cK,LucideRadiation:dK,LucideRadical:uK,LucideRadio:ij,LucideRadioReceiver:hK,LucideRadioTower:fK,LucideRadius:pK,LucideRailSymbol:mK,LucideRainbow:gK,LucideRat:xK,LucideRatio:yK,LucideReceipt:CK,LucideReceiptCent:vK,LucideReceiptEuro:_K,LucideReceiptIndianRupee:bK,LucideReceiptJapaneseYen:wK,LucideReceiptPoundSterling:jK,LucideReceiptRussianRuble:kK,LucideReceiptSwissFranc:NK,LucideReceiptText:SK,LucideRectangleEllipsis:$2,LucideRectangleHorizontal:MK,LucideRectangleVertical:TK,LucideRecycle:AK,LucideRedo:o4,LucideRedo2:EK,LucideRedoDot:IK,LucideRefreshCcw:LK,LucideRefreshCcwDot:PK,LucideRefreshCw:Fl,LucideRefreshCwOff:OK,LucideRefrigerator:DK,LucideRegex:RK,LucideRemoveFormatting:FK,LucideRepeat:$K,LucideRepeat1:zK,LucideRepeat2:BK,LucideReplace:qK,LucideReplaceAll:UK,LucideReply:LT,LucideReplyAll:VK,LucideRewind:HK,LucideRibbon:WK,LucideRocket:ug,LucideRockingChair:GK,LucideRollerCoaster:KK,LucideRotate3D:U2,LucideRotate3d:U2,LucideRotateCcw:l4,LucideRotateCcwSquare:ZK,LucideRotateCw:OT,LucideRotateCwSquare:YK,LucideRoute:QK,LucideRouteOff:XK,LucideRouter:JK,LucideRows:q2,LucideRows2:q2,LucideRows3:V2,LucideRows4:eZ,LucideRss:tZ,LucideRuler:rZ,LucideRussianRuble:nZ,LucideSailboat:sZ,LucideSalad:iZ,LucideSandwich:aZ,LucideSatellite:lZ,LucideSatelliteDish:oZ,LucideSave:hg,LucideSaveAll:cZ,LucideSaveOff:dZ,LucideScale:uZ,LucideScale3D:H2,LucideScale3d:H2,LucideScaling:hZ,LucideScan:_Z,LucideScanBarcode:fZ,LucideScanEye:pZ,LucideScanFace:mZ,LucideScanLine:gZ,LucideScanQrCode:xZ,LucideScanSearch:yZ,LucideScanText:vZ,LucideScatterChart:j_,LucideSchool:bZ,LucideSchool2:Xb,LucideScissors:jZ,LucideScissorsLineDashed:wZ,LucideScissorsSquare:Rb,LucideScissorsSquareDashedBottom:cb,LucideScreenShare:NZ,LucideScreenShareOff:kZ,LucideScroll:CZ,LucideScrollText:SZ,LucideSearch:Ei,LucideSearchCheck:MZ,LucideSearchCode:TZ,LucideSearchSlash:AZ,LucideSearchX:EZ,LucideSection:IZ,LucideSend:To,LucideSendHorizonal:W2,LucideSendHorizontal:W2,LucideSendToBack:PZ,LucideSeparatorHorizontal:LZ,LucideSeparatorVertical:OZ,LucideServer:zZ,LucideServerCog:DZ,LucideServerCrash:RZ,LucideServerOff:FZ,LucideSettings:od,LucideSettings2:BZ,LucideShapes:$Z,LucideShare:DT,LucideShare2:Xd,LucideSheet:UZ,LucideShell:qZ,LucideShield:lm,LucideShieldAlert:VZ,LucideShieldBan:HZ,LucideShieldCheck:RT,LucideShieldClose:G2,LucideShieldEllipsis:WZ,LucideShieldHalf:GZ,LucideShieldMinus:KZ,LucideShieldOff:ZZ,LucideShieldPlus:YZ,LucideShieldQuestion:XZ,LucideShieldX:G2,LucideShip:JZ,LucideShipWheel:QZ,LucideShirt:eY,LucideShoppingBag:fg,LucideShoppingBasket:tY,LucideShoppingCart:ah,LucideShovel:rY,LucideShowerHead:nY,LucideShrink:sY,LucideShrub:iY,LucideShuffle:aY,LucideSidebar:D2,LucideSidebarClose:P2,LucideSidebarOpen:O2,LucideSigma:oY,LucideSigmaSquare:Fb,LucideSignal:hY,LucideSignalHigh:lY,LucideSignalLow:cY,LucideSignalMedium:dY,LucideSignalZero:uY,LucideSignature:fY,LucideSignpost:mY,LucideSignpostBig:pY,LucideSiren:gY,LucideSkipBack:xY,LucideSkipForward:yY,LucideSkull:vY,LucideSlack:_Y,LucideSlash:bY,LucideSlashSquare:zb,LucideSlice:wY,LucideSliders:K2,LucideSlidersHorizontal:FT,LucideSlidersVertical:K2,LucideSmartphone:a1,LucideSmartphoneCharging:jY,LucideSmartphoneNfc:kY,LucideSmile:SY,LucideSmilePlus:NY,LucideSnail:CY,LucideSnowflake:I0,LucideSofa:MY,LucideSortAsc:n_,LucideSortDesc:e_,LucideSoup:TY,LucideSpace:AY,LucideSpade:EY,LucideSparkle:IY,LucideSparkles:As,LucideSpeaker:PY,LucideSpeech:LY,LucideSpellCheck:DY,LucideSpellCheck2:OY,LucideSpline:RY,LucideSplit:FY,LucideSplitSquareHorizontal:Bb,LucideSplitSquareVertical:$b,LucideSprayCan:zY,LucideSprout:BY,LucideSquare:cm,LucideSquareActivity:Z2,LucideSquareArrowDown:Q2,LucideSquareArrowDownLeft:Y2,LucideSquareArrowDownRight:X2,LucideSquareArrowLeft:J2,LucideSquareArrowOutDownLeft:eb,LucideSquareArrowOutDownRight:tb,LucideSquareArrowOutUpLeft:rb,LucideSquareArrowOutUpRight:nb,LucideSquareArrowRight:sb,LucideSquareArrowUp:ob,LucideSquareArrowUpLeft:ib,LucideSquareArrowUpRight:ab,LucideSquareAsterisk:lb,LucideSquareBottomDashedScissors:cb,LucideSquareChartGantt:Vm,LucideSquareCheck:db,LucideSquareCheckBig:i0,LucideSquareChevronDown:ub,LucideSquareChevronLeft:hb,LucideSquareChevronRight:fb,LucideSquareChevronUp:pb,LucideSquareCode:mb,LucideSquareDashed:yb,LucideSquareDashedBottom:UY,LucideSquareDashedBottomCode:$Y,LucideSquareDashedKanban:gb,LucideSquareDashedMousePointer:xb,LucideSquareDivide:vb,LucideSquareDot:_b,LucideSquareEqual:bb,LucideSquareFunction:wb,LucideSquareGanttChart:Vm,LucideSquareKanban:jb,LucideSquareLibrary:kb,LucideSquareM:Nb,LucideSquareMenu:Sb,LucideSquareMinus:Cb,LucideSquareMousePointer:Mb,LucideSquareParking:Ab,LucideSquareParkingOff:Tb,LucideSquarePen:Jl,LucideSquarePercent:Eb,LucideSquarePi:Ib,LucideSquarePilcrow:Pb,LucideSquarePlay:Lb,LucideSquarePlus:Ob,LucideSquarePower:Db,LucideSquareRadical:qY,LucideSquareScissors:Rb,LucideSquareSigma:Fb,LucideSquareSlash:zb,LucideSquareSplitHorizontal:Bb,LucideSquareSplitVertical:$b,LucideSquareSquare:VY,LucideSquareStack:HY,LucideSquareTerminal:Ub,LucideSquareUser:Vb,LucideSquareUserRound:qb,LucideSquareX:Hb,LucideSquircle:WY,LucideSquirrel:GY,LucideStamp:KY,LucideStar:Bs,LucideStarHalf:ZY,LucideStarOff:YY,LucideStars:As,LucideStepBack:XY,LucideStepForward:QY,LucideStethoscope:JY,LucideSticker:eX,LucideStickyNote:tX,LucideStopCircle:W_,LucideStore:rX,LucideStretchHorizontal:nX,LucideStretchVertical:sX,LucideStrikethrough:iX,LucideSubscript:aX,LucideSubtitles:u_,LucideSun:o1,LucideSunDim:oX,LucideSunMedium:lX,LucideSunMoon:cX,LucideSunSnow:dX,LucideSunrise:uX,LucideSunset:hX,LucideSuperscript:fX,LucideSwatchBook:pX,LucideSwissFranc:mX,LucideSwitchCamera:gX,LucideSword:xX,LucideSwords:yX,LucideSyringe:vX,LucideTable:SX,LucideTable2:zT,LucideTableCellsMerge:_X,LucideTableCellsSplit:bX,LucideTableColumnsSplit:wX,LucideTableOfContents:jX,LucideTableProperties:kX,LucideTableRowsSplit:NX,LucideTablet:MX,LucideTabletSmartphone:CX,LucideTablets:TX,LucideTag:aj,LucideTags:AX,LucideTally1:EX,LucideTally2:IX,LucideTally3:PX,LucideTally4:LX,LucideTally5:OX,LucideTangent:DX,LucideTarget:Rx,LucideTelescope:RX,LucideTent:zX,LucideTentTree:FX,LucideTerminal:BX,LucideTerminalSquare:Ub,LucideTestTube:$X,LucideTestTube2:Wb,LucideTestTubeDiagonal:Wb,LucideTestTubes:UX,LucideText:GX,LucideTextCursor:VX,LucideTextCursorInput:qX,LucideTextQuote:HX,LucideTextSearch:WX,LucideTextSelect:Gb,LucideTextSelection:Gb,LucideTheater:KX,LucideThermometer:XX,LucideThermometerSnowflake:ZX,LucideThermometerSun:YX,LucideThumbsDown:BT,LucideThumbsUp:Ad,LucideTicket:$T,LucideTicketCheck:QX,LucideTicketMinus:JX,LucideTicketPercent:eQ,LucideTicketPlus:tQ,LucideTicketSlash:rQ,LucideTicketX:nQ,LucideTickets:iQ,LucideTicketsPlane:sQ,LucideTimer:lQ,LucideTimerOff:aQ,LucideTimerReset:oQ,LucideToggleLeft:cQ,LucideToggleRight:dQ,LucideToilet:uQ,LucideTornado:hQ,LucideTorus:fQ,LucideTouchpad:mQ,LucideTouchpadOff:pQ,LucideTowerControl:gQ,LucideToyBrick:xQ,LucideTractor:yQ,LucideTrafficCone:vQ,LucideTrain:Kb,LucideTrainFront:bQ,LucideTrainFrontTunnel:_Q,LucideTrainTrack:wQ,LucideTramFront:Kb,LucideTrash:jQ,LucideTrash2:es,LucideTreeDeciduous:kQ,LucideTreePalm:Zb,LucideTreePine:l1,LucideTrees:NQ,LucideTrello:SQ,LucideTrendingDown:c1,LucideTrendingUp:qf,LucideTrendingUpDown:CQ,LucideTriangle:TQ,LucideTriangleAlert:Lh,LucideTriangleRight:MQ,LucideTrophy:qa,LucideTruck:UT,LucideTurtle:AQ,LucideTv:IQ,LucideTv2:Yb,LucideTvMinimal:Yb,LucideTvMinimalPlay:EQ,LucideTwitch:PQ,LucideTwitter:LQ,LucideType:DQ,LucideTypeOutline:OQ,LucideUmbrella:FQ,LucideUmbrellaOff:RQ,LucideUnderline:zQ,LucideUndo:c4,LucideUndo2:BQ,LucideUndoDot:$Q,LucideUnfoldHorizontal:UQ,LucideUnfoldVertical:qQ,LucideUngroup:VQ,LucideUniversity:Xb,LucideUnlink:qT,LucideUnlink2:HQ,LucideUnlock:N2,LucideUnlockKeyhole:k2,LucideUnplug:WQ,LucideUpload:Ao,LucideUploadCloud:Q_,LucideUsb:GQ,LucideUser:jc,LucideUser2:nw,LucideUserCheck:oj,LucideUserCheck2:Qb,LucideUserCircle:K_,LucideUserCircle2:G_,LucideUserCog:VT,LucideUserCog2:Jb,LucideUserMinus:KQ,LucideUserMinus2:ew,LucideUserPen:ZQ,LucideUserPlus:d1,LucideUserPlus2:tw,LucideUserRound:nw,LucideUserRoundCheck:Qb,LucideUserRoundCog:Jb,LucideUserRoundMinus:ew,LucideUserRoundPen:YQ,LucideUserRoundPlus:tw,LucideUserRoundSearch:XQ,LucideUserRoundX:rw,LucideUserSearch:QQ,LucideUserSquare:Vb,LucideUserSquare2:qb,LucideUserX:JQ,LucideUserX2:rw,LucideUsers:fs,LucideUsers2:sw,LucideUsersRound:sw,LucideUtensils:aw,LucideUtensilsCrossed:iw,LucideUtilityPole:eJ,LucideVariable:HT,LucideVault:tJ,LucideVegan:rJ,LucideVenetianMask:nJ,LucideVerified:a_,LucideVibrate:iJ,LucideVibrateOff:sJ,LucideVideo:Wi,LucideVideoOff:aJ,LucideVideotape:oJ,LucideView:lJ,LucideVoicemail:cJ,LucideVolleyball:dJ,LucideVolume:mJ,LucideVolume1:uJ,LucideVolume2:hJ,LucideVolumeOff:fJ,LucideVolumeX:pJ,LucideVote:gJ,LucideWallet:yJ,LucideWallet2:ow,LucideWalletCards:xJ,LucideWalletMinimal:ow,LucideWallpaper:vJ,LucideWand:_J,LucideWand2:lw,LucideWandSparkles:lw,LucideWarehouse:bJ,LucideWashingMachine:wJ,LucideWatch:jJ,LucideWaves:kJ,LucideWaypoints:NJ,LucideWebcam:SJ,LucideWebhook:MJ,LucideWebhookOff:CJ,LucideWeight:TJ,LucideWheat:EJ,LucideWheatOff:AJ,LucideWholeWord:IJ,LucideWifi:RJ,LucideWifiHigh:PJ,LucideWifiLow:LJ,LucideWifiOff:OJ,LucideWifiZero:DJ,LucideWind:zJ,LucideWindArrowDown:FJ,LucideWine:$J,LucideWineOff:BJ,LucideWorkflow:UJ,LucideWorm:qJ,LucideWrapText:VJ,LucideWrench:Fx,LucideX:Es,LucideXCircle:Oc,LucideXOctagon:A2,LucideXSquare:Hb,LucideYoutube:HJ,LucideZap:u1,LucideZapOff:WJ,LucideZoomIn:d4,LucideZoomOut:u4,Luggage:MV,LuggageIcon:MV,MSquare:Nb,MSquareIcon:Nb,Magnet:TV,MagnetIcon:TV,Mail:oi,MailCheck:AV,MailCheckIcon:AV,MailIcon:oi,MailMinus:EV,MailMinusIcon:EV,MailOpen:IV,MailOpenIcon:IV,MailPlus:PV,MailPlusIcon:PV,MailQuestion:LV,MailQuestionIcon:LV,MailSearch:OV,MailSearchIcon:OV,MailWarning:DV,MailWarningIcon:DV,MailX:MT,MailXIcon:MT,Mailbox:RV,MailboxIcon:RV,Mails:FV,MailsIcon:FV,Map:YV,MapIcon:YV,MapPin:cl,MapPinCheck:BV,MapPinCheckIcon:BV,MapPinCheckInside:zV,MapPinCheckInsideIcon:zV,MapPinHouse:$V,MapPinHouseIcon:$V,MapPinIcon:cl,MapPinMinus:qV,MapPinMinusIcon:qV,MapPinMinusInside:UV,MapPinMinusInsideIcon:UV,MapPinOff:VV,MapPinOffIcon:VV,MapPinPlus:WV,MapPinPlusIcon:WV,MapPinPlusInside:HV,MapPinPlusInsideIcon:HV,MapPinX:KV,MapPinXIcon:KV,MapPinXInside:GV,MapPinXInsideIcon:GV,MapPinned:ZV,MapPinnedIcon:ZV,Martini:XV,MartiniIcon:XV,Maximize:n1,Maximize2:QV,Maximize2Icon:QV,MaximizeIcon:n1,Medal:Ox,MedalIcon:Ox,Megaphone:om,MegaphoneIcon:om,MegaphoneOff:JV,MegaphoneOffIcon:JV,Meh:eH,MehIcon:eH,MemoryStick:tH,MemoryStickIcon:tH,Menu:TT,MenuIcon:TT,MenuSquare:Sb,MenuSquareIcon:Sb,Merge:rH,MergeIcon:rH,MessageCircle:Wl,MessageCircleCode:nH,MessageCircleCodeIcon:nH,MessageCircleDashed:sH,MessageCircleDashedIcon:sH,MessageCircleHeart:s4,MessageCircleHeartIcon:s4,MessageCircleIcon:Wl,MessageCircleMore:iH,MessageCircleMoreIcon:iH,MessageCircleOff:aH,MessageCircleOffIcon:aH,MessageCirclePlus:oH,MessageCirclePlusIcon:oH,MessageCircleQuestion:AT,MessageCircleQuestionIcon:AT,MessageCircleReply:lH,MessageCircleReplyIcon:lH,MessageCircleWarning:cH,MessageCircleWarningIcon:cH,MessageCircleX:dH,MessageCircleXIcon:dH,MessageSquare:vl,MessageSquareCode:uH,MessageSquareCodeIcon:uH,MessageSquareDashed:hH,MessageSquareDashedIcon:hH,MessageSquareDiff:fH,MessageSquareDiffIcon:fH,MessageSquareDot:pH,MessageSquareDotIcon:pH,MessageSquareHeart:mH,MessageSquareHeartIcon:mH,MessageSquareIcon:vl,MessageSquareLock:gH,MessageSquareLockIcon:gH,MessageSquareMore:xH,MessageSquareMoreIcon:xH,MessageSquareOff:yH,MessageSquareOffIcon:yH,MessageSquarePlus:vH,MessageSquarePlusIcon:vH,MessageSquareQuote:_H,MessageSquareQuoteIcon:_H,MessageSquareReply:bH,MessageSquareReplyIcon:bH,MessageSquareShare:wH,MessageSquareShareIcon:wH,MessageSquareText:jH,MessageSquareTextIcon:jH,MessageSquareWarning:kH,MessageSquareWarningIcon:kH,MessageSquareX:NH,MessageSquareXIcon:NH,MessagesSquare:SH,MessagesSquareIcon:SH,Mic:ET,Mic2:S2,Mic2Icon:S2,MicIcon:ET,MicOff:CH,MicOffIcon:CH,MicVocal:S2,MicVocalIcon:S2,Microchip:MH,MicrochipIcon:MH,Microscope:TH,MicroscopeIcon:TH,Microwave:AH,MicrowaveIcon:AH,Milestone:EH,MilestoneIcon:EH,Milk:PH,MilkIcon:PH,MilkOff:IH,MilkOffIcon:IH,Minimize:OH,Minimize2:LH,Minimize2Icon:LH,MinimizeIcon:OH,Minus:s1,MinusCircle:F_,MinusCircleIcon:F_,MinusIcon:s1,MinusSquare:Cb,MinusSquareIcon:Cb,Monitor:i4,MonitorCheck:DH,MonitorCheckIcon:DH,MonitorCog:RH,MonitorCogIcon:RH,MonitorDot:FH,MonitorDotIcon:FH,MonitorDown:zH,MonitorDownIcon:zH,MonitorIcon:i4,MonitorOff:BH,MonitorOffIcon:BH,MonitorPause:$H,MonitorPauseIcon:$H,MonitorPlay:UH,MonitorPlayIcon:UH,MonitorSmartphone:qH,MonitorSmartphoneIcon:qH,MonitorSpeaker:VH,MonitorSpeakerIcon:VH,MonitorStop:HH,MonitorStopIcon:HH,MonitorUp:WH,MonitorUpIcon:WH,MonitorX:GH,MonitorXIcon:GH,Moon:ZH,MoonIcon:ZH,MoonStar:KH,MoonStarIcon:KH,MoreHorizontal:Jm,MoreHorizontalIcon:Jm,MoreVertical:yx,MoreVerticalIcon:yx,Mountain:XH,MountainIcon:XH,MountainSnow:YH,MountainSnowIcon:YH,Mouse:nW,MouseIcon:nW,MouseOff:QH,MouseOffIcon:QH,MousePointer:rW,MousePointer2:JH,MousePointer2Icon:JH,MousePointerBan:eW,MousePointerBanIcon:eW,MousePointerClick:tW,MousePointerClickIcon:tW,MousePointerIcon:rW,MousePointerSquareDashed:xb,MousePointerSquareDashedIcon:xb,Move:gW,Move3D:C2,Move3DIcon:C2,Move3d:C2,Move3dIcon:C2,MoveDiagonal:iW,MoveDiagonal2:sW,MoveDiagonal2Icon:sW,MoveDiagonalIcon:iW,MoveDown:lW,MoveDownIcon:lW,MoveDownLeft:aW,MoveDownLeftIcon:aW,MoveDownRight:oW,MoveDownRightIcon:oW,MoveHorizontal:cW,MoveHorizontalIcon:cW,MoveIcon:gW,MoveLeft:dW,MoveLeftIcon:dW,MoveRight:uW,MoveRightIcon:uW,MoveUp:pW,MoveUpIcon:pW,MoveUpLeft:hW,MoveUpLeftIcon:hW,MoveUpRight:fW,MoveUpRightIcon:fW,MoveVertical:mW,MoveVerticalIcon:mW,Music:_W,Music2:xW,Music2Icon:xW,Music3:yW,Music3Icon:yW,Music4:vW,Music4Icon:vW,MusicIcon:_W,Navigation:IT,Navigation2:wW,Navigation2Icon:wW,Navigation2Off:bW,Navigation2OffIcon:bW,NavigationIcon:IT,NavigationOff:jW,NavigationOffIcon:jW,Network:kW,NetworkIcon:kW,Newspaper:Dx,NewspaperIcon:Dx,Nfc:NW,NfcIcon:NW,Notebook:TW,NotebookIcon:TW,NotebookPen:SW,NotebookPenIcon:SW,NotebookTabs:CW,NotebookTabsIcon:CW,NotebookText:MW,NotebookTextIcon:MW,NotepadText:EW,NotepadTextDashed:AW,NotepadTextDashedIcon:AW,NotepadTextIcon:EW,Nut:PW,NutIcon:PW,NutOff:IW,NutOffIcon:IW,Octagon:OW,OctagonAlert:M2,OctagonAlertIcon:M2,OctagonIcon:OW,OctagonMinus:LW,OctagonMinusIcon:LW,OctagonPause:T2,OctagonPauseIcon:T2,OctagonX:A2,OctagonXIcon:A2,Omega:DW,OmegaIcon:DW,Option:RW,OptionIcon:RW,Orbit:FW,OrbitIcon:FW,Origami:zW,OrigamiIcon:zW,Outdent:b2,OutdentIcon:b2,Package:El,Package2:BW,Package2Icon:BW,PackageCheck:$W,PackageCheckIcon:$W,PackageIcon:El,PackageMinus:UW,PackageMinusIcon:UW,PackageOpen:qW,PackageOpenIcon:qW,PackagePlus:VW,PackagePlusIcon:VW,PackageSearch:HW,PackageSearchIcon:HW,PackageX:WW,PackageXIcon:WW,PaintBucket:GW,PaintBucketIcon:GW,PaintRoller:KW,PaintRollerIcon:KW,Paintbrush:ZW,Paintbrush2:E2,Paintbrush2Icon:E2,PaintbrushIcon:ZW,PaintbrushVertical:E2,PaintbrushVerticalIcon:E2,Palette:Yd,PaletteIcon:Yd,Palmtree:Zb,PalmtreeIcon:Zb,PanelBottom:QW,PanelBottomClose:YW,PanelBottomCloseIcon:YW,PanelBottomDashed:I2,PanelBottomDashedIcon:I2,PanelBottomIcon:QW,PanelBottomInactive:I2,PanelBottomInactiveIcon:I2,PanelBottomOpen:XW,PanelBottomOpenIcon:XW,PanelLeft:D2,PanelLeftClose:P2,PanelLeftCloseIcon:P2,PanelLeftDashed:L2,PanelLeftDashedIcon:L2,PanelLeftIcon:D2,PanelLeftInactive:L2,PanelLeftInactiveIcon:L2,PanelLeftOpen:O2,PanelLeftOpenIcon:O2,PanelRight:tG,PanelRightClose:JW,PanelRightCloseIcon:JW,PanelRightDashed:R2,PanelRightDashedIcon:R2,PanelRightIcon:tG,PanelRightInactive:R2,PanelRightInactiveIcon:R2,PanelRightOpen:eG,PanelRightOpenIcon:eG,PanelTop:sG,PanelTopClose:rG,PanelTopCloseIcon:rG,PanelTopDashed:F2,PanelTopDashedIcon:F2,PanelTopIcon:sG,PanelTopInactive:F2,PanelTopInactiveIcon:F2,PanelTopOpen:nG,PanelTopOpenIcon:nG,PanelsLeftBottom:iG,PanelsLeftBottomIcon:iG,PanelsLeftRight:t2,PanelsLeftRightIcon:t2,PanelsRightBottom:aG,PanelsRightBottomIcon:aG,PanelsTopBottom:V2,PanelsTopBottomIcon:V2,PanelsTopLeft:n0,PanelsTopLeftIcon:n0,Paperclip:oG,PaperclipIcon:oG,Parentheses:lG,ParenthesesIcon:lG,ParkingCircle:B_,ParkingCircleIcon:B_,ParkingCircleOff:z_,ParkingCircleOffIcon:z_,ParkingMeter:cG,ParkingMeterIcon:cG,ParkingSquare:Ab,ParkingSquareIcon:Ab,ParkingSquareOff:Tb,ParkingSquareOffIcon:Tb,PartyPopper:bc,PartyPopperIcon:bc,Pause:Hh,PauseCircle:$_,PauseCircleIcon:$_,PauseIcon:Hh,PauseOctagon:T2,PauseOctagonIcon:T2,PawPrint:dG,PawPrintIcon:dG,PcCase:uG,PcCaseIcon:uG,Pen:s0,PenBox:Jl,PenBoxIcon:Jl,PenIcon:s0,PenLine:z2,PenLineIcon:z2,PenOff:hG,PenOffIcon:hG,PenSquare:Jl,PenSquareIcon:Jl,PenTool:sj,PenToolIcon:sj,Pencil:ya,PencilIcon:ya,PencilLine:fG,PencilLineIcon:fG,PencilOff:pG,PencilOffIcon:pG,PencilRuler:mG,PencilRulerIcon:mG,Pentagon:gG,PentagonIcon:gG,Percent:a4,PercentCircle:U_,PercentCircleIcon:U_,PercentDiamond:n2,PercentDiamondIcon:n2,PercentIcon:a4,PercentSquare:Eb,PercentSquareIcon:Eb,PersonStanding:xG,PersonStandingIcon:xG,PhilippinePeso:yG,PhilippinePesoIcon:yG,Phone:Ma,PhoneCall:vG,PhoneCallIcon:vG,PhoneForwarded:_G,PhoneForwardedIcon:_G,PhoneIcon:Ma,PhoneIncoming:bG,PhoneIncomingIcon:bG,PhoneMissed:wG,PhoneMissedIcon:wG,PhoneOff:jG,PhoneOffIcon:jG,PhoneOutgoing:kG,PhoneOutgoingIcon:kG,Pi:NG,PiIcon:NG,PiSquare:Ib,PiSquareIcon:Ib,Piano:SG,PianoIcon:SG,Pickaxe:CG,PickaxeIcon:CG,PictureInPicture:TG,PictureInPicture2:MG,PictureInPicture2Icon:MG,PictureInPictureIcon:TG,PieChart:w_,PieChartIcon:w_,PiggyBank:AG,PiggyBankIcon:AG,Pilcrow:PG,PilcrowIcon:PG,PilcrowLeft:EG,PilcrowLeftIcon:EG,PilcrowRight:IG,PilcrowRightIcon:IG,PilcrowSquare:Pb,PilcrowSquareIcon:Pb,Pill:OG,PillBottle:LG,PillBottleIcon:LG,PillIcon:OG,Pin:i1,PinIcon:i1,PinOff:PT,PinOffIcon:PT,Pipette:DG,PipetteIcon:DG,Pizza:RG,PizzaIcon:RG,Plane:BG,PlaneIcon:BG,PlaneLanding:FG,PlaneLandingIcon:FG,PlaneTakeoff:zG,PlaneTakeoffIcon:zG,Play:wc,PlayCircle:Af,PlayCircleIcon:Af,PlayIcon:wc,PlaySquare:Lb,PlaySquareIcon:Lb,Plug:UG,Plug2:$G,Plug2Icon:$G,PlugIcon:UG,PlugZap:B2,PlugZap2:B2,PlugZap2Icon:B2,PlugZapIcon:B2,Plus:Mn,PlusCircle:q_,PlusCircleIcon:q_,PlusIcon:Mn,PlusSquare:Ob,PlusSquareIcon:Ob,Pocket:VG,PocketIcon:VG,PocketKnife:qG,PocketKnifeIcon:qG,Podcast:HG,PodcastIcon:HG,Pointer:GG,PointerIcon:GG,PointerOff:WG,PointerOffIcon:WG,Popcorn:KG,PopcornIcon:KG,Popsicle:ZG,PopsicleIcon:ZG,PoundSterling:YG,PoundSterlingIcon:YG,Power:QG,PowerCircle:V_,PowerCircleIcon:V_,PowerIcon:QG,PowerOff:XG,PowerOffIcon:XG,PowerSquare:Db,PowerSquareIcon:Db,Presentation:JG,PresentationIcon:JG,Printer:tK,PrinterCheck:eK,PrinterCheckIcon:eK,PrinterIcon:tK,Projector:rK,ProjectorIcon:rK,Proportions:nK,ProportionsIcon:nK,Puzzle:sK,PuzzleIcon:sK,Pyramid:iK,PyramidIcon:iK,QrCode:aK,QrCodeIcon:aK,Quote:oK,QuoteIcon:oK,Rabbit:lK,RabbitIcon:lK,Radar:cK,RadarIcon:cK,Radiation:dK,RadiationIcon:dK,Radical:uK,RadicalIcon:uK,Radio:ij,RadioIcon:ij,RadioReceiver:hK,RadioReceiverIcon:hK,RadioTower:fK,RadioTowerIcon:fK,Radius:pK,RadiusIcon:pK,RailSymbol:mK,RailSymbolIcon:mK,Rainbow:gK,RainbowIcon:gK,Rat:xK,RatIcon:xK,Ratio:yK,RatioIcon:yK,Receipt:CK,ReceiptCent:vK,ReceiptCentIcon:vK,ReceiptEuro:_K,ReceiptEuroIcon:_K,ReceiptIcon:CK,ReceiptIndianRupee:bK,ReceiptIndianRupeeIcon:bK,ReceiptJapaneseYen:wK,ReceiptJapaneseYenIcon:wK,ReceiptPoundSterling:jK,ReceiptPoundSterlingIcon:jK,ReceiptRussianRuble:kK,ReceiptRussianRubleIcon:kK,ReceiptSwissFranc:NK,ReceiptSwissFrancIcon:NK,ReceiptText:SK,ReceiptTextIcon:SK,RectangleEllipsis:$2,RectangleEllipsisIcon:$2,RectangleHorizontal:MK,RectangleHorizontalIcon:MK,RectangleVertical:TK,RectangleVerticalIcon:TK,Recycle:AK,RecycleIcon:AK,Redo:o4,Redo2:EK,Redo2Icon:EK,RedoDot:IK,RedoDotIcon:IK,RedoIcon:o4,RefreshCcw:LK,RefreshCcwDot:PK,RefreshCcwDotIcon:PK,RefreshCcwIcon:LK,RefreshCw:Fl,RefreshCwIcon:Fl,RefreshCwOff:OK,RefreshCwOffIcon:OK,Refrigerator:DK,RefrigeratorIcon:DK,Regex:RK,RegexIcon:RK,RemoveFormatting:FK,RemoveFormattingIcon:FK,Repeat:$K,Repeat1:zK,Repeat1Icon:zK,Repeat2:BK,Repeat2Icon:BK,RepeatIcon:$K,Replace:qK,ReplaceAll:UK,ReplaceAllIcon:UK,ReplaceIcon:qK,Reply:LT,ReplyAll:VK,ReplyAllIcon:VK,ReplyIcon:LT,Rewind:HK,RewindIcon:HK,Ribbon:WK,RibbonIcon:WK,Rocket:ug,RocketIcon:ug,RockingChair:GK,RockingChairIcon:GK,RollerCoaster:KK,RollerCoasterIcon:KK,Rotate3D:U2,Rotate3DIcon:U2,Rotate3d:U2,Rotate3dIcon:U2,RotateCcw:l4,RotateCcwIcon:l4,RotateCcwSquare:ZK,RotateCcwSquareIcon:ZK,RotateCw:OT,RotateCwIcon:OT,RotateCwSquare:YK,RotateCwSquareIcon:YK,Route:QK,RouteIcon:QK,RouteOff:XK,RouteOffIcon:XK,Router:JK,RouterIcon:JK,Rows:q2,Rows2:q2,Rows2Icon:q2,Rows3:V2,Rows3Icon:V2,Rows4:eZ,Rows4Icon:eZ,RowsIcon:q2,Rss:tZ,RssIcon:tZ,Ruler:rZ,RulerIcon:rZ,RussianRuble:nZ,RussianRubleIcon:nZ,Sailboat:sZ,SailboatIcon:sZ,Salad:iZ,SaladIcon:iZ,Sandwich:aZ,SandwichIcon:aZ,Satellite:lZ,SatelliteDish:oZ,SatelliteDishIcon:oZ,SatelliteIcon:lZ,Save:hg,SaveAll:cZ,SaveAllIcon:cZ,SaveIcon:hg,SaveOff:dZ,SaveOffIcon:dZ,Scale:uZ,Scale3D:H2,Scale3DIcon:H2,Scale3d:H2,Scale3dIcon:H2,ScaleIcon:uZ,Scaling:hZ,ScalingIcon:hZ,Scan:_Z,ScanBarcode:fZ,ScanBarcodeIcon:fZ,ScanEye:pZ,ScanEyeIcon:pZ,ScanFace:mZ,ScanFaceIcon:mZ,ScanIcon:_Z,ScanLine:gZ,ScanLineIcon:gZ,ScanQrCode:xZ,ScanQrCodeIcon:xZ,ScanSearch:yZ,ScanSearchIcon:yZ,ScanText:vZ,ScanTextIcon:vZ,ScatterChart:j_,ScatterChartIcon:j_,School:bZ,School2:Xb,School2Icon:Xb,SchoolIcon:bZ,Scissors:jZ,ScissorsIcon:jZ,ScissorsLineDashed:wZ,ScissorsLineDashedIcon:wZ,ScissorsSquare:Rb,ScissorsSquareDashedBottom:cb,ScissorsSquareDashedBottomIcon:cb,ScissorsSquareIcon:Rb,ScreenShare:NZ,ScreenShareIcon:NZ,ScreenShareOff:kZ,ScreenShareOffIcon:kZ,Scroll:CZ,ScrollIcon:CZ,ScrollText:SZ,ScrollTextIcon:SZ,Search:Ei,SearchCheck:MZ,SearchCheckIcon:MZ,SearchCode:TZ,SearchCodeIcon:TZ,SearchIcon:Ei,SearchSlash:AZ,SearchSlashIcon:AZ,SearchX:EZ,SearchXIcon:EZ,Section:IZ,SectionIcon:IZ,Send:To,SendHorizonal:W2,SendHorizonalIcon:W2,SendHorizontal:W2,SendHorizontalIcon:W2,SendIcon:To,SendToBack:PZ,SendToBackIcon:PZ,SeparatorHorizontal:LZ,SeparatorHorizontalIcon:LZ,SeparatorVertical:OZ,SeparatorVerticalIcon:OZ,Server:zZ,ServerCog:DZ,ServerCogIcon:DZ,ServerCrash:RZ,ServerCrashIcon:RZ,ServerIcon:zZ,ServerOff:FZ,ServerOffIcon:FZ,Settings:od,Settings2:BZ,Settings2Icon:BZ,SettingsIcon:od,Shapes:$Z,ShapesIcon:$Z,Share:DT,Share2:Xd,Share2Icon:Xd,ShareIcon:DT,Sheet:UZ,SheetIcon:UZ,Shell:qZ,ShellIcon:qZ,Shield:lm,ShieldAlert:VZ,ShieldAlertIcon:VZ,ShieldBan:HZ,ShieldBanIcon:HZ,ShieldCheck:RT,ShieldCheckIcon:RT,ShieldClose:G2,ShieldCloseIcon:G2,ShieldEllipsis:WZ,ShieldEllipsisIcon:WZ,ShieldHalf:GZ,ShieldHalfIcon:GZ,ShieldIcon:lm,ShieldMinus:KZ,ShieldMinusIcon:KZ,ShieldOff:ZZ,ShieldOffIcon:ZZ,ShieldPlus:YZ,ShieldPlusIcon:YZ,ShieldQuestion:XZ,ShieldQuestionIcon:XZ,ShieldX:G2,ShieldXIcon:G2,Ship:JZ,ShipIcon:JZ,ShipWheel:QZ,ShipWheelIcon:QZ,Shirt:eY,ShirtIcon:eY,ShoppingBag:fg,ShoppingBagIcon:fg,ShoppingBasket:tY,ShoppingBasketIcon:tY,ShoppingCart:ah,ShoppingCartIcon:ah,Shovel:rY,ShovelIcon:rY,ShowerHead:nY,ShowerHeadIcon:nY,Shrink:sY,ShrinkIcon:sY,Shrub:iY,ShrubIcon:iY,Shuffle:aY,ShuffleIcon:aY,Sidebar:D2,SidebarClose:P2,SidebarCloseIcon:P2,SidebarIcon:D2,SidebarOpen:O2,SidebarOpenIcon:O2,Sigma:oY,SigmaIcon:oY,SigmaSquare:Fb,SigmaSquareIcon:Fb,Signal:hY,SignalHigh:lY,SignalHighIcon:lY,SignalIcon:hY,SignalLow:cY,SignalLowIcon:cY,SignalMedium:dY,SignalMediumIcon:dY,SignalZero:uY,SignalZeroIcon:uY,Signature:fY,SignatureIcon:fY,Signpost:mY,SignpostBig:pY,SignpostBigIcon:pY,SignpostIcon:mY,Siren:gY,SirenIcon:gY,SkipBack:xY,SkipBackIcon:xY,SkipForward:yY,SkipForwardIcon:yY,Skull:vY,SkullIcon:vY,Slack:_Y,SlackIcon:_Y,Slash:bY,SlashIcon:bY,SlashSquare:zb,SlashSquareIcon:zb,Slice:wY,SliceIcon:wY,Sliders:K2,SlidersHorizontal:FT,SlidersHorizontalIcon:FT,SlidersIcon:K2,SlidersVertical:K2,SlidersVerticalIcon:K2,Smartphone:a1,SmartphoneCharging:jY,SmartphoneChargingIcon:jY,SmartphoneIcon:a1,SmartphoneNfc:kY,SmartphoneNfcIcon:kY,Smile:SY,SmileIcon:SY,SmilePlus:NY,SmilePlusIcon:NY,Snail:CY,SnailIcon:CY,Snowflake:I0,SnowflakeIcon:I0,Sofa:MY,SofaIcon:MY,SortAsc:n_,SortAscIcon:n_,SortDesc:e_,SortDescIcon:e_,Soup:TY,SoupIcon:TY,Space:AY,SpaceIcon:AY,Spade:EY,SpadeIcon:EY,Sparkle:IY,SparkleIcon:IY,Sparkles:As,SparklesIcon:As,Speaker:PY,SpeakerIcon:PY,Speech:LY,SpeechIcon:LY,SpellCheck:DY,SpellCheck2:OY,SpellCheck2Icon:OY,SpellCheckIcon:DY,Spline:RY,SplineIcon:RY,Split:FY,SplitIcon:FY,SplitSquareHorizontal:Bb,SplitSquareHorizontalIcon:Bb,SplitSquareVertical:$b,SplitSquareVerticalIcon:$b,SprayCan:zY,SprayCanIcon:zY,Sprout:BY,SproutIcon:BY,Square:cm,SquareActivity:Z2,SquareActivityIcon:Z2,SquareArrowDown:Q2,SquareArrowDownIcon:Q2,SquareArrowDownLeft:Y2,SquareArrowDownLeftIcon:Y2,SquareArrowDownRight:X2,SquareArrowDownRightIcon:X2,SquareArrowLeft:J2,SquareArrowLeftIcon:J2,SquareArrowOutDownLeft:eb,SquareArrowOutDownLeftIcon:eb,SquareArrowOutDownRight:tb,SquareArrowOutDownRightIcon:tb,SquareArrowOutUpLeft:rb,SquareArrowOutUpLeftIcon:rb,SquareArrowOutUpRight:nb,SquareArrowOutUpRightIcon:nb,SquareArrowRight:sb,SquareArrowRightIcon:sb,SquareArrowUp:ob,SquareArrowUpIcon:ob,SquareArrowUpLeft:ib,SquareArrowUpLeftIcon:ib,SquareArrowUpRight:ab,SquareArrowUpRightIcon:ab,SquareAsterisk:lb,SquareAsteriskIcon:lb,SquareBottomDashedScissors:cb,SquareBottomDashedScissorsIcon:cb,SquareChartGantt:Vm,SquareChartGanttIcon:Vm,SquareCheck:db,SquareCheckBig:i0,SquareCheckBigIcon:i0,SquareCheckIcon:db,SquareChevronDown:ub,SquareChevronDownIcon:ub,SquareChevronLeft:hb,SquareChevronLeftIcon:hb,SquareChevronRight:fb,SquareChevronRightIcon:fb,SquareChevronUp:pb,SquareChevronUpIcon:pb,SquareCode:mb,SquareCodeIcon:mb,SquareDashed:yb,SquareDashedBottom:UY,SquareDashedBottomCode:$Y,SquareDashedBottomCodeIcon:$Y,SquareDashedBottomIcon:UY,SquareDashedIcon:yb,SquareDashedKanban:gb,SquareDashedKanbanIcon:gb,SquareDashedMousePointer:xb,SquareDashedMousePointerIcon:xb,SquareDivide:vb,SquareDivideIcon:vb,SquareDot:_b,SquareDotIcon:_b,SquareEqual:bb,SquareEqualIcon:bb,SquareFunction:wb,SquareFunctionIcon:wb,SquareGanttChart:Vm,SquareGanttChartIcon:Vm,SquareIcon:cm,SquareKanban:jb,SquareKanbanIcon:jb,SquareLibrary:kb,SquareLibraryIcon:kb,SquareM:Nb,SquareMIcon:Nb,SquareMenu:Sb,SquareMenuIcon:Sb,SquareMinus:Cb,SquareMinusIcon:Cb,SquareMousePointer:Mb,SquareMousePointerIcon:Mb,SquareParking:Ab,SquareParkingIcon:Ab,SquareParkingOff:Tb,SquareParkingOffIcon:Tb,SquarePen:Jl,SquarePenIcon:Jl,SquarePercent:Eb,SquarePercentIcon:Eb,SquarePi:Ib,SquarePiIcon:Ib,SquarePilcrow:Pb,SquarePilcrowIcon:Pb,SquarePlay:Lb,SquarePlayIcon:Lb,SquarePlus:Ob,SquarePlusIcon:Ob,SquarePower:Db,SquarePowerIcon:Db,SquareRadical:qY,SquareRadicalIcon:qY,SquareScissors:Rb,SquareScissorsIcon:Rb,SquareSigma:Fb,SquareSigmaIcon:Fb,SquareSlash:zb,SquareSlashIcon:zb,SquareSplitHorizontal:Bb,SquareSplitHorizontalIcon:Bb,SquareSplitVertical:$b,SquareSplitVerticalIcon:$b,SquareSquare:VY,SquareSquareIcon:VY,SquareStack:HY,SquareStackIcon:HY,SquareTerminal:Ub,SquareTerminalIcon:Ub,SquareUser:Vb,SquareUserIcon:Vb,SquareUserRound:qb,SquareUserRoundIcon:qb,SquareX:Hb,SquareXIcon:Hb,Squircle:WY,SquircleIcon:WY,Squirrel:GY,SquirrelIcon:GY,Stamp:KY,StampIcon:KY,Star:Bs,StarHalf:ZY,StarHalfIcon:ZY,StarIcon:Bs,StarOff:YY,StarOffIcon:YY,Stars:As,StarsIcon:As,StepBack:XY,StepBackIcon:XY,StepForward:QY,StepForwardIcon:QY,Stethoscope:JY,StethoscopeIcon:JY,Sticker:eX,StickerIcon:eX,StickyNote:tX,StickyNoteIcon:tX,StopCircle:W_,StopCircleIcon:W_,Store:rX,StoreIcon:rX,StretchHorizontal:nX,StretchHorizontalIcon:nX,StretchVertical:sX,StretchVerticalIcon:sX,Strikethrough:iX,StrikethroughIcon:iX,Subscript:aX,SubscriptIcon:aX,Subtitles:u_,SubtitlesIcon:u_,Sun:o1,SunDim:oX,SunDimIcon:oX,SunIcon:o1,SunMedium:lX,SunMediumIcon:lX,SunMoon:cX,SunMoonIcon:cX,SunSnow:dX,SunSnowIcon:dX,Sunrise:uX,SunriseIcon:uX,Sunset:hX,SunsetIcon:hX,Superscript:fX,SuperscriptIcon:fX,SwatchBook:pX,SwatchBookIcon:pX,SwissFranc:mX,SwissFrancIcon:mX,SwitchCamera:gX,SwitchCameraIcon:gX,Sword:xX,SwordIcon:xX,Swords:yX,SwordsIcon:yX,Syringe:vX,SyringeIcon:vX,Table:SX,Table2:zT,Table2Icon:zT,TableCellsMerge:_X,TableCellsMergeIcon:_X,TableCellsSplit:bX,TableCellsSplitIcon:bX,TableColumnsSplit:wX,TableColumnsSplitIcon:wX,TableIcon:SX,TableOfContents:jX,TableOfContentsIcon:jX,TableProperties:kX,TablePropertiesIcon:kX,TableRowsSplit:NX,TableRowsSplitIcon:NX,Tablet:MX,TabletIcon:MX,TabletSmartphone:CX,TabletSmartphoneIcon:CX,Tablets:TX,TabletsIcon:TX,Tag:aj,TagIcon:aj,Tags:AX,TagsIcon:AX,Tally1:EX,Tally1Icon:EX,Tally2:IX,Tally2Icon:IX,Tally3:PX,Tally3Icon:PX,Tally4:LX,Tally4Icon:LX,Tally5:OX,Tally5Icon:OX,Tangent:DX,TangentIcon:DX,Target:Rx,TargetIcon:Rx,Telescope:RX,TelescopeIcon:RX,Tent:zX,TentIcon:zX,TentTree:FX,TentTreeIcon:FX,Terminal:BX,TerminalIcon:BX,TerminalSquare:Ub,TerminalSquareIcon:Ub,TestTube:$X,TestTube2:Wb,TestTube2Icon:Wb,TestTubeDiagonal:Wb,TestTubeDiagonalIcon:Wb,TestTubeIcon:$X,TestTubes:UX,TestTubesIcon:UX,Text:GX,TextCursor:VX,TextCursorIcon:VX,TextCursorInput:qX,TextCursorInputIcon:qX,TextIcon:GX,TextQuote:HX,TextQuoteIcon:HX,TextSearch:WX,TextSearchIcon:WX,TextSelect:Gb,TextSelectIcon:Gb,TextSelection:Gb,TextSelectionIcon:Gb,Theater:KX,TheaterIcon:KX,Thermometer:XX,ThermometerIcon:XX,ThermometerSnowflake:ZX,ThermometerSnowflakeIcon:ZX,ThermometerSun:YX,ThermometerSunIcon:YX,ThumbsDown:BT,ThumbsDownIcon:BT,ThumbsUp:Ad,ThumbsUpIcon:Ad,Ticket:$T,TicketCheck:QX,TicketCheckIcon:QX,TicketIcon:$T,TicketMinus:JX,TicketMinusIcon:JX,TicketPercent:eQ,TicketPercentIcon:eQ,TicketPlus:tQ,TicketPlusIcon:tQ,TicketSlash:rQ,TicketSlashIcon:rQ,TicketX:nQ,TicketXIcon:nQ,Tickets:iQ,TicketsIcon:iQ,TicketsPlane:sQ,TicketsPlaneIcon:sQ,Timer:lQ,TimerIcon:lQ,TimerOff:aQ,TimerOffIcon:aQ,TimerReset:oQ,TimerResetIcon:oQ,ToggleLeft:cQ,ToggleLeftIcon:cQ,ToggleRight:dQ,ToggleRightIcon:dQ,Toilet:uQ,ToiletIcon:uQ,Tornado:hQ,TornadoIcon:hQ,Torus:fQ,TorusIcon:fQ,Touchpad:mQ,TouchpadIcon:mQ,TouchpadOff:pQ,TouchpadOffIcon:pQ,TowerControl:gQ,TowerControlIcon:gQ,ToyBrick:xQ,ToyBrickIcon:xQ,Tractor:yQ,TractorIcon:yQ,TrafficCone:vQ,TrafficConeIcon:vQ,Train:Kb,TrainFront:bQ,TrainFrontIcon:bQ,TrainFrontTunnel:_Q,TrainFrontTunnelIcon:_Q,TrainIcon:Kb,TrainTrack:wQ,TrainTrackIcon:wQ,TramFront:Kb,TramFrontIcon:Kb,Trash:jQ,Trash2:es,Trash2Icon:es,TrashIcon:jQ,TreeDeciduous:kQ,TreeDeciduousIcon:kQ,TreePalm:Zb,TreePalmIcon:Zb,TreePine:l1,TreePineIcon:l1,Trees:NQ,TreesIcon:NQ,Trello:SQ,TrelloIcon:SQ,TrendingDown:c1,TrendingDownIcon:c1,TrendingUp:qf,TrendingUpDown:CQ,TrendingUpDownIcon:CQ,TrendingUpIcon:qf,Triangle:TQ,TriangleAlert:Lh,TriangleAlertIcon:Lh,TriangleIcon:TQ,TriangleRight:MQ,TriangleRightIcon:MQ,Trophy:qa,TrophyIcon:qa,Truck:UT,TruckIcon:UT,Turtle:AQ,TurtleIcon:AQ,Tv:IQ,Tv2:Yb,Tv2Icon:Yb,TvIcon:IQ,TvMinimal:Yb,TvMinimalIcon:Yb,TvMinimalPlay:EQ,TvMinimalPlayIcon:EQ,Twitch:PQ,TwitchIcon:PQ,Twitter:LQ,TwitterIcon:LQ,Type:DQ,TypeIcon:DQ,TypeOutline:OQ,TypeOutlineIcon:OQ,Umbrella:FQ,UmbrellaIcon:FQ,UmbrellaOff:RQ,UmbrellaOffIcon:RQ,Underline:zQ,UnderlineIcon:zQ,Undo:c4,Undo2:BQ,Undo2Icon:BQ,UndoDot:$Q,UndoDotIcon:$Q,UndoIcon:c4,UnfoldHorizontal:UQ,UnfoldHorizontalIcon:UQ,UnfoldVertical:qQ,UnfoldVerticalIcon:qQ,Ungroup:VQ,UngroupIcon:VQ,University:Xb,UniversityIcon:Xb,Unlink:qT,Unlink2:HQ,Unlink2Icon:HQ,UnlinkIcon:qT,Unlock:N2,UnlockIcon:N2,UnlockKeyhole:k2,UnlockKeyholeIcon:k2,Unplug:WQ,UnplugIcon:WQ,Upload:Ao,UploadCloud:Q_,UploadCloudIcon:Q_,UploadIcon:Ao,Usb:GQ,UsbIcon:GQ,User:jc,User2:nw,User2Icon:nw,UserCheck:oj,UserCheck2:Qb,UserCheck2Icon:Qb,UserCheckIcon:oj,UserCircle:K_,UserCircle2:G_,UserCircle2Icon:G_,UserCircleIcon:K_,UserCog:VT,UserCog2:Jb,UserCog2Icon:Jb,UserCogIcon:VT,UserIcon:jc,UserMinus:KQ,UserMinus2:ew,UserMinus2Icon:ew,UserMinusIcon:KQ,UserPen:ZQ,UserPenIcon:ZQ,UserPlus:d1,UserPlus2:tw,UserPlus2Icon:tw,UserPlusIcon:d1,UserRound:nw,UserRoundCheck:Qb,UserRoundCheckIcon:Qb,UserRoundCog:Jb,UserRoundCogIcon:Jb,UserRoundIcon:nw,UserRoundMinus:ew,UserRoundMinusIcon:ew,UserRoundPen:YQ,UserRoundPenIcon:YQ,UserRoundPlus:tw,UserRoundPlusIcon:tw,UserRoundSearch:XQ,UserRoundSearchIcon:XQ,UserRoundX:rw,UserRoundXIcon:rw,UserSearch:QQ,UserSearchIcon:QQ,UserSquare:Vb,UserSquare2:qb,UserSquare2Icon:qb,UserSquareIcon:Vb,UserX:JQ,UserX2:rw,UserX2Icon:rw,UserXIcon:JQ,Users:fs,Users2:sw,Users2Icon:sw,UsersIcon:fs,UsersRound:sw,UsersRoundIcon:sw,Utensils:aw,UtensilsCrossed:iw,UtensilsCrossedIcon:iw,UtensilsIcon:aw,UtilityPole:eJ,UtilityPoleIcon:eJ,Variable:HT,VariableIcon:HT,Vault:tJ,VaultIcon:tJ,Vegan:rJ,VeganIcon:rJ,VenetianMask:nJ,VenetianMaskIcon:nJ,Verified:a_,VerifiedIcon:a_,Vibrate:iJ,VibrateIcon:iJ,VibrateOff:sJ,VibrateOffIcon:sJ,Video:Wi,VideoIcon:Wi,VideoOff:aJ,VideoOffIcon:aJ,Videotape:oJ,VideotapeIcon:oJ,View:lJ,ViewIcon:lJ,Voicemail:cJ,VoicemailIcon:cJ,Volleyball:dJ,VolleyballIcon:dJ,Volume:mJ,Volume1:uJ,Volume1Icon:uJ,Volume2:hJ,Volume2Icon:hJ,VolumeIcon:mJ,VolumeOff:fJ,VolumeOffIcon:fJ,VolumeX:pJ,VolumeXIcon:pJ,Vote:gJ,VoteIcon:gJ,Wallet:yJ,Wallet2:ow,Wallet2Icon:ow,WalletCards:xJ,WalletCardsIcon:xJ,WalletIcon:yJ,WalletMinimal:ow,WalletMinimalIcon:ow,Wallpaper:vJ,WallpaperIcon:vJ,Wand:_J,Wand2:lw,Wand2Icon:lw,WandIcon:_J,WandSparkles:lw,WandSparklesIcon:lw,Warehouse:bJ,WarehouseIcon:bJ,WashingMachine:wJ,WashingMachineIcon:wJ,Watch:jJ,WatchIcon:jJ,Waves:kJ,WavesIcon:kJ,Waypoints:NJ,WaypointsIcon:NJ,Webcam:SJ,WebcamIcon:SJ,Webhook:MJ,WebhookIcon:MJ,WebhookOff:CJ,WebhookOffIcon:CJ,Weight:TJ,WeightIcon:TJ,Wheat:EJ,WheatIcon:EJ,WheatOff:AJ,WheatOffIcon:AJ,WholeWord:IJ,WholeWordIcon:IJ,Wifi:RJ,WifiHigh:PJ,WifiHighIcon:PJ,WifiIcon:RJ,WifiLow:LJ,WifiLowIcon:LJ,WifiOff:OJ,WifiOffIcon:OJ,WifiZero:DJ,WifiZeroIcon:DJ,Wind:zJ,WindArrowDown:FJ,WindArrowDownIcon:FJ,WindIcon:zJ,Wine:$J,WineIcon:$J,WineOff:BJ,WineOffIcon:BJ,Workflow:UJ,WorkflowIcon:UJ,Worm:qJ,WormIcon:qJ,WrapText:VJ,WrapTextIcon:VJ,Wrench:Fx,WrenchIcon:Fx,X:Es,XCircle:Oc,XCircleIcon:Oc,XIcon:Es,XOctagon:A2,XOctagonIcon:A2,XSquare:Hb,XSquareIcon:Hb,Youtube:HJ,YoutubeIcon:HJ,Zap:u1,ZapIcon:u1,ZapOff:WJ,ZapOffIcon:WJ,ZoomIn:d4,ZoomInIcon:d4,ZoomOut:u4,ZoomOutIcon:u4,createLucideIcon:U,icons:qKe},Symbol.toStringTag,{value:"Module"})),Pme="-",VKe=t=>{const e=WKe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:c=>{const a=c.split(Pme);return a[0]===""&&a.length!==1&&a.shift(),hAe(a,e)||HKe(c)},getConflictingClassGroupIds:(c,a)=>{const h=n[c]||[];return a&&s[c]?[...h,...s[c]]:h}}},hAe=(t,e)=>{var c;if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),i=s?hAe(t.slice(1),s):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(Pme);return(c=e.validators.find(({validator:a})=>a(o)))==null?void 0:c.classGroupId},Dbe=/^\[(.+)\]$/,HKe=t=>{if(Dbe.test(t)){const e=Dbe.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},WKe=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};return KKe(Object.entries(t.classGroups),n).forEach(([o,c])=>{rue(c,s,o,e)}),s},rue=(t,e,n,s)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:Rbe(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(GKe(i)){rue(i(s),e,n,s);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,c])=>{rue(c,Rbe(e,o),n,s)})})},Rbe=(t,e)=>{let n=t;return e.split(Pme).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},GKe=t=>t.isThemeGetter,KKe=(t,e)=>e?t.map(([n,s])=>{const i=s.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([c,a])=>[e+c,a])):o);return[n,i]}):t,ZKe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,s=new Map;const i=(o,c)=>{n.set(o,c),e++,e>t&&(e=0,s=n,n=new Map)};return{get(o){let c=n.get(o);if(c!==void 0)return c;if((c=s.get(o))!==void 0)return i(o,c),c},set(o,c){n.has(o)?n.set(o,c):i(o,c)}}},fAe="!",YKe=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,i=e[0],o=e.length,c=a=>{const h=[];let m=0,x=0,v;for(let T=0;Tx?v-x:void 0;return{modifiers:h,hasImportantModifier:k,baseClassName:C,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:c}):c},XKe=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(s=>{s[0]==="["?(e.push(...n.sort(),s),n=[]):n.push(s)}),e.push(...n.sort()),e},QKe=t=>({cache:ZKe(t.cacheSize),parseClassName:YKe(t),...VKe(t)}),JKe=/\s+/,eZe=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=e,o=[],c=t.trim().split(JKe);let a="";for(let h=c.length-1;h>=0;h-=1){const m=c[h],{modifiers:x,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:k}=n(m);let C=!!k,S=s(C?w.substring(0,k):w);if(!S){if(!C){a=m+(a.length>0?" "+a:a);continue}if(S=s(w),!S){a=m+(a.length>0?" "+a:a);continue}C=!1}const T=XKe(x).join(":"),I=v?T+fAe:T,A=I+S;if(o.includes(A))continue;o.push(A);const D=i(S,C);for(let $=0;$0?" "+a:a)}return a};function tZe(){let t=0,e,n,s="";for(;t{if(typeof t=="string")return t;let e,n="";for(let s=0;sv(x),t());return n=QKe(m),s=n.cache.get,i=n.cache.set,o=a,a(h)}function a(h){const m=s(h);if(m)return m;const x=eZe(h,n);return i(h,x),x}return function(){return o(tZe.apply(null,arguments))}}const nl=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},mAe=/^\[(?:([a-z-]+):)?(.+)\]$/i,nZe=/^\d+\/\d+$/,sZe=new Set(["px","full","screen"]),iZe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aZe=/\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$/,oZe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,lZe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cZe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nx=t=>h4(t)||sZe.has(t)||nZe.test(t),Wy=t=>HC(t,"length",xZe),h4=t=>!!t&&!Number.isNaN(Number(t)),cle=t=>HC(t,"number",h4),kM=t=>!!t&&Number.isInteger(Number(t)),dZe=t=>t.endsWith("%")&&h4(t.slice(0,-1)),ta=t=>mAe.test(t),Gy=t=>iZe.test(t),uZe=new Set(["length","size","percentage"]),hZe=t=>HC(t,uZe,gAe),fZe=t=>HC(t,"position",gAe),pZe=new Set(["image","url"]),mZe=t=>HC(t,pZe,vZe),gZe=t=>HC(t,"",yZe),NM=()=>!0,HC=(t,e,n)=>{const s=mAe.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},xZe=t=>aZe.test(t)&&!oZe.test(t),gAe=()=>!1,yZe=t=>lZe.test(t),vZe=t=>cZe.test(t),_Ze=()=>{const t=nl("colors"),e=nl("spacing"),n=nl("blur"),s=nl("brightness"),i=nl("borderColor"),o=nl("borderRadius"),c=nl("borderSpacing"),a=nl("borderWidth"),h=nl("contrast"),m=nl("grayscale"),x=nl("hueRotate"),v=nl("invert"),w=nl("gap"),k=nl("gradientColorStops"),C=nl("gradientColorStopPositions"),S=nl("inset"),T=nl("margin"),I=nl("opacity"),A=nl("padding"),D=nl("saturate"),$=nl("scale"),F=nl("sepia"),q=nl("skew"),W=nl("space"),K=nl("translate"),Z=()=>["auto","contain","none"],re=()=>["auto","hidden","clip","visible","scroll"],he=()=>["auto",ta,e],ue=()=>[ta,e],je=()=>["",nx,Wy],ne=()=>["auto",h4,ta],ye=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>["start","end","center","between","around","evenly","stretch"],ve=()=>["","0",ta],Ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Se=()=>[h4,ta];return{cacheSize:500,separator:":",theme:{colors:[NM],spacing:[nx,Wy],blur:["none","",Gy,ta],brightness:Se(),borderColor:[t],borderRadius:["none","","full",Gy,ta],borderSpacing:ue(),borderWidth:je(),contrast:Se(),grayscale:ve(),hueRotate:Se(),invert:ve(),gap:ue(),gradientColorStops:[t],gradientColorStopPositions:[dZe,Wy],inset:he(),margin:he(),opacity:Se(),padding:ue(),saturate:Se(),scale:Se(),sepia:ve(),skew:Se(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",ta]}],container:["container"],columns:[{columns:[Gy]}],"break-after":[{"break-after":Ie()}],"break-before":[{"break-before":Ie()}],"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:[...ye(),ta]}],overflow:[{overflow:re()}],"overflow-x":[{"overflow-x":re()}],"overflow-y":[{"overflow-y":re()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",kM,ta]}],basis:[{basis:he()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ta]}],grow:[{grow:ve()}],shrink:[{shrink:ve()}],order:[{order:["first","last","none",kM,ta]}],"grid-cols":[{"grid-cols":[NM]}],"col-start-end":[{col:["auto",{span:["full",kM,ta]},ta]}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":[NM]}],"row-start-end":[{row:["auto",{span:[kM,ta]},ta]}],"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",ta]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ta]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...fe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...fe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...fe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[T]}],mx:[{mx:[T]}],my:[{my:[T]}],ms:[{ms:[T]}],me:[{me:[T]}],mt:[{mt:[T]}],mr:[{mr:[T]}],mb:[{mb:[T]}],ml:[{ml:[T]}],"space-x":[{"space-x":[W]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[W]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ta,e]}],"min-w":[{"min-w":[ta,e,"min","max","fit"]}],"max-w":[{"max-w":[ta,e,"none","full","min","max","fit","prose",{screen:[Gy]},Gy]}],h:[{h:[ta,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ta,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ta,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ta,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gy,Wy]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",cle]}],"font-family":[{font:[NM]}],"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",ta]}],"line-clamp":[{"line-clamp":["none",h4,cle]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",nx,ta]}],"list-image":[{"list-image":["none",ta]}],"list-style-type":[{list:["none","disc","decimal",ta]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",nx,Wy]}],"underline-offset":[{"underline-offset":["auto",nx,ta]}],"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:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ta]}],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",ta]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ye(),fZe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",hZe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mZe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],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:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[I]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[I]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[nx,ta]}],"outline-w":[{outline:[nx,Wy]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:je()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[nx,Wy]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Gy,gZe]}],"shadow-color":[{shadow:[NM]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":[...me(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":me()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",Gy,ta]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[v]}],saturate:[{saturate:[D]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[v]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[D]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ta]}],duration:[{duration:Se()}],ease:[{ease:["linear","in","out","in-out",ta]}],delay:[{delay:Se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ta]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[$]}],"scale-x":[{"scale-x":[$]}],"scale-y":[{"scale-y":[$]}],rotate:[{rotate:[kM,ta]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[q]}],"skew-y":[{"skew-y":[q]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ta]}],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",ta]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"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",ta]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[nx,Wy,cle]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},bZe=rZe(_Ze);function $t(...t){return bZe(ra(t))}function Nd(t,e=!1){return e&&t>=1e6?`$${(t/1e6).toFixed(1)}M`:e&&t>=1e3?`$${(t/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}function Fbe(t){const e=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(e)}function jne(t){return t?t.replace(/<[^>]*>/g,""):""}const wZe=BKe,xAe=P.forwardRef(({className:t,...e},n)=>r.jsx(rAe,{ref:n,className:$t("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));xAe.displayName=rAe.displayName;const jZe=VC("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"}}),yAe=P.forwardRef(({className:t,variant:e,...n},s)=>r.jsx(nAe,{ref:s,className:$t(jZe({variant:e}),t),...n}));yAe.displayName=nAe.displayName;const kZe=P.forwardRef(({className:t,...e},n)=>r.jsx(aAe,{ref:n,className:$t("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));kZe.displayName=aAe.displayName;const vAe=P.forwardRef(({className:t,...e},n)=>r.jsx(oAe,{ref:n,className:$t("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:r.jsx(Es,{className:"h-4 w-4"})}));vAe.displayName=oAe.displayName;const _Ae=P.forwardRef(({className:t,...e},n)=>r.jsx(sAe,{ref:n,className:$t("text-sm font-semibold",t),...e}));_Ae.displayName=sAe.displayName;const bAe=P.forwardRef(({className:t,...e},n)=>r.jsx(iAe,{ref:n,className:$t("text-sm opacity-90",t),...e}));bAe.displayName=iAe.displayName;function NZe(){const{toasts:t}=ua();return r.jsxs(wZe,{children:[t.map(function({id:e,title:n,description:s,action:i,...o}){return r.jsxs(yAe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(_Ae,{children:n}),s&&r.jsx(bAe,{children:s})]}),i,r.jsx(vAe,{})]},e)}),r.jsx(xAe,{})]})}var zbe=["light","dark"],SZe="(prefers-color-scheme: dark)",CZe=P.createContext(void 0),MZe={setTheme:t=>{},themes:[]},TZe=()=>{var t;return(t=P.useContext(CZe))!=null?t:MZe};P.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:s,enableColorScheme:i,defaultTheme:o,value:c,attrs:a,nonce:h})=>{let m=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(C=>`'${C}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,v=i?zbe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",w=(C,S=!1,T=!0)=>{let I=c?c[C]:C,A=S?C+"|| ''":`'${I}'`,D="";return i&&T&&!S&&zbe.includes(C)&&(D+=`d.style.colorScheme = '${C}';`),n==="class"?S||I?D+=`c.add(${A})`:D+="null":I&&(D+=`d[s](n,${A})`),D},k=t?`!function(){${x}${w(t)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${m})){var t='${SZe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${w("dark")}}else{${w("light")}}}else if(e){${c?`var x=${JSON.stringify(c)};`:""}${w(c?"x[e]":"e",!0)}}${m?"":"else{"+w(o,!1,!1)+"}"}${v}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${e}');if(e){${c?`var x=${JSON.stringify(c)};`:""}${w(c?"x[e]":"e",!0)}}else{${w(o,!1,!1)};}${v}}catch(t){}}();`;return P.createElement("script",{nonce:h,dangerouslySetInnerHTML:{__html:k}})});var AZe=t=>{switch(t){case"success":return PZe;case"info":return OZe;case"warning":return LZe;case"error":return DZe;default:return null}},EZe=Array(12).fill(0),IZe=({visible:t,className:e})=>lt.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},lt.createElement("div",{className:"sonner-spinner"},EZe.map((n,s)=>lt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),PZe=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"})),LZe=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"})),OZe=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"})),DZe=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"})),RZe=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"})),FZe=()=>{let[t,e]=lt.useState(document.hidden);return lt.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},nue=1,zZe=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...s}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:nue++,o=this.toasts.find(a=>a.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...t,id:i,title:n}),{...a,...t,id:i,dismissible:c,title:n}):a):this.addToast({title:n,...s,dismissible:c,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let s=t instanceof Promise?t:t(),i=n!==void 0,o,c=s.then(async h=>{if(o=["resolve",h],lt.isValidElement(h))i=!1,this.create({id:n,type:"default",message:h});else if($Ze(h)&&!h.ok){i=!1;let m=typeof e.error=="function"?await e.error(`HTTP error! status: ${h.status}`):e.error,x=typeof e.description=="function"?await e.description(`HTTP error! status: ${h.status}`):e.description;this.create({id:n,type:"error",message:m,description:x})}else if(e.success!==void 0){i=!1;let m=typeof e.success=="function"?await e.success(h):e.success,x=typeof e.description=="function"?await e.description(h):e.description;this.create({id:n,type:"success",message:m,description:x})}}).catch(async h=>{if(o=["reject",h],e.error!==void 0){i=!1;let m=typeof e.error=="function"?await e.error(h):e.error,x=typeof e.description=="function"?await e.description(h):e.description;this.create({id:n,type:"error",message:m,description:x})}}).finally(()=>{var h;i&&(this.dismiss(n),n=void 0),(h=e.finally)==null||h.call(e)}),a=()=>new Promise((h,m)=>c.then(()=>o[0]==="reject"?m(o[1]):h(o[1])).catch(m));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||nue++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},th=new zZe,BZe=(t,e)=>{let n=(e==null?void 0:e.id)||nue++;return th.addToast({title:t,...e,id:n}),n},$Ze=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",UZe=BZe,qZe=()=>th.toasts,VZe=()=>th.getActiveToasts(),He=Object.assign(UZe,{success:th.success,info:th.info,warning:th.warning,error:th.error,custom:th.custom,message:th.message,promise:th.promise,dismiss:th.dismiss,loading:th.loading},{getHistory:qZe,getToasts:VZe});function HZe(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",e==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}HZe(`: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 K6(t){return t.label!==void 0}var WZe=3,GZe="32px",KZe="16px",Bbe=4e3,ZZe=356,YZe=14,XZe=20,QZe=200;function Pp(...t){return t.filter(Boolean).join(" ")}function JZe(t){let[e,n]=t.split("-"),s=[];return e&&s.push(e),n&&s.push(n),s}var eYe=t=>{var e,n,s,i,o,c,a,h,m,x,v;let{invert:w,toast:k,unstyled:C,interacting:S,setHeights:T,visibleToasts:I,heights:A,index:D,toasts:$,expanded:F,removeToast:q,defaultRichColors:W,closeButton:K,style:Z,cancelButtonStyle:re,actionButtonStyle:he,className:ue="",descriptionClassName:je="",duration:ne,position:ye,gap:ie,loadingIcon:me,expandByDefault:fe,classNames:ve,icons:Ie,closeButtonAriaLabel:Se="Close toast",pauseWhenPageIsHidden:oe}=t,[ae,Ne]=lt.useState(null),[Te,Be]=lt.useState(null),[Le,Qe]=lt.useState(!1),[Fe,Ce]=lt.useState(!1),[Je,Ae]=lt.useState(!1),[Ye,ge]=lt.useState(!1),[ft,nt]=lt.useState(!1),[Ve,Me]=lt.useState(0),[rt,Re]=lt.useState(0),Ge=lt.useRef(k.duration||ne||Bbe),tt=lt.useRef(null),Et=lt.useRef(null),Lt=D===0,Ot=D+1<=I,Dt=k.type,kt=k.dismissible!==!1,sr=k.className||"",Pr=k.descriptionClassName||"",wn=lt.useMemo(()=>A.findIndex(bs=>bs.toastId===k.id)||0,[A,k.id]),kn=lt.useMemo(()=>{var bs;return(bs=k.closeButton)!=null?bs:K},[k.closeButton,K]),pn=lt.useMemo(()=>k.duration||ne||Bbe,[k.duration,ne]),qn=lt.useRef(0),Fs=lt.useRef(0),_r=lt.useRef(0),js=lt.useRef(null),[Ii,fi]=ye.split("-"),Aa=lt.useMemo(()=>A.reduce((bs,Ci,Mi)=>Mi>=wn?bs:bs+Ci.height,0),[A,wn]),ca=FZe(),Yo=k.invert||w,Xo=Dt==="loading";Fs.current=lt.useMemo(()=>wn*ie+Aa,[wn,Aa]),lt.useEffect(()=>{Ge.current=pn},[pn]),lt.useEffect(()=>{Qe(!0)},[]),lt.useEffect(()=>{let bs=Et.current;if(bs){let Ci=bs.getBoundingClientRect().height;return Re(Ci),T(Mi=>[{toastId:k.id,height:Ci,position:k.position},...Mi]),()=>T(Mi=>Mi.filter(Eo=>Eo.toastId!==k.id))}},[T,k.id]),lt.useLayoutEffect(()=>{if(!Le)return;let bs=Et.current,Ci=bs.style.height;bs.style.height="auto";let Mi=bs.getBoundingClientRect().height;bs.style.height=Ci,Re(Mi),T(Eo=>Eo.find(ir=>ir.toastId===k.id)?Eo.map(ir=>ir.toastId===k.id?{...ir,height:Mi}:ir):[{toastId:k.id,height:Mi,position:k.position},...Eo])},[Le,k.title,k.description,T,k.id]);let Hs=lt.useCallback(()=>{Ce(!0),Me(Fs.current),T(bs=>bs.filter(Ci=>Ci.toastId!==k.id)),setTimeout(()=>{q(k)},QZe)},[k,q,T,Fs]);lt.useEffect(()=>{if(k.promise&&Dt==="loading"||k.duration===1/0||k.type==="loading")return;let bs;return F||S||oe&&ca?(()=>{if(_r.current{var Ci;(Ci=k.onAutoClose)==null||Ci.call(k,k),Hs()},Ge.current)),()=>clearTimeout(bs)},[F,S,k,Dt,oe,ca,Hs]),lt.useEffect(()=>{k.delete&&Hs()},[Hs,k.delete]);function Ki(){var bs,Ci,Mi;return Ie!=null&&Ie.loading?lt.createElement("div",{className:Pp(ve==null?void 0:ve.loader,(bs=k==null?void 0:k.classNames)==null?void 0:bs.loader,"sonner-loader"),"data-visible":Dt==="loading"},Ie.loading):me?lt.createElement("div",{className:Pp(ve==null?void 0:ve.loader,(Ci=k==null?void 0:k.classNames)==null?void 0:Ci.loader,"sonner-loader"),"data-visible":Dt==="loading"},me):lt.createElement(IZe,{className:Pp(ve==null?void 0:ve.loader,(Mi=k==null?void 0:k.classNames)==null?void 0:Mi.loader),visible:Dt==="loading"})}return lt.createElement("li",{tabIndex:0,ref:Et,className:Pp(ue,sr,ve==null?void 0:ve.toast,(e=k==null?void 0:k.classNames)==null?void 0:e.toast,ve==null?void 0:ve.default,ve==null?void 0:ve[Dt],(n=k==null?void 0:k.classNames)==null?void 0:n[Dt]),"data-sonner-toast":"","data-rich-colors":(s=k.richColors)!=null?s:W,"data-styled":!(k.jsx||k.unstyled||C),"data-mounted":Le,"data-promise":!!k.promise,"data-swiped":ft,"data-removed":Fe,"data-visible":Ot,"data-y-position":Ii,"data-x-position":fi,"data-index":D,"data-front":Lt,"data-swiping":Je,"data-dismissible":kt,"data-type":Dt,"data-invert":Yo,"data-swipe-out":Ye,"data-swipe-direction":Te,"data-expanded":!!(F||fe&&Le),style:{"--index":D,"--toasts-before":D,"--z-index":$.length-D,"--offset":`${Fe?Ve:Fs.current}px`,"--initial-height":fe?"auto":`${rt}px`,...Z,...k.style},onDragEnd:()=>{Ae(!1),Ne(null),js.current=null},onPointerDown:bs=>{Xo||!kt||(tt.current=new Date,Me(Fs.current),bs.target.setPointerCapture(bs.pointerId),bs.target.tagName!=="BUTTON"&&(Ae(!0),js.current={x:bs.clientX,y:bs.clientY}))},onPointerUp:()=>{var bs,Ci,Mi,Eo;if(Ye||!kt)return;js.current=null;let ir=Number(((bs=Et.current)==null?void 0:bs.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ho=Number(((Ci=Et.current)==null?void 0:Ci.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Nc=new Date().getTime()-((Mi=tt.current)==null?void 0:Mi.getTime()),fo=ae==="x"?ir:ho,rs=Math.abs(fo)/Nc;if(Math.abs(fo)>=XZe||rs>.11){Me(Fs.current),(Eo=k.onDismiss)==null||Eo.call(k,k),Be(ae==="x"?ir>0?"right":"left":ho>0?"down":"up"),Hs(),ge(!0),nt(!1);return}Ae(!1),Ne(null)},onPointerMove:bs=>{var Ci,Mi,Eo,ir;if(!js.current||!kt||((Ci=window.getSelection())==null?void 0:Ci.toString().length)>0)return;let ho=bs.clientY-js.current.y,Nc=bs.clientX-js.current.x,fo=(Mi=t.swipeDirections)!=null?Mi:JZe(ye);!ae&&(Math.abs(Nc)>1||Math.abs(ho)>1)&&Ne(Math.abs(Nc)>Math.abs(ho)?"x":"y");let rs={x:0,y:0};ae==="y"?(fo.includes("top")||fo.includes("bottom"))&&(fo.includes("top")&&ho<0||fo.includes("bottom")&&ho>0)&&(rs.y=ho):ae==="x"&&(fo.includes("left")||fo.includes("right"))&&(fo.includes("left")&&Nc<0||fo.includes("right")&&Nc>0)&&(rs.x=Nc),(Math.abs(rs.x)>0||Math.abs(rs.y)>0)&&nt(!0),(Eo=Et.current)==null||Eo.style.setProperty("--swipe-amount-x",`${rs.x}px`),(ir=Et.current)==null||ir.style.setProperty("--swipe-amount-y",`${rs.y}px`)}},kn&&!k.jsx?lt.createElement("button",{"aria-label":Se,"data-disabled":Xo,"data-close-button":!0,onClick:Xo||!kt?()=>{}:()=>{var bs;Hs(),(bs=k.onDismiss)==null||bs.call(k,k)},className:Pp(ve==null?void 0:ve.closeButton,(i=k==null?void 0:k.classNames)==null?void 0:i.closeButton)},(o=Ie==null?void 0:Ie.close)!=null?o:RZe):null,k.jsx||P.isValidElement(k.title)?k.jsx?k.jsx:typeof k.title=="function"?k.title():k.title:lt.createElement(lt.Fragment,null,Dt||k.icon||k.promise?lt.createElement("div",{"data-icon":"",className:Pp(ve==null?void 0:ve.icon,(c=k==null?void 0:k.classNames)==null?void 0:c.icon)},k.promise||k.type==="loading"&&!k.icon?k.icon||Ki():null,k.type!=="loading"?k.icon||(Ie==null?void 0:Ie[Dt])||AZe(Dt):null):null,lt.createElement("div",{"data-content":"",className:Pp(ve==null?void 0:ve.content,(a=k==null?void 0:k.classNames)==null?void 0:a.content)},lt.createElement("div",{"data-title":"",className:Pp(ve==null?void 0:ve.title,(h=k==null?void 0:k.classNames)==null?void 0:h.title)},typeof k.title=="function"?k.title():k.title),k.description?lt.createElement("div",{"data-description":"",className:Pp(je,Pr,ve==null?void 0:ve.description,(m=k==null?void 0:k.classNames)==null?void 0:m.description)},typeof k.description=="function"?k.description():k.description):null),P.isValidElement(k.cancel)?k.cancel:k.cancel&&K6(k.cancel)?lt.createElement("button",{"data-button":!0,"data-cancel":!0,style:k.cancelButtonStyle||re,onClick:bs=>{var Ci,Mi;K6(k.cancel)&&kt&&((Mi=(Ci=k.cancel).onClick)==null||Mi.call(Ci,bs),Hs())},className:Pp(ve==null?void 0:ve.cancelButton,(x=k==null?void 0:k.classNames)==null?void 0:x.cancelButton)},k.cancel.label):null,P.isValidElement(k.action)?k.action:k.action&&K6(k.action)?lt.createElement("button",{"data-button":!0,"data-action":!0,style:k.actionButtonStyle||he,onClick:bs=>{var Ci,Mi;K6(k.action)&&((Mi=(Ci=k.action).onClick)==null||Mi.call(Ci,bs),!bs.defaultPrevented&&Hs())},className:Pp(ve==null?void 0:ve.actionButton,(v=k==null?void 0:k.classNames)==null?void 0:v.actionButton)},k.action.label):null))};function $be(){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 tYe(t,e){let n={};return[t,e].forEach((s,i)=>{let o=i===1,c=o?"--mobile-offset":"--offset",a=o?KZe:GZe;function h(m){["top","right","bottom","left"].forEach(x=>{n[`${c}-${x}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?n[`${c}-${m}`]=a:n[`${c}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):h(a)}),n}var rYe=P.forwardRef(function(t,e){let{invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:c,className:a,offset:h,mobileOffset:m,theme:x="light",richColors:v,duration:w,style:k,visibleToasts:C=WZe,toastOptions:S,dir:T=$be(),gap:I=YZe,loadingIcon:A,icons:D,containerAriaLabel:$="Notifications",pauseWhenPageIsHidden:F}=t,[q,W]=lt.useState([]),K=lt.useMemo(()=>Array.from(new Set([s].concat(q.filter(oe=>oe.position).map(oe=>oe.position)))),[q,s]),[Z,re]=lt.useState([]),[he,ue]=lt.useState(!1),[je,ne]=lt.useState(!1),[ye,ie]=lt.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),me=lt.useRef(null),fe=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),ve=lt.useRef(null),Ie=lt.useRef(!1),Se=lt.useCallback(oe=>{W(ae=>{var Ne;return(Ne=ae.find(Te=>Te.id===oe.id))!=null&&Ne.delete||th.dismiss(oe.id),ae.filter(({id:Te})=>Te!==oe.id)})},[]);return lt.useEffect(()=>th.subscribe(oe=>{if(oe.dismiss){W(ae=>ae.map(Ne=>Ne.id===oe.id?{...Ne,delete:!0}:Ne));return}setTimeout(()=>{Cme.flushSync(()=>{W(ae=>{let Ne=ae.findIndex(Te=>Te.id===oe.id);return Ne!==-1?[...ae.slice(0,Ne),{...ae[Ne],...oe},...ae.slice(Ne+1)]:[oe,...ae]})})})}),[]),lt.useEffect(()=>{if(x!=="system"){ie(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ie("dark"):ie("light")),typeof window>"u")return;let oe=window.matchMedia("(prefers-color-scheme: dark)");try{oe.addEventListener("change",({matches:ae})=>{ie(ae?"dark":"light")})}catch{oe.addListener(({matches:Ne})=>{try{ie(Ne?"dark":"light")}catch(Te){console.error(Te)}})}},[x]),lt.useEffect(()=>{q.length<=1&&ue(!1)},[q]),lt.useEffect(()=>{let oe=ae=>{var Ne,Te;i.every(Be=>ae[Be]||ae.code===Be)&&(ue(!0),(Ne=me.current)==null||Ne.focus()),ae.code==="Escape"&&(document.activeElement===me.current||(Te=me.current)!=null&&Te.contains(document.activeElement))&&ue(!1)};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[i]),lt.useEffect(()=>{if(me.current)return()=>{ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null,Ie.current=!1)}},[me.current]),lt.createElement("section",{ref:e,"aria-label":`${$} ${fe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((oe,ae)=>{var Ne;let[Te,Be]=oe.split("-");return q.length?lt.createElement("ol",{key:oe,dir:T==="auto"?$be():T,tabIndex:-1,ref:me,className:a,"data-sonner-toaster":!0,"data-theme":ye,"data-y-position":Te,"data-lifted":he&&q.length>1&&!o,"data-x-position":Be,style:{"--front-toast-height":`${((Ne=Z[0])==null?void 0:Ne.height)||0}px`,"--width":`${ZZe}px`,"--gap":`${I}px`,...k,...tYe(h,m)},onBlur:Le=>{Ie.current&&!Le.currentTarget.contains(Le.relatedTarget)&&(Ie.current=!1,ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null))},onFocus:Le=>{Le.target instanceof HTMLElement&&Le.target.dataset.dismissible==="false"||Ie.current||(Ie.current=!0,ve.current=Le.relatedTarget)},onMouseEnter:()=>ue(!0),onMouseMove:()=>ue(!0),onMouseLeave:()=>{je||ue(!1)},onDragEnd:()=>ue(!1),onPointerDown:Le=>{Le.target instanceof HTMLElement&&Le.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},q.filter(Le=>!Le.position&&ae===0||Le.position===oe).map((Le,Qe)=>{var Fe,Ce;return lt.createElement(eYe,{key:Le.id,icons:D,index:Qe,toast:Le,defaultRichColors:v,duration:(Fe=S==null?void 0:S.duration)!=null?Fe:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:n,visibleToasts:C,closeButton:(Ce=S==null?void 0:S.closeButton)!=null?Ce:c,interacting:je,position:oe,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,removeToast:Se,toasts:q.filter(Je=>Je.position==Le.position),heights:Z.filter(Je=>Je.position==Le.position),setHeights:re,expandByDefault:o,gap:I,loadingIcon:A,expanded:he,pauseWhenPageIsHidden:F,swipeDirections:t.swipeDirections})})):null}))});const nYe=({...t})=>{const{theme:e="system"}=TZe();return r.jsx(rYe,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var sYe=Dpe[" useId ".trim().toString()]||(()=>{}),iYe=0;function zc(t){const[e,n]=P.useState(sYe());return Gl(()=>{n(s=>s??String(iYe++))},[t]),e?`radix-${e}`:""}const aYe=["top","right","bottom","left"],S1=Math.min,Oh=Math.max,Oee=Math.round,Z6=Math.floor,pg=t=>({x:t,y:t}),oYe={left:"right",right:"left",bottom:"top",top:"bottom"},lYe={start:"end",end:"start"};function sue(t,e,n){return Oh(t,S1(e,n))}function Zx(t,e){return typeof t=="function"?t(e):t}function Yx(t){return t.split("-")[0]}function WC(t){return t.split("-")[1]}function Lme(t){return t==="x"?"y":"x"}function Ome(t){return t==="y"?"height":"width"}const cYe=new Set(["top","bottom"]);function ng(t){return cYe.has(Yx(t))?"y":"x"}function Dme(t){return Lme(ng(t))}function dYe(t,e,n){n===void 0&&(n=!1);const s=WC(t),i=Dme(t),o=Ome(i);let c=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(c=Dee(c)),[c,Dee(c)]}function uYe(t){const e=Dee(t);return[iue(t),e,iue(e)]}function iue(t){return t.replace(/start|end/g,e=>lYe[e])}const Ube=["left","right"],qbe=["right","left"],hYe=["top","bottom"],fYe=["bottom","top"];function pYe(t,e,n){switch(t){case"top":case"bottom":return n?e?qbe:Ube:e?Ube:qbe;case"left":case"right":return e?hYe:fYe;default:return[]}}function mYe(t,e,n,s){const i=WC(t);let o=pYe(Yx(t),n==="start",s);return i&&(o=o.map(c=>c+"-"+i),e&&(o=o.concat(o.map(iue)))),o}function Dee(t){return t.replace(/left|right|bottom|top/g,e=>oYe[e])}function gYe(t){return{top:0,right:0,bottom:0,left:0,...t}}function wAe(t){return typeof t!="number"?gYe(t):{top:t,right:t,bottom:t,left:t}}function Ree(t){const{x:e,y:n,width:s,height:i}=t;return{width:s,height:i,top:n,left:e,right:e+s,bottom:n+i,x:e,y:n}}function Vbe(t,e,n){let{reference:s,floating:i}=t;const o=ng(e),c=Dme(e),a=Ome(c),h=Yx(e),m=o==="y",x=s.x+s.width/2-i.width/2,v=s.y+s.height/2-i.height/2,w=s[a]/2-i[a]/2;let k;switch(h){case"top":k={x,y:s.y-i.height};break;case"bottom":k={x,y:s.y+s.height};break;case"right":k={x:s.x+s.width,y:v};break;case"left":k={x:s.x-i.width,y:v};break;default:k={x:s.x,y:s.y}}switch(WC(e)){case"start":k[c]-=w*(n&&m?-1:1);break;case"end":k[c]+=w*(n&&m?-1:1);break}return k}const xYe=async(t,e,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:o=[],platform:c}=n,a=o.filter(Boolean),h=await(c.isRTL==null?void 0:c.isRTL(e));let m=await c.getElementRects({reference:t,floating:e,strategy:i}),{x,y:v}=Vbe(m,s,h),w=s,k={},C=0;for(let S=0;S({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:i,rects:o,platform:c,elements:a,middlewareData:h}=e,{element:m,padding:x=0}=Zx(t,e)||{};if(m==null)return{};const v=wAe(x),w={x:n,y:s},k=Dme(i),C=Ome(k),S=await c.getDimensions(m),T=k==="y",I=T?"top":"left",A=T?"bottom":"right",D=T?"clientHeight":"clientWidth",$=o.reference[C]+o.reference[k]-w[k]-o.floating[C],F=w[k]-o.reference[k],q=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let W=q?q[D]:0;(!W||!await(c.isElement==null?void 0:c.isElement(q)))&&(W=a.floating[D]||o.floating[C]);const K=$/2-F/2,Z=W/2-S[C]/2-1,re=S1(v[I],Z),he=S1(v[A],Z),ue=re,je=W-S[C]-he,ne=W/2-S[C]/2+K,ye=sue(ue,ne,je),ie=!h.arrow&&WC(i)!=null&&ne!==ye&&o.reference[C]/2-(nene<=0)){var he,ue;const ne=(((he=o.flip)==null?void 0:he.index)||0)+1,ye=W[ne];if(ye&&(!(v==="alignment"?A!==ng(ye):!1)||re.every(fe=>fe.overflows[0]>0&&ng(fe.placement)===A)))return{data:{index:ne,overflows:re},reset:{placement:ye}};let ie=(ue=re.filter(me=>me.overflows[0]<=0).sort((me,fe)=>me.overflows[1]-fe.overflows[1])[0])==null?void 0:ue.placement;if(!ie)switch(k){case"bestFit":{var je;const me=(je=re.filter(fe=>{if(q){const ve=ng(fe.placement);return ve===A||ve==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(ve=>ve>0).reduce((ve,Ie)=>ve+Ie,0)]).sort((fe,ve)=>fe[1]-ve[1])[0])==null?void 0:je[0];me&&(ie=me);break}case"initialPlacement":ie=a;break}if(i!==ie)return{reset:{placement:ie}}}return{}}}};function Hbe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Wbe(t){return aYe.some(e=>t[e]>=0)}const _Ye=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:s="referenceHidden",...i}=Zx(t,e);switch(s){case"referenceHidden":{const o=await PA(e,{...i,elementContext:"reference"}),c=Hbe(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Wbe(c)}}}case"escaped":{const o=await PA(e,{...i,altBoundary:!0}),c=Hbe(o,n.floating);return{data:{escapedOffsets:c,escaped:Wbe(c)}}}default:return{}}}}},jAe=new Set(["left","top"]);async function bYe(t,e){const{placement:n,platform:s,elements:i}=t,o=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=Yx(n),a=WC(n),h=ng(n)==="y",m=jAe.has(c)?-1:1,x=o&&h?-1:1,v=Zx(e,t);let{mainAxis:w,crossAxis:k,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return a&&typeof C=="number"&&(k=a==="end"?C*-1:C),h?{x:k*x,y:w*m}:{x:w*m,y:k*x}}const wYe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:i,y:o,placement:c,middlewareData:a}=e,h=await bYe(e,t);return c===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+h.x,y:o+h.y,data:{...h,placement:c}}}}},jYe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:a={fn:T=>{let{x:I,y:A}=T;return{x:I,y:A}}},...h}=Zx(t,e),m={x:n,y:s},x=await PA(e,h),v=ng(Yx(i)),w=Lme(v);let k=m[w],C=m[v];if(o){const T=w==="y"?"top":"left",I=w==="y"?"bottom":"right",A=k+x[T],D=k-x[I];k=sue(A,k,D)}if(c){const T=v==="y"?"top":"left",I=v==="y"?"bottom":"right",A=C+x[T],D=C-x[I];C=sue(A,C,D)}const S=a.fn({...e,[w]:k,[v]:C});return{...S,data:{x:S.x-n,y:S.y-s,enabled:{[w]:o,[v]:c}}}}}},kYe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:s,placement:i,rects:o,middlewareData:c}=e,{offset:a=0,mainAxis:h=!0,crossAxis:m=!0}=Zx(t,e),x={x:n,y:s},v=ng(i),w=Lme(v);let k=x[w],C=x[v];const S=Zx(a,e),T=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const D=w==="y"?"height":"width",$=o.reference[w]-o.floating[D]+T.mainAxis,F=o.reference[w]+o.reference[D]-T.mainAxis;k<$?k=$:k>F&&(k=F)}if(m){var I,A;const D=w==="y"?"width":"height",$=jAe.has(Yx(i)),F=o.reference[v]-o.floating[D]+($&&((I=c.offset)==null?void 0:I[v])||0)+($?0:T.crossAxis),q=o.reference[v]+o.reference[D]+($?0:((A=c.offset)==null?void 0:A[v])||0)-($?T.crossAxis:0);Cq&&(C=q)}return{[w]:k,[v]:C}}}},NYe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,s;const{placement:i,rects:o,platform:c,elements:a}=e,{apply:h=()=>{},...m}=Zx(t,e),x=await PA(e,m),v=Yx(i),w=WC(i),k=ng(i)==="y",{width:C,height:S}=o.floating;let T,I;v==="top"||v==="bottom"?(T=v,I=w===(await(c.isRTL==null?void 0:c.isRTL(a.floating))?"start":"end")?"left":"right"):(I=v,T=w==="end"?"top":"bottom");const A=S-x.top-x.bottom,D=C-x.left-x.right,$=S1(S-x[T],A),F=S1(C-x[I],D),q=!e.middlewareData.shift;let W=$,K=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=D),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(W=A),q&&!w){const re=Oh(x.left,0),he=Oh(x.right,0),ue=Oh(x.top,0),je=Oh(x.bottom,0);k?K=C-2*(re!==0||he!==0?re+he:Oh(x.left,x.right)):W=S-2*(ue!==0||je!==0?ue+je:Oh(x.top,x.bottom))}await h({...e,availableWidth:K,availableHeight:W});const Z=await c.getDimensions(a.floating);return C!==Z.width||S!==Z.height?{reset:{rects:!0}}:{}}}};function kne(){return typeof window<"u"}function GC(t){return kAe(t)?(t.nodeName||"").toLowerCase():"#document"}function Wh(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Sg(t){var e;return(e=(kAe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function kAe(t){return kne()?t instanceof Node||t instanceof Wh(t).Node:!1}function fm(t){return kne()?t instanceof Element||t instanceof Wh(t).Element:!1}function _g(t){return kne()?t instanceof HTMLElement||t instanceof Wh(t).HTMLElement:!1}function Gbe(t){return!kne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Wh(t).ShadowRoot}const SYe=new Set(["inline","contents"]);function JE(t){const{overflow:e,overflowX:n,overflowY:s,display:i}=pm(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!SYe.has(i)}const CYe=new Set(["table","td","th"]);function MYe(t){return CYe.has(GC(t))}const TYe=[":popover-open",":modal"];function Nne(t){return TYe.some(e=>{try{return t.matches(e)}catch{return!1}})}const AYe=["transform","translate","scale","rotate","perspective"],EYe=["transform","translate","scale","rotate","perspective","filter"],IYe=["paint","layout","strict","content"];function Rme(t){const e=Fme(),n=fm(t)?pm(t):t;return AYe.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||EYe.some(s=>(n.willChange||"").includes(s))||IYe.some(s=>(n.contain||"").includes(s))}function PYe(t){let e=C1(t);for(;_g(e)&&!Y4(e);){if(Rme(e))return e;if(Nne(e))return null;e=C1(e)}return null}function Fme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const LYe=new Set(["html","body","#document"]);function Y4(t){return LYe.has(GC(t))}function pm(t){return Wh(t).getComputedStyle(t)}function Sne(t){return fm(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function C1(t){if(GC(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Gbe(t)&&t.host||Sg(t);return Gbe(e)?e.host:e}function NAe(t){const e=C1(t);return Y4(e)?t.ownerDocument?t.ownerDocument.body:t.body:_g(e)&&JE(e)?e:NAe(e)}function LA(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=NAe(t),o=i===((s=t.ownerDocument)==null?void 0:s.body),c=Wh(i);if(o){const a=aue(c);return e.concat(c,c.visualViewport||[],JE(i)?i:[],a&&n?LA(a):[])}return e.concat(i,LA(i,[],n))}function aue(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function SAe(t){const e=pm(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const i=_g(t),o=i?t.offsetWidth:n,c=i?t.offsetHeight:s,a=Oee(n)!==o||Oee(s)!==c;return a&&(n=o,s=c),{width:n,height:s,$:a}}function zme(t){return fm(t)?t:t.contextElement}function f4(t){const e=zme(t);if(!_g(e))return pg(1);const n=e.getBoundingClientRect(),{width:s,height:i,$:o}=SAe(e);let c=(o?Oee(n.width):n.width)/s,a=(o?Oee(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!a||!Number.isFinite(a))&&(a=1),{x:c,y:a}}const OYe=pg(0);function CAe(t){const e=Wh(t);return!Fme()||!e.visualViewport?OYe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function DYe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Wh(t)?!1:e}function _j(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=zme(t);let c=pg(1);e&&(s?fm(s)&&(c=f4(s)):c=f4(t));const a=DYe(o,n,s)?CAe(o):pg(0);let h=(i.left+a.x)/c.x,m=(i.top+a.y)/c.y,x=i.width/c.x,v=i.height/c.y;if(o){const w=Wh(o),k=s&&fm(s)?Wh(s):s;let C=w,S=aue(C);for(;S&&s&&k!==C;){const T=f4(S),I=S.getBoundingClientRect(),A=pm(S),D=I.left+(S.clientLeft+parseFloat(A.paddingLeft))*T.x,$=I.top+(S.clientTop+parseFloat(A.paddingTop))*T.y;h*=T.x,m*=T.y,x*=T.x,v*=T.y,h+=D,m+=$,C=Wh(S),S=aue(C)}}return Ree({width:x,height:v,x:h,y:m})}function Bme(t,e){const n=Sne(t).scrollLeft;return e?e.left+n:_j(Sg(t)).left+n}function MAe(t,e,n){n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=s.left+e.scrollLeft-(n?0:Bme(t,s)),o=s.top+e.scrollTop;return{x:i,y:o}}function RYe(t){let{elements:e,rect:n,offsetParent:s,strategy:i}=t;const o=i==="fixed",c=Sg(s),a=e?Nne(e.floating):!1;if(s===c||a&&o)return n;let h={scrollLeft:0,scrollTop:0},m=pg(1);const x=pg(0),v=_g(s);if((v||!v&&!o)&&((GC(s)!=="body"||JE(c))&&(h=Sne(s)),_g(s))){const k=_j(s);m=f4(s),x.x=k.x+s.clientLeft,x.y=k.y+s.clientTop}const w=c&&!v&&!o?MAe(c,h,!0):pg(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-h.scrollLeft*m.x+x.x+w.x,y:n.y*m.y-h.scrollTop*m.y+x.y+w.y}}function FYe(t){return Array.from(t.getClientRects())}function zYe(t){const e=Sg(t),n=Sne(t),s=t.ownerDocument.body,i=Oh(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=Oh(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Bme(t);const a=-n.scrollTop;return pm(s).direction==="rtl"&&(c+=Oh(e.clientWidth,s.clientWidth)-i),{width:i,height:o,x:c,y:a}}function BYe(t,e){const n=Wh(t),s=Sg(t),i=n.visualViewport;let o=s.clientWidth,c=s.clientHeight,a=0,h=0;if(i){o=i.width,c=i.height;const m=Fme();(!m||m&&e==="fixed")&&(a=i.offsetLeft,h=i.offsetTop)}return{width:o,height:c,x:a,y:h}}const $Ye=new Set(["absolute","fixed"]);function UYe(t,e){const n=_j(t,!0,e==="fixed"),s=n.top+t.clientTop,i=n.left+t.clientLeft,o=_g(t)?f4(t):pg(1),c=t.clientWidth*o.x,a=t.clientHeight*o.y,h=i*o.x,m=s*o.y;return{width:c,height:a,x:h,y:m}}function Kbe(t,e,n){let s;if(e==="viewport")s=BYe(t,n);else if(e==="document")s=zYe(Sg(t));else if(fm(e))s=UYe(e,n);else{const i=CAe(t);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Ree(s)}function TAe(t,e){const n=C1(t);return n===e||!fm(n)||Y4(n)?!1:pm(n).position==="fixed"||TAe(n,e)}function qYe(t,e){const n=e.get(t);if(n)return n;let s=LA(t,[],!1).filter(a=>fm(a)&&GC(a)!=="body"),i=null;const o=pm(t).position==="fixed";let c=o?C1(t):t;for(;fm(c)&&!Y4(c);){const a=pm(c),h=Rme(c);!h&&a.position==="fixed"&&(i=null),(o?!h&&!i:!h&&a.position==="static"&&!!i&&$Ye.has(i.position)||JE(c)&&!h&&TAe(t,c))?s=s.filter(x=>x!==c):i=a,c=C1(c)}return e.set(t,s),s}function VYe(t){let{element:e,boundary:n,rootBoundary:s,strategy:i}=t;const c=[...n==="clippingAncestors"?Nne(e)?[]:qYe(e,this._c):[].concat(n),s],a=c[0],h=c.reduce((m,x)=>{const v=Kbe(e,x,i);return m.top=Oh(v.top,m.top),m.right=S1(v.right,m.right),m.bottom=S1(v.bottom,m.bottom),m.left=Oh(v.left,m.left),m},Kbe(e,a,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function HYe(t){const{width:e,height:n}=SAe(t);return{width:e,height:n}}function WYe(t,e,n){const s=_g(e),i=Sg(e),o=n==="fixed",c=_j(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const h=pg(0);function m(){h.x=Bme(i)}if(s||!s&&!o)if((GC(e)!=="body"||JE(i))&&(a=Sne(e)),s){const k=_j(e,!0,o,e);h.x=k.x+e.clientLeft,h.y=k.y+e.clientTop}else i&&m();o&&!s&&i&&m();const x=i&&!s&&!o?MAe(i,a):pg(0),v=c.left+a.scrollLeft-h.x-x.x,w=c.top+a.scrollTop-h.y-x.y;return{x:v,y:w,width:c.width,height:c.height}}function dle(t){return pm(t).position==="static"}function Zbe(t,e){if(!_g(t)||pm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Sg(t)===n&&(n=n.ownerDocument.body),n}function AAe(t,e){const n=Wh(t);if(Nne(t))return n;if(!_g(t)){let i=C1(t);for(;i&&!Y4(i);){if(fm(i)&&!dle(i))return i;i=C1(i)}return n}let s=Zbe(t,e);for(;s&&MYe(s)&&dle(s);)s=Zbe(s,e);return s&&Y4(s)&&dle(s)&&!Rme(s)?n:s||PYe(t)||n}const GYe=async function(t){const e=this.getOffsetParent||AAe,n=this.getDimensions,s=await n(t.floating);return{reference:WYe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function KYe(t){return pm(t).direction==="rtl"}const ZYe={convertOffsetParentRelativeRectToViewportRelativeRect:RYe,getDocumentElement:Sg,getClippingRect:VYe,getOffsetParent:AAe,getElementRects:GYe,getClientRects:FYe,getDimensions:HYe,getScale:f4,isElement:fm,isRTL:KYe};function EAe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function YYe(t,e){let n=null,s;const i=Sg(t);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function c(a,h){a===void 0&&(a=!1),h===void 0&&(h=1),o();const m=t.getBoundingClientRect(),{left:x,top:v,width:w,height:k}=m;if(a||e(),!w||!k)return;const C=Z6(v),S=Z6(i.clientWidth-(x+w)),T=Z6(i.clientHeight-(v+k)),I=Z6(x),D={rootMargin:-C+"px "+-S+"px "+-T+"px "+-I+"px",threshold:Oh(0,S1(1,h))||1};let $=!0;function F(q){const W=q[0].intersectionRatio;if(W!==h){if(!$)return c();W?c(!1,W):s=setTimeout(()=>{c(!1,1e-7)},1e3)}W===1&&!EAe(m,t.getBoundingClientRect())&&c(),$=!1}try{n=new IntersectionObserver(F,{...D,root:i.ownerDocument})}catch{n=new IntersectionObserver(F,D)}n.observe(t)}return c(!0),o}function XYe(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,m=zme(t),x=i||o?[...m?LA(m):[],...LA(e)]:[];x.forEach(I=>{i&&I.addEventListener("scroll",n,{passive:!0}),o&&I.addEventListener("resize",n)});const v=m&&a?YYe(m,n):null;let w=-1,k=null;c&&(k=new ResizeObserver(I=>{let[A]=I;A&&A.target===m&&k&&(k.unobserve(e),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var D;(D=k)==null||D.observe(e)})),n()}),m&&!h&&k.observe(m),k.observe(e));let C,S=h?_j(t):null;h&&T();function T(){const I=_j(t);S&&!EAe(S,I)&&n(),S=I,C=requestAnimationFrame(T)}return n(),()=>{var I;x.forEach(A=>{i&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),v==null||v(),(I=k)==null||I.disconnect(),k=null,h&&cancelAnimationFrame(C)}}const QYe=wYe,JYe=jYe,eXe=vYe,tXe=NYe,rXe=_Ye,Ybe=yYe,nXe=kYe,sXe=(t,e,n)=>{const s=new Map,i={platform:ZYe,...n},o={...i.platform,_c:s};return xYe(t,e,{...i,platform:o})};var iXe=typeof document<"u",aXe=function(){},GJ=iXe?P.useLayoutEffect:aXe;function Fee(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,s,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!Fee(t[s],e[s]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,i[s]))return!1;for(s=n;s--!==0;){const o=i[s];if(!(o==="_owner"&&t.$$typeof)&&!Fee(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function IAe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Xbe(t,e){const n=IAe(t);return Math.round(e*n)/n}function ule(t){const e=P.useRef(t);return GJ(()=>{e.current=t}),e}function oXe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:o,floating:c}={},transform:a=!0,whileElementsMounted:h,open:m}=t,[x,v]=P.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[w,k]=P.useState(s);Fee(w,s)||k(s);const[C,S]=P.useState(null),[T,I]=P.useState(null),A=P.useCallback(fe=>{fe!==q.current&&(q.current=fe,S(fe))},[]),D=P.useCallback(fe=>{fe!==W.current&&(W.current=fe,I(fe))},[]),$=o||C,F=c||T,q=P.useRef(null),W=P.useRef(null),K=P.useRef(x),Z=h!=null,re=ule(h),he=ule(i),ue=ule(m),je=P.useCallback(()=>{if(!q.current||!W.current)return;const fe={placement:e,strategy:n,middleware:w};he.current&&(fe.platform=he.current),sXe(q.current,W.current,fe).then(ve=>{const Ie={...ve,isPositioned:ue.current!==!1};ne.current&&!Fee(K.current,Ie)&&(K.current=Ie,ny.flushSync(()=>{v(Ie)}))})},[w,e,n,he,ue]);GJ(()=>{m===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,v(fe=>({...fe,isPositioned:!1})))},[m]);const ne=P.useRef(!1);GJ(()=>(ne.current=!0,()=>{ne.current=!1}),[]),GJ(()=>{if($&&(q.current=$),F&&(W.current=F),$&&F){if(re.current)return re.current($,F,je);je()}},[$,F,je,re,Z]);const ye=P.useMemo(()=>({reference:q,floating:W,setReference:A,setFloating:D}),[A,D]),ie=P.useMemo(()=>({reference:$,floating:F}),[$,F]),me=P.useMemo(()=>{const fe={position:n,left:0,top:0};if(!ie.floating)return fe;const ve=Xbe(ie.floating,x.x),Ie=Xbe(ie.floating,x.y);return a?{...fe,transform:"translate("+ve+"px, "+Ie+"px)",...IAe(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ve,top:Ie}},[n,a,ie.floating,x.x,x.y]);return P.useMemo(()=>({...x,update:je,refs:ye,elements:ie,floatingStyles:me}),[x,je,ye,ie,me])}const lXe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:i}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?Ybe({element:s.current,padding:i}).fn(n):{}:s?Ybe({element:s,padding:i}).fn(n):{}}}},cXe=(t,e)=>({...QYe(t),options:[t,e]}),dXe=(t,e)=>({...JYe(t),options:[t,e]}),uXe=(t,e)=>({...nXe(t),options:[t,e]}),hXe=(t,e)=>({...eXe(t),options:[t,e]}),fXe=(t,e)=>({...tXe(t),options:[t,e]}),pXe=(t,e)=>({...rXe(t),options:[t,e]}),mXe=(t,e)=>({...lXe(t),options:[t,e]});var gXe="Arrow",PAe=P.forwardRef((t,e)=>{const{children:n,width:s=10,height:i=5,...o}=t;return r.jsx(Dn.svg,{...o,ref:e,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});PAe.displayName=gXe;var xXe=PAe;function eI(t){const[e,n]=P.useState(void 0);return Gl(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let c,a;if("borderBoxSize"in o){const h=o.borderBoxSize,m=Array.isArray(h)?h[0]:h;c=m.inlineSize,a=m.blockSize}else c=t.offsetWidth,a=t.offsetHeight;n({width:c,height:a})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}var $me="Popper",[LAe,Cg]=Zl($me),[yXe,OAe]=LAe($me),DAe=t=>{const{__scopePopper:e,children:n}=t,[s,i]=P.useState(null);return r.jsx(yXe,{scope:e,anchor:s,onAnchorChange:i,children:n})};DAe.displayName=$me;var RAe="PopperAnchor",FAe=P.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:s,...i}=t,o=OAe(RAe,n),c=P.useRef(null),a=Xs(e,c);return P.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||c.current)}),s?null:r.jsx(Dn.div,{...i,ref:a})});FAe.displayName=RAe;var Ume="PopperContent",[vXe,_Xe]=LAe(Ume),zAe=P.forwardRef((t,e)=>{var Le,Qe,Fe,Ce,Je,Ae;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:c=0,arrowPadding:a=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:x=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:k="optimized",onPlaced:C,...S}=t,T=OAe(Ume,n),[I,A]=P.useState(null),D=Xs(e,Ye=>A(Ye)),[$,F]=P.useState(null),q=eI($),W=(q==null?void 0:q.width)??0,K=(q==null?void 0:q.height)??0,Z=s+(o!=="center"?"-"+o:""),re=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},he=Array.isArray(m)?m:[m],ue=he.length>0,je={padding:re,boundary:he.filter(wXe),altBoundary:ue},{refs:ne,floatingStyles:ye,placement:ie,isPositioned:me,middlewareData:fe}=oXe({strategy:"fixed",placement:Z,whileElementsMounted:(...Ye)=>XYe(...Ye,{animationFrame:k==="always"}),elements:{reference:T.anchor},middleware:[cXe({mainAxis:i+K,alignmentAxis:c}),h&&dXe({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?uXe():void 0,...je}),h&&hXe({...je}),fXe({...je,apply:({elements:Ye,rects:ge,availableWidth:ft,availableHeight:nt})=>{const{width:Ve,height:Me}=ge.reference,rt=Ye.floating.style;rt.setProperty("--radix-popper-available-width",`${ft}px`),rt.setProperty("--radix-popper-available-height",`${nt}px`),rt.setProperty("--radix-popper-anchor-width",`${Ve}px`),rt.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),$&&mXe({element:$,padding:a}),jXe({arrowWidth:W,arrowHeight:K}),w&&pXe({strategy:"referenceHidden",...je})]}),[ve,Ie]=UAe(ie),Se=ql(C);Gl(()=>{me&&(Se==null||Se())},[me,Se]);const oe=(Le=fe.arrow)==null?void 0:Le.x,ae=(Qe=fe.arrow)==null?void 0:Qe.y,Ne=((Fe=fe.arrow)==null?void 0:Fe.centerOffset)!==0,[Te,Be]=P.useState();return Gl(()=>{I&&Be(window.getComputedStyle(I).zIndex)},[I]),r.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...ye,transform:me?ye.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Te,"--radix-popper-transform-origin":[(Ce=fe.transformOrigin)==null?void 0:Ce.x,(Je=fe.transformOrigin)==null?void 0:Je.y].join(" "),...((Ae=fe.hide)==null?void 0:Ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:r.jsx(vXe,{scope:n,placedSide:ve,onArrowChange:F,arrowX:oe,arrowY:ae,shouldHideArrow:Ne,children:r.jsx(Dn.div,{"data-side":ve,"data-align":Ie,...S,ref:D,style:{...S.style,animation:me?void 0:"none"}})})})});zAe.displayName=Ume;var BAe="PopperArrow",bXe={top:"bottom",right:"left",bottom:"top",left:"right"},$Ae=P.forwardRef(function(e,n){const{__scopePopper:s,...i}=e,o=_Xe(BAe,s),c=bXe[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(xXe,{...i,ref:n,style:{...i.style,display:"block"}})})});$Ae.displayName=BAe;function wXe(t){return t!==null}var jXe=t=>({name:"transformOrigin",options:t,fn(e){var T,I,A;const{placement:n,rects:s,middlewareData:i}=e,c=((T=i.arrow)==null?void 0:T.centerOffset)!==0,a=c?0:t.arrowWidth,h=c?0:t.arrowHeight,[m,x]=UAe(n),v={start:"0%",center:"50%",end:"100%"}[x],w=(((I=i.arrow)==null?void 0:I.x)??0)+a/2,k=(((A=i.arrow)==null?void 0:A.y)??0)+h/2;let C="",S="";return m==="bottom"?(C=c?v:`${w}px`,S=`${-h}px`):m==="top"?(C=c?v:`${w}px`,S=`${s.floating.height+h}px`):m==="right"?(C=`${-h}px`,S=c?v:`${k}px`):m==="left"&&(C=`${s.floating.width+h}px`,S=c?v:`${k}px`),{data:{x:C,y:S}}}});function UAe(t){const[e,n="center"]=t.split("-");return[e,n]}var tI=DAe,KC=FAe,rI=zAe,nI=$Ae,[Cne]=Zl("Tooltip",[Cg]),Mne=Cg(),qAe="TooltipProvider",kXe=700,oue="tooltip.open",[NXe,qme]=Cne(qAe),VAe=t=>{const{__scopeTooltip:e,delayDuration:n=kXe,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:o}=t,c=P.useRef(!0),a=P.useRef(!1),h=P.useRef(0);return P.useEffect(()=>{const m=h.current;return()=>window.clearTimeout(m)},[]),r.jsx(NXe,{scope:e,isOpenDelayedRef:c,delayDuration:n,onOpen:P.useCallback(()=>{window.clearTimeout(h.current),c.current=!1},[]),onClose:P.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:a,onPointerInTransitChange:P.useCallback(m=>{a.current=m},[]),disableHoverableContent:i,children:o})};VAe.displayName=qAe;var OA="Tooltip",[SXe,Tne]=Cne(OA),HAe=t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:i,onOpenChange:o,disableHoverableContent:c,delayDuration:a}=t,h=qme(OA,t.__scopeTooltip),m=Mne(e),[x,v]=P.useState(null),w=zc(),k=P.useRef(0),C=c??h.disableHoverableContent,S=a??h.delayDuration,T=P.useRef(!1),[I,A]=Eu({prop:s,defaultProp:i??!1,onChange:W=>{W?(h.onOpen(),document.dispatchEvent(new CustomEvent(oue))):h.onClose(),o==null||o(W)},caller:OA}),D=P.useMemo(()=>I?T.current?"delayed-open":"instant-open":"closed",[I]),$=P.useCallback(()=>{window.clearTimeout(k.current),k.current=0,T.current=!1,A(!0)},[A]),F=P.useCallback(()=>{window.clearTimeout(k.current),k.current=0,A(!1)},[A]),q=P.useCallback(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>{T.current=!0,A(!0),k.current=0},S)},[S,A]);return P.useEffect(()=>()=>{k.current&&(window.clearTimeout(k.current),k.current=0)},[]),r.jsx(tI,{...m,children:r.jsx(SXe,{scope:e,contentId:w,open:I,stateAttribute:D,trigger:x,onTriggerChange:v,onTriggerEnter:P.useCallback(()=>{h.isOpenDelayedRef.current?q():$()},[h.isOpenDelayedRef,q,$]),onTriggerLeave:P.useCallback(()=>{C?F():(window.clearTimeout(k.current),k.current=0)},[F,C]),onOpen:$,onClose:F,disableHoverableContent:C,children:n})})};HAe.displayName=OA;var lue="TooltipTrigger",WAe=P.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,i=Tne(lue,n),o=qme(lue,n),c=Mne(n),a=P.useRef(null),h=Xs(e,a,i.onTriggerChange),m=P.useRef(!1),x=P.useRef(!1),v=P.useCallback(()=>m.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),r.jsx(KC,{asChild:!0,...c,children:r.jsx(Dn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:h,onPointerMove:an(t.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),x.current=!0)}),onPointerLeave:an(t.onPointerLeave,()=>{i.onTriggerLeave(),x.current=!1}),onPointerDown:an(t.onPointerDown,()=>{i.open&&i.onClose(),m.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:an(t.onFocus,()=>{m.current||i.onOpen()}),onBlur:an(t.onBlur,i.onClose),onClick:an(t.onClick,i.onClose)})})});WAe.displayName=lue;var CXe="TooltipPortal",[XGt,MXe]=Cne(CXe,{forceMount:void 0}),X4="TooltipContent",GAe=P.forwardRef((t,e)=>{const n=MXe(X4,t.__scopeTooltip),{forceMount:s=n.forceMount,side:i="top",...o}=t,c=Tne(X4,t.__scopeTooltip);return r.jsx(lc,{present:s||c.open,children:c.disableHoverableContent?r.jsx(KAe,{side:i,...o,ref:e}):r.jsx(TXe,{side:i,...o,ref:e})})}),TXe=P.forwardRef((t,e)=>{const n=Tne(X4,t.__scopeTooltip),s=qme(X4,t.__scopeTooltip),i=P.useRef(null),o=Xs(e,i),[c,a]=P.useState(null),{trigger:h,onClose:m}=n,x=i.current,{onPointerInTransitChange:v}=s,w=P.useCallback(()=>{a(null),v(!1)},[v]),k=P.useCallback((C,S)=>{const T=C.currentTarget,I={x:C.clientX,y:C.clientY},A=LXe(I,T.getBoundingClientRect()),D=OXe(I,A),$=DXe(S.getBoundingClientRect()),F=FXe([...D,...$]);a(F),v(!0)},[v]);return P.useEffect(()=>()=>w(),[w]),P.useEffect(()=>{if(h&&x){const C=T=>k(T,x),S=T=>k(T,h);return h.addEventListener("pointerleave",C),x.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",C),x.removeEventListener("pointerleave",S)}}},[h,x,k,w]),P.useEffect(()=>{if(c){const C=S=>{const T=S.target,I={x:S.clientX,y:S.clientY},A=(h==null?void 0:h.contains(T))||(x==null?void 0:x.contains(T)),D=!RXe(I,c);A?w():D&&(w(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[h,x,c,m,w]),r.jsx(KAe,{...t,ref:o})}),[AXe,EXe]=Cne(OA,{isInside:!1}),IXe=FTe("TooltipContent"),KAe=P.forwardRef((t,e)=>{const{__scopeTooltip:n,children:s,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:c,...a}=t,h=Tne(X4,n),m=Mne(n),{onClose:x}=h;return P.useEffect(()=>(document.addEventListener(oue,x),()=>document.removeEventListener(oue,x)),[x]),P.useEffect(()=>{if(h.trigger){const v=w=>{const k=w.target;k!=null&&k.contains(h.trigger)&&x()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[h.trigger,x]),r.jsx(D1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:r.jsxs(rI,{"data-state":h.stateAttribute,...m,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(IXe,{children:s}),r.jsx(AXe,{scope:n,isInside:!0,children:r.jsx(wKe,{id:h.contentId,role:"tooltip",children:i||s})})]})})});GAe.displayName=X4;var ZAe="TooltipArrow",PXe=P.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,i=Mne(n);return EXe(ZAe,n).isInside?null:r.jsx(nI,{...i,...s,ref:e})});PXe.displayName=ZAe;function LXe(t,e){const n=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,s,i,o)){case o:return"left";case i:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function OXe(t,e,n=5){const s=[];switch(e){case"top":s.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":s.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":s.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":s.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return s}function DXe(t){const{top:e,right:n,bottom:s,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:s},{x:i,y:s}]}function RXe(t,e){const{x:n,y:s}=t;let i=!1;for(let o=0,c=e.length-1;os!=w>s&&n<(v-m)*(s-x)/(w-x)+m&&(i=!i)}return i}function FXe(t){const e=t.slice();return e.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),zXe(e)}function zXe(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s=2;){const o=e[e.length-1],c=e[e.length-2];if((o.x-c.x)*(i.y-c.y)>=(o.y-c.y)*(i.x-c.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let s=t.length-1;s>=0;s--){const i=t[s];for(;n.length>=2;){const o=n[n.length-1],c=n[n.length-2];if((o.x-c.x)*(i.y-c.y)>=(o.y-c.y)*(i.x-c.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var BXe=VAe,$Xe=HAe,UXe=WAe,YAe=GAe;const sI=BXe,mg=$Xe,gg=UXe,dm=P.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(YAe,{ref:s,sideOffset:e,className:$t("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));dm.displayName=YAe.displayName;var ZC=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(){}},bj=typeof window>"u"||"Deno"in globalThis;function gu(){}function qXe(t,e){return typeof t=="function"?t(e):t}function cue(t){return typeof t=="number"&&t>=0&&t!==1/0}function XAe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function h1(t,e){return typeof t=="function"?t(e):t}function Sf(t,e){return typeof t=="function"?t(e):t}function Qbe(t,e){const{type:n="all",exact:s,fetchStatus:i,predicate:o,queryKey:c,stale:a}=t;if(c){if(s){if(e.queryHash!==Vme(c,e.options))return!1}else if(!DA(e.queryKey,c))return!1}if(n!=="all"){const h=e.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||o&&!o(e))}function Jbe(t,e){const{exact:n,status:s,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(wj(e.options.mutationKey)!==wj(o))return!1}else if(!DA(e.options.mutationKey,o))return!1}return!(s&&e.state.status!==s||i&&!i(e))}function Vme(t,e){return((e==null?void 0:e.queryKeyHashFn)||wj)(t)}function wj(t){return JSON.stringify(t,(e,n)=>due(n)?Object.keys(n).sort().reduce((s,i)=>(s[i]=n[i],s),{}):n)}function DA(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>DA(t[n],e[n])):!1}function QAe(t,e){if(t===e)return t;const n=ewe(t)&&ewe(e);if(n||due(t)&&due(e)){const s=n?t:Object.keys(t),i=s.length,o=n?e:Object.keys(e),c=o.length,a=n?[]:{},h=new Set(s);let m=0;for(let x=0;x{setTimeout(e,t)})}function uue(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?QAe(t,e):e}function HXe(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function WXe(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}var Hme=Symbol();function JAe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Hme?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function eEe(t,e){return typeof t=="function"?t(...e):!!t}var Pw,_0,E4,f3e,GXe=(f3e=class extends ZC{constructor(){super();ii(this,Pw);ii(this,_0);ii(this,E4);cs(this,E4,e=>{if(!bj&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Yt(this,_0)||this.setEventListener(Yt(this,E4))}onUnsubscribe(){var e;this.hasListeners()||((e=Yt(this,_0))==null||e.call(this),cs(this,_0,void 0))}setEventListener(e){var n;cs(this,E4,e),(n=Yt(this,_0))==null||n.call(this),cs(this,_0,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){Yt(this,Pw)!==e&&(cs(this,Pw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof Yt(this,Pw)=="boolean"?Yt(this,Pw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Pw=new WeakMap,_0=new WeakMap,E4=new WeakMap,f3e),Wme=new GXe,I4,b0,P4,p3e,KXe=(p3e=class extends ZC{constructor(){super();ii(this,I4,!0);ii(this,b0);ii(this,P4);cs(this,P4,e=>{if(!bj&&window.addEventListener){const n=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){Yt(this,b0)||this.setEventListener(Yt(this,P4))}onUnsubscribe(){var e;this.hasListeners()||((e=Yt(this,b0))==null||e.call(this),cs(this,b0,void 0))}setEventListener(e){var n;cs(this,P4,e),(n=Yt(this,b0))==null||n.call(this),cs(this,b0,e(this.setOnline.bind(this)))}setOnline(e){Yt(this,I4)!==e&&(cs(this,I4,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return Yt(this,I4)}},I4=new WeakMap,b0=new WeakMap,P4=new WeakMap,p3e),Bee=new KXe;function hue(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function s(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{s({status:"fulfilled",value:i}),t(i)},n.reject=i=>{s({status:"rejected",reason:i}),e(i)},n}function ZXe(t){return Math.min(1e3*2**t,3e4)}function tEe(t){return(t??"online")==="online"?Bee.isOnline():!0}var rEe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function hle(t){return t instanceof rEe}function nEe(t){let e=!1,n=0,s=!1,i;const o=hue(),c=S=>{var T;s||(w(new rEe(S)),(T=t.abort)==null||T.call(t))},a=()=>{e=!0},h=()=>{e=!1},m=()=>Wme.isFocused()&&(t.networkMode==="always"||Bee.isOnline())&&t.canRun(),x=()=>tEe(t.networkMode)&&t.canRun(),v=S=>{var T;s||(s=!0,(T=t.onSuccess)==null||T.call(t,S),i==null||i(),o.resolve(S))},w=S=>{var T;s||(s=!0,(T=t.onError)==null||T.call(t,S),i==null||i(),o.reject(S))},k=()=>new Promise(S=>{var T;i=I=>{(s||m())&&S(I)},(T=t.onPause)==null||T.call(t)}).then(()=>{var S;i=void 0,s||(S=t.onContinue)==null||S.call(t)}),C=()=>{if(s)return;let S;const T=n===0?t.initialPromise:void 0;try{S=T??t.fn()}catch(I){S=Promise.reject(I)}Promise.resolve(S).then(v).catch(I=>{var q;if(s)return;const A=t.retry??(bj?0:3),D=t.retryDelay??ZXe,$=typeof D=="function"?D(n,I):D,F=A===!0||typeof A=="number"&&nm()?void 0:k()).then(()=>{e?w(I):C()})})};return{promise:o,cancel:c,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:h,canStart:x,start:()=>(x()?C():k().then(C),o)}}var YXe=t=>setTimeout(t,0);function XXe(){let t=[],e=0,n=a=>{a()},s=a=>{a()},i=YXe;const o=a=>{e?t.push(a):i(()=>{n(a)})},c=()=>{const a=t;t=[],a.length&&i(()=>{s(()=>{a.forEach(h=>{n(h)})})})};return{batch:a=>{let h;e++;try{h=a()}finally{e--,e||c()}return h},batchCalls:a=>(...h)=>{o(()=>{a(...h)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{i=a}}}var Dc=XXe(),Lw,m3e,sEe=(m3e=class{constructor(){ii(this,Lw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),cue(this.gcTime)&&cs(this,Lw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(bj?1/0:5*60*1e3))}clearGcTimeout(){Yt(this,Lw)&&(clearTimeout(Yt(this,Lw)),cs(this,Lw,void 0))}},Lw=new WeakMap,m3e),L4,Ow,Nf,Dw,$d,UE,Rw,$p,dx,g3e,QXe=(g3e=class extends sEe{constructor(e){super();ii(this,$p);ii(this,L4);ii(this,Ow);ii(this,Nf);ii(this,Dw);ii(this,$d);ii(this,UE);ii(this,Rw);cs(this,Rw,!1),cs(this,UE,e.defaultOptions),this.setOptions(e.options),this.observers=[],cs(this,Dw,e.client),cs(this,Nf,Yt(this,Dw).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,cs(this,L4,JXe(this.options)),this.state=e.state??Yt(this,L4),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Yt(this,$d))==null?void 0:e.promise}setOptions(e){this.options={...Yt(this,UE),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Yt(this,Nf).remove(this)}setData(e,n){const s=uue(this.state.data,e,this.options);return ia(this,$p,dx).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e,n){ia(this,$p,dx).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var s,i;const n=(s=Yt(this,$d))==null?void 0:s.promise;return(i=Yt(this,$d))==null||i.cancel(e),n?n.then(gu).catch(gu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Yt(this,L4))}isActive(){return this.observers.some(e=>Sf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hme||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>h1(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!XAe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=Yt(this,$d))==null||n.continue()}onOnline(){var n;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=Yt(this,$d))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Yt(this,Nf).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(Yt(this,$d)&&(Yt(this,Rw)?Yt(this,$d).cancel({revert:!0}):Yt(this,$d).cancelRetry()),this.scheduleGc()),Yt(this,Nf).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ia(this,$p,dx).call(this,{type:"invalidate"})}fetch(e,n){var m,x,v;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Yt(this,$d))return Yt(this,$d).continueRetry(),Yt(this,$d).promise}if(e&&this.setOptions(e),!this.options.queryFn){const w=this.observers.find(k=>k.options.queryFn);w&&this.setOptions(w.options)}const s=new AbortController,i=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(cs(this,Rw,!0),s.signal)})},o=()=>{const w=JAe(this.options,n),C=(()=>{const S={client:Yt(this,Dw),queryKey:this.queryKey,meta:this.meta};return i(S),S})();return cs(this,Rw,!1),this.options.persister?this.options.persister(w,C,this):w(C)},a=(()=>{const w={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Yt(this,Dw),state:this.state,fetchFn:o};return i(w),w})();(m=this.options.behavior)==null||m.onFetch(a,this),cs(this,Ow,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=a.fetchOptions)==null?void 0:x.meta))&&ia(this,$p,dx).call(this,{type:"fetch",meta:(v=a.fetchOptions)==null?void 0:v.meta});const h=w=>{var k,C,S,T;hle(w)&&w.silent||ia(this,$p,dx).call(this,{type:"error",error:w}),hle(w)||((C=(k=Yt(this,Nf).config).onError)==null||C.call(k,w,this),(T=(S=Yt(this,Nf).config).onSettled)==null||T.call(S,this.state.data,w,this)),this.scheduleGc()};return cs(this,$d,nEe({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:s.abort.bind(s),onSuccess:w=>{var k,C,S,T;if(w===void 0){h(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(w)}catch(I){h(I);return}(C=(k=Yt(this,Nf).config).onSuccess)==null||C.call(k,w,this),(T=(S=Yt(this,Nf).config).onSettled)==null||T.call(S,w,this.state.error,this),this.scheduleGc()},onError:h,onFail:(w,k)=>{ia(this,$p,dx).call(this,{type:"failed",failureCount:w,error:k})},onPause:()=>{ia(this,$p,dx).call(this,{type:"pause"})},onContinue:()=>{ia(this,$p,dx).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),Yt(this,$d).start()}},L4=new WeakMap,Ow=new WeakMap,Nf=new WeakMap,Dw=new WeakMap,$d=new WeakMap,UE=new WeakMap,Rw=new WeakMap,$p=new WeakSet,dx=function(e){const n=s=>{switch(e.type){case"failed":return{...s,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...iEe(s.data,this.options),fetchMeta:e.meta??null};case"success":return cs(this,Ow,void 0),{...s,data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return hle(i)&&i.revert&&Yt(this,Ow)?{...Yt(this,Ow),fetchStatus:"idle"}:{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...e.state}}};this.state=n(this.state),Dc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),Yt(this,Nf).notify({query:this,type:"updated",action:e})})},g3e);function iEe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tEe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function JXe(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,s=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ym,x3e,eQe=(x3e=class extends ZC{constructor(e={}){super();ii(this,Ym);this.config=e,cs(this,Ym,new Map)}build(e,n,s){const i=n.queryKey,o=n.queryHash??Vme(i,n);let c=this.get(o);return c||(c=new QXe({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(i)}),this.add(c)),c}add(e){Yt(this,Ym).has(e.queryHash)||(Yt(this,Ym).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=Yt(this,Ym).get(e.queryHash);n&&(e.destroy(),n===e&&Yt(this,Ym).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Dc.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Yt(this,Ym).get(e)}getAll(){return[...Yt(this,Ym).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Qbe(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>Qbe(e,s)):n}notify(e){Dc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Dc.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Dc.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ym=new WeakMap,x3e),Xm,fu,Fw,Qm,Xy,y3e,tQe=(y3e=class extends sEe{constructor(e){super();ii(this,Qm);ii(this,Xm);ii(this,fu);ii(this,Fw);this.mutationId=e.mutationId,cs(this,fu,e.mutationCache),cs(this,Xm,[]),this.state=e.state||aEe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Yt(this,Xm).includes(e)||(Yt(this,Xm).push(e),this.clearGcTimeout(),Yt(this,fu).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){cs(this,Xm,Yt(this,Xm).filter(n=>n!==e)),this.scheduleGc(),Yt(this,fu).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Yt(this,Xm).length||(this.state.status==="pending"?this.scheduleGc():Yt(this,fu).remove(this))}continue(){var e;return((e=Yt(this,Fw))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,c,a,h,m,x,v,w,k,C,S,T,I,A,D,$,F,q,W,K;const n=()=>{ia(this,Qm,Xy).call(this,{type:"continue"})};cs(this,Fw,nEe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Z,re)=>{ia(this,Qm,Xy).call(this,{type:"failed",failureCount:Z,error:re})},onPause:()=>{ia(this,Qm,Xy).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Yt(this,fu).canRun(this)}));const s=this.state.status==="pending",i=!Yt(this,Fw).canStart();try{if(s)n();else{ia(this,Qm,Xy).call(this,{type:"pending",variables:e,isPaused:i}),await((c=(o=Yt(this,fu).config).onMutate)==null?void 0:c.call(o,e,this));const re=await((h=(a=this.options).onMutate)==null?void 0:h.call(a,e));re!==this.state.context&&ia(this,Qm,Xy).call(this,{type:"pending",context:re,variables:e,isPaused:i})}const Z=await Yt(this,Fw).start();return await((x=(m=Yt(this,fu).config).onSuccess)==null?void 0:x.call(m,Z,e,this.state.context,this)),await((w=(v=this.options).onSuccess)==null?void 0:w.call(v,Z,e,this.state.context)),await((C=(k=Yt(this,fu).config).onSettled)==null?void 0:C.call(k,Z,null,this.state.variables,this.state.context,this)),await((T=(S=this.options).onSettled)==null?void 0:T.call(S,Z,null,e,this.state.context)),ia(this,Qm,Xy).call(this,{type:"success",data:Z}),Z}catch(Z){try{throw await((A=(I=Yt(this,fu).config).onError)==null?void 0:A.call(I,Z,e,this.state.context,this)),await(($=(D=this.options).onError)==null?void 0:$.call(D,Z,e,this.state.context)),await((q=(F=Yt(this,fu).config).onSettled)==null?void 0:q.call(F,void 0,Z,this.state.variables,this.state.context,this)),await((K=(W=this.options).onSettled)==null?void 0:K.call(W,void 0,Z,e,this.state.context)),Z}finally{ia(this,Qm,Xy).call(this,{type:"error",error:Z})}}finally{Yt(this,fu).runNext(this)}}},Xm=new WeakMap,fu=new WeakMap,Fw=new WeakMap,Qm=new WeakSet,Xy=function(e){const n=s=>{switch(e.type){case"failed":return{...s,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...s,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Dc.batch(()=>{Yt(this,Xm).forEach(s=>{s.onMutationUpdate(e)}),Yt(this,fu).notify({mutation:this,type:"updated",action:e})})},y3e);function aEe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vx,Up,qE,v3e,rQe=(v3e=class extends ZC{constructor(e={}){super();ii(this,vx);ii(this,Up);ii(this,qE);this.config=e,cs(this,vx,new Set),cs(this,Up,new Map),cs(this,qE,0)}build(e,n,s){const i=new tQe({mutationCache:this,mutationId:++M6(this,qE)._,options:e.defaultMutationOptions(n),state:s});return this.add(i),i}add(e){Yt(this,vx).add(e);const n=Y6(e);if(typeof n=="string"){const s=Yt(this,Up).get(n);s?s.push(e):Yt(this,Up).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Yt(this,vx).delete(e)){const n=Y6(e);if(typeof n=="string"){const s=Yt(this,Up).get(n);if(s)if(s.length>1){const i=s.indexOf(e);i!==-1&&s.splice(i,1)}else s[0]===e&&Yt(this,Up).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Y6(e);if(typeof n=="string"){const s=Yt(this,Up).get(n),i=s==null?void 0:s.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){var s;const n=Y6(e);if(typeof n=="string"){const i=(s=Yt(this,Up).get(n))==null?void 0:s.find(o=>o!==e&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Dc.batch(()=>{Yt(this,vx).forEach(e=>{this.notify({type:"removed",mutation:e})}),Yt(this,vx).clear(),Yt(this,Up).clear()})}getAll(){return Array.from(Yt(this,vx))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>Jbe(n,s))}findAll(e={}){return this.getAll().filter(n=>Jbe(e,n))}notify(e){Dc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Dc.batch(()=>Promise.all(e.map(n=>n.continue().catch(gu))))}},vx=new WeakMap,Up=new WeakMap,qE=new WeakMap,v3e);function Y6(t){var e;return(e=t.options.scope)==null?void 0:e.id}function $ee(t){return{onFetch:(e,n)=>{var x,v,w,k,C;const s=e.options,i=(w=(v=(x=e.fetchOptions)==null?void 0:x.meta)==null?void 0:v.fetchMore)==null?void 0:w.direction,o=((k=e.state.data)==null?void 0:k.pages)||[],c=((C=e.state.data)==null?void 0:C.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const m=async()=>{let S=!1;const T=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(e.signal.aborted?S=!0:e.signal.addEventListener("abort",()=>{S=!0}),e.signal)})},I=JAe(e.options,e.fetchOptions),A=async(D,$,F)=>{if(S)return Promise.reject();if($==null&&D.pages.length)return Promise.resolve(D);const W=(()=>{const he={client:e.client,queryKey:e.queryKey,pageParam:$,direction:F?"backward":"forward",meta:e.options.meta};return T(he),he})(),K=await I(W),{maxPages:Z}=e.options,re=F?WXe:HXe;return{pages:re(D.pages,K,Z),pageParams:re(D.pageParams,$,Z)}};if(i&&o.length){const D=i==="backward",$=D?oEe:fue,F={pages:o,pageParams:c},q=$(s,F);a=await A(F,q,D)}else{const D=t??o.length;do{const $=h===0?c[0]??s.initialPageParam:fue(s,a);if(h>0&&$==null)break;a=await A(a,$),h++}while(h{var S,T;return(T=(S=e.options).persister)==null?void 0:T.call(S,m,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=m}}}function fue(t,{pages:e,pageParams:n}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,n[s],n):void 0}function oEe(t,{pages:e,pageParams:n}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,n[0],n):void 0}function nQe(t,e){return e?fue(t,e)!=null:!1}function sQe(t,e){return!e||!t.getPreviousPageParam?!1:oEe(t,e)!=null}var Dl,w0,j0,O4,D4,k0,R4,F4,_3e,iQe=(_3e=class{constructor(t={}){ii(this,Dl);ii(this,w0);ii(this,j0);ii(this,O4);ii(this,D4);ii(this,k0);ii(this,R4);ii(this,F4);cs(this,Dl,t.queryCache||new eQe),cs(this,w0,t.mutationCache||new rQe),cs(this,j0,t.defaultOptions||{}),cs(this,O4,new Map),cs(this,D4,new Map),cs(this,k0,0)}mount(){M6(this,k0)._++,Yt(this,k0)===1&&(cs(this,R4,Wme.subscribe(async t=>{t&&(await this.resumePausedMutations(),Yt(this,Dl).onFocus())})),cs(this,F4,Bee.subscribe(async t=>{t&&(await this.resumePausedMutations(),Yt(this,Dl).onOnline())})))}unmount(){var t,e;M6(this,k0)._--,Yt(this,k0)===0&&((t=Yt(this,R4))==null||t.call(this),cs(this,R4,void 0),(e=Yt(this,F4))==null||e.call(this),cs(this,F4,void 0))}isFetching(t){return Yt(this,Dl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Yt(this,w0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Yt(this,Dl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=Yt(this,Dl).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(h1(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return Yt(this,Dl).findAll(t).map(({queryKey:e,state:n})=>{const s=n.data;return[e,s]})}setQueryData(t,e,n){const s=this.defaultQueryOptions({queryKey:t}),i=Yt(this,Dl).get(s.queryHash),o=i==null?void 0:i.state.data,c=qXe(e,o);if(c!==void 0)return Yt(this,Dl).build(this,s).setData(c,{...n,manual:!0})}setQueriesData(t,e,n){return Dc.batch(()=>Yt(this,Dl).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Yt(this,Dl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=Yt(this,Dl);Dc.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=Yt(this,Dl);return Dc.batch(()=>(n.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},s=Dc.batch(()=>Yt(this,Dl).findAll(t).map(i=>i.cancel(n)));return Promise.all(s).then(gu).catch(gu)}invalidateQueries(t,e={}){return Dc.batch(()=>(Yt(this,Dl).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},s=Dc.batch(()=>Yt(this,Dl).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(gu)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(gu)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=Yt(this,Dl).build(this,e);return n.isStaleByTime(h1(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(gu).catch(gu)}fetchInfiniteQuery(t){return t.behavior=$ee(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(gu).catch(gu)}ensureInfiniteQueryData(t){return t.behavior=$ee(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Bee.isOnline()?Yt(this,w0).resumePausedMutations():Promise.resolve()}getQueryCache(){return Yt(this,Dl)}getMutationCache(){return Yt(this,w0)}getDefaultOptions(){return Yt(this,j0)}setDefaultOptions(t){cs(this,j0,t)}setQueryDefaults(t,e){Yt(this,O4).set(wj(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Yt(this,O4).values()],n={};return e.forEach(s=>{DA(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){Yt(this,D4).set(wj(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Yt(this,D4).values()],n={};return e.forEach(s=>{DA(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Yt(this,j0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Vme(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Hme&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Yt(this,j0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Yt(this,Dl).clear(),Yt(this,w0).clear()}},Dl=new WeakMap,w0=new WeakMap,j0=new WeakMap,O4=new WeakMap,D4=new WeakMap,k0=new WeakMap,R4=new WeakMap,F4=new WeakMap,_3e),Qu,La,VE,pu,zw,z4,N0,S0,HE,B4,$4,Bw,$w,C0,U4,uo,eT,pue,mue,gue,xue,yue,vue,_ue,cEe,b3e,lEe=(b3e=class extends ZC{constructor(e,n){super();ii(this,uo);ii(this,Qu);ii(this,La);ii(this,VE);ii(this,pu);ii(this,zw);ii(this,z4);ii(this,N0);ii(this,S0);ii(this,HE);ii(this,B4);ii(this,$4);ii(this,Bw);ii(this,$w);ii(this,C0);ii(this,U4,new Set);this.options=n,cs(this,Qu,e),cs(this,S0,null),cs(this,N0,hue()),this.options.experimental_prefetchInRender||Yt(this,N0).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Yt(this,La).addObserver(this),rwe(Yt(this,La),this.options)?ia(this,uo,eT).call(this):this.updateResult(),ia(this,uo,xue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bue(Yt(this,La),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bue(Yt(this,La),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ia(this,uo,yue).call(this),ia(this,uo,vue).call(this),Yt(this,La).removeObserver(this)}setOptions(e){const n=this.options,s=Yt(this,La);if(this.options=Yt(this,Qu).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Sf(this.options.enabled,Yt(this,La))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ia(this,uo,_ue).call(this),Yt(this,La).setOptions(this.options),n._defaulted&&!zee(this.options,n)&&Yt(this,Qu).getQueryCache().notify({type:"observerOptionsUpdated",query:Yt(this,La),observer:this});const i=this.hasListeners();i&&nwe(Yt(this,La),s,this.options,n)&&ia(this,uo,eT).call(this),this.updateResult(),i&&(Yt(this,La)!==s||Sf(this.options.enabled,Yt(this,La))!==Sf(n.enabled,Yt(this,La))||h1(this.options.staleTime,Yt(this,La))!==h1(n.staleTime,Yt(this,La)))&&ia(this,uo,pue).call(this);const o=ia(this,uo,mue).call(this);i&&(Yt(this,La)!==s||Sf(this.options.enabled,Yt(this,La))!==Sf(n.enabled,Yt(this,La))||o!==Yt(this,C0))&&ia(this,uo,gue).call(this,o)}getOptimisticResult(e){const n=Yt(this,Qu).getQueryCache().build(Yt(this,Qu),e),s=this.createResult(n,e);return oQe(this,s)&&(cs(this,pu,s),cs(this,z4,this.options),cs(this,zw,Yt(this,La).state)),s}getCurrentResult(){return Yt(this,pu)}trackResult(e,n){return new Proxy(e,{get:(s,i)=>(this.trackProp(i),n==null||n(i),Reflect.get(s,i))})}trackProp(e){Yt(this,U4).add(e)}getCurrentQuery(){return Yt(this,La)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=Yt(this,Qu).defaultQueryOptions(e),s=Yt(this,Qu).getQueryCache().build(Yt(this,Qu),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(e){return ia(this,uo,eT).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Yt(this,pu)))}createResult(e,n){var Z;const s=Yt(this,La),i=this.options,o=Yt(this,pu),c=Yt(this,zw),a=Yt(this,z4),m=e!==s?e.state:Yt(this,VE),{state:x}=e;let v={...x},w=!1,k;if(n._optimisticResults){const re=this.hasListeners(),he=!re&&rwe(e,n),ue=re&&nwe(e,s,n,i);(he||ue)&&(v={...v,...iEe(x.data,e.options)}),n._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:C,errorUpdatedAt:S,status:T}=v;k=v.data;let I=!1;if(n.placeholderData!==void 0&&k===void 0&&T==="pending"){let re;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(re=o.data,I=!0):re=typeof n.placeholderData=="function"?n.placeholderData((Z=Yt(this,$4))==null?void 0:Z.state.data,Yt(this,$4)):n.placeholderData,re!==void 0&&(T="success",k=uue(o==null?void 0:o.data,re,n),w=!0)}if(n.select&&k!==void 0&&!I)if(o&&k===(c==null?void 0:c.data)&&n.select===Yt(this,HE))k=Yt(this,B4);else try{cs(this,HE,n.select),k=n.select(k),k=uue(o==null?void 0:o.data,k,n),cs(this,B4,k),cs(this,S0,null)}catch(re){cs(this,S0,re)}Yt(this,S0)&&(C=Yt(this,S0),k=Yt(this,B4),S=Date.now(),T="error");const A=v.fetchStatus==="fetching",D=T==="pending",$=T==="error",F=D&&A,q=k!==void 0,K={status:T,fetchStatus:v.fetchStatus,isPending:D,isSuccess:T==="success",isError:$,isInitialLoading:F,isLoading:F,data:k,dataUpdatedAt:v.dataUpdatedAt,error:C,errorUpdatedAt:S,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:A,isRefetching:A&&!D,isLoadingError:$&&!q,isPaused:v.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:$&&q,isStale:Gme(e,n),refetch:this.refetch,promise:Yt(this,N0),isEnabled:Sf(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const re=je=>{K.status==="error"?je.reject(K.error):K.data!==void 0&&je.resolve(K.data)},he=()=>{const je=cs(this,N0,K.promise=hue());re(je)},ue=Yt(this,N0);switch(ue.status){case"pending":e.queryHash===s.queryHash&&re(ue);break;case"fulfilled":(K.status==="error"||K.data!==ue.value)&&he();break;case"rejected":(K.status!=="error"||K.error!==ue.reason)&&he();break}}return K}updateResult(){const e=Yt(this,pu),n=this.createResult(Yt(this,La),this.options);if(cs(this,zw,Yt(this,La).state),cs(this,z4,this.options),Yt(this,zw).data!==void 0&&cs(this,$4,Yt(this,La)),zee(n,e))return;cs(this,pu,n);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!Yt(this,U4).size)return!0;const c=new Set(o??Yt(this,U4));return this.options.throwOnError&&c.add("error"),Object.keys(Yt(this,pu)).some(a=>{const h=a;return Yt(this,pu)[h]!==e[h]&&c.has(h)})};ia(this,uo,cEe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ia(this,uo,xue).call(this)}},Qu=new WeakMap,La=new WeakMap,VE=new WeakMap,pu=new WeakMap,zw=new WeakMap,z4=new WeakMap,N0=new WeakMap,S0=new WeakMap,HE=new WeakMap,B4=new WeakMap,$4=new WeakMap,Bw=new WeakMap,$w=new WeakMap,C0=new WeakMap,U4=new WeakMap,uo=new WeakSet,eT=function(e){ia(this,uo,_ue).call(this);let n=Yt(this,La).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(gu)),n},pue=function(){ia(this,uo,yue).call(this);const e=h1(this.options.staleTime,Yt(this,La));if(bj||Yt(this,pu).isStale||!cue(e))return;const s=XAe(Yt(this,pu).dataUpdatedAt,e)+1;cs(this,Bw,setTimeout(()=>{Yt(this,pu).isStale||this.updateResult()},s))},mue=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Yt(this,La)):this.options.refetchInterval)??!1},gue=function(e){ia(this,uo,vue).call(this),cs(this,C0,e),!(bj||Sf(this.options.enabled,Yt(this,La))===!1||!cue(Yt(this,C0))||Yt(this,C0)===0)&&cs(this,$w,setInterval(()=>{(this.options.refetchIntervalInBackground||Wme.isFocused())&&ia(this,uo,eT).call(this)},Yt(this,C0)))},xue=function(){ia(this,uo,pue).call(this),ia(this,uo,gue).call(this,ia(this,uo,mue).call(this))},yue=function(){Yt(this,Bw)&&(clearTimeout(Yt(this,Bw)),cs(this,Bw,void 0))},vue=function(){Yt(this,$w)&&(clearInterval(Yt(this,$w)),cs(this,$w,void 0))},_ue=function(){const e=Yt(this,Qu).getQueryCache().build(Yt(this,Qu),this.options);if(e===Yt(this,La))return;const n=Yt(this,La);cs(this,La,e),cs(this,VE,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},cEe=function(e){Dc.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(Yt(this,pu))}),Yt(this,Qu).getQueryCache().notify({query:Yt(this,La),type:"observerResultsUpdated"})})},b3e);function aQe(t,e){return Sf(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function rwe(t,e){return aQe(t,e)||t.state.data!==void 0&&bue(t,e,e.refetchOnMount)}function bue(t,e,n){if(Sf(e.enabled,t)!==!1&&h1(e.staleTime,t)!=="static"){const s=typeof n=="function"?n(t):n;return s==="always"||s!==!1&&Gme(t,e)}return!1}function nwe(t,e,n,s){return(t!==e||Sf(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Gme(t,n)}function Gme(t,e){return Sf(e.enabled,t)!==!1&&t.isStaleByTime(h1(e.staleTime,t))}function oQe(t,e){return!zee(t.getCurrentResult(),e)}var lQe=class extends lEe{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:$ee()})}getOptimisticResult(t){return t.behavior=$ee(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var C,S;const{state:n}=t,s=super.createResult(t,e),{isFetching:i,isRefetching:o,isError:c,isRefetchError:a}=s,h=(S=(C=n.fetchMeta)==null?void 0:C.fetchMore)==null?void 0:S.direction,m=c&&h==="forward",x=i&&h==="forward",v=c&&h==="backward",w=i&&h==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:nQe(e,n.data),hasPreviousPage:sQe(e,n.data),isFetchNextPageError:m,isFetchingNextPage:x,isFetchPreviousPageError:v,isFetchingPreviousPage:w,isRefetchError:a&&!m&&!v,isRefetching:o&&!x&&!w}}},M0,T0,Ju,_x,qx,KJ,wue,w3e,cQe=(w3e=class extends ZC{constructor(n,s){super();ii(this,qx);ii(this,M0);ii(this,T0);ii(this,Ju);ii(this,_x);cs(this,M0,n),this.setOptions(s),this.bindMethods(),ia(this,qx,KJ).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const s=this.options;this.options=Yt(this,M0).defaultMutationOptions(n),zee(this.options,s)||Yt(this,M0).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Yt(this,Ju),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&wj(s.mutationKey)!==wj(this.options.mutationKey)?this.reset():((i=Yt(this,Ju))==null?void 0:i.state.status)==="pending"&&Yt(this,Ju).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Yt(this,Ju))==null||n.removeObserver(this)}onMutationUpdate(n){ia(this,qx,KJ).call(this),ia(this,qx,wue).call(this,n)}getCurrentResult(){return Yt(this,T0)}reset(){var n;(n=Yt(this,Ju))==null||n.removeObserver(this),cs(this,Ju,void 0),ia(this,qx,KJ).call(this),ia(this,qx,wue).call(this)}mutate(n,s){var i;return cs(this,_x,s),(i=Yt(this,Ju))==null||i.removeObserver(this),cs(this,Ju,Yt(this,M0).getMutationCache().build(Yt(this,M0),this.options)),Yt(this,Ju).addObserver(this),Yt(this,Ju).execute(n)}},M0=new WeakMap,T0=new WeakMap,Ju=new WeakMap,_x=new WeakMap,qx=new WeakSet,KJ=function(){var s;const n=((s=Yt(this,Ju))==null?void 0:s.state)??aEe();cs(this,T0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},wue=function(n){Dc.batch(()=>{var s,i,o,c,a,h,m,x;if(Yt(this,_x)&&this.hasListeners()){const v=Yt(this,T0).variables,w=Yt(this,T0).context;(n==null?void 0:n.type)==="success"?((i=(s=Yt(this,_x)).onSuccess)==null||i.call(s,n.data,v,w),(c=(o=Yt(this,_x)).onSettled)==null||c.call(o,n.data,null,v,w)):(n==null?void 0:n.type)==="error"&&((h=(a=Yt(this,_x)).onError)==null||h.call(a,n.error,v,w),(x=(m=Yt(this,_x)).onSettled)==null||x.call(m,void 0,n.error,v,w))}this.listeners.forEach(v=>{v(Yt(this,T0))})})},w3e),dEe=P.createContext(void 0),Qr=t=>{const e=P.useContext(dEe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},dQe=({client:t,children:e})=>(P.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),r.jsx(dEe.Provider,{value:t,children:e})),uEe=P.createContext(!1),uQe=()=>P.useContext(uEe);uEe.Provider;function hQe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var fQe=P.createContext(hQe()),pQe=()=>P.useContext(fQe),mQe=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},gQe=t=>{P.useEffect(()=>{t.clearReset()},[t])},xQe=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(i&&t.data===void 0||eEe(n,[t.error,s])),yQe=t=>{if(t.suspense){const e=s=>s==="static"?s:Math.max(s??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...s)=>e(n(...s)):e(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},vQe=(t,e)=>t.isLoading&&t.isFetching&&!e,_Qe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,swe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function hEe(t,e,n){var v,w,k,C,S;const s=uQe(),i=pQe(),o=Qr(),c=o.defaultQueryOptions(t);(w=(v=o.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||w.call(v,c),c._optimisticResults=s?"isRestoring":"optimistic",yQe(c),mQe(c,i),gQe(i);const a=!o.getQueryCache().get(c.queryHash),[h]=P.useState(()=>new e(o,c)),m=h.getOptimisticResult(c),x=!s&&t.subscribed!==!1;if(P.useSyncExternalStore(P.useCallback(T=>{const I=x?h.subscribe(Dc.batchCalls(T)):gu;return h.updateResult(),I},[h,x]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),P.useEffect(()=>{h.setOptions(c)},[c,h]),_Qe(c,m))throw swe(c,h,i);if(xQe({result:m,errorResetBoundary:i,throwOnError:c.throwOnError,query:o.getQueryCache().get(c.queryHash),suspense:c.suspense}))throw m.error;if((C=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||C.call(k,c,m),c.experimental_prefetchInRender&&!bj&&vQe(m,s)){const T=a?swe(c,h,i):(S=o.getQueryCache().get(c.queryHash))==null?void 0:S.promise;T==null||T.catch(gu).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?m:h.trackResult(m)}function rr(t,e){return hEe(t,lEe)}function dr(t,e){const n=Qr(),[s]=P.useState(()=>new cQe(n,t));P.useEffect(()=>{s.setOptions(t)},[s,t]);const i=P.useSyncExternalStore(P.useCallback(c=>s.subscribe(Dc.batchCalls(c)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=P.useCallback((c,a)=>{s.mutate(c,a).catch(gu)},[s]);if(i.error&&eEe(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function bQe(t,e){return hEe(t,lQe)}/** * @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 RA(){return RA=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function fEe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function jQe(){return Math.random().toString(36).substr(2,8)}function awe(t,e){return{usr:t.state,key:t.key,idx:e}}function jue(t,e,n,s){return n===void 0&&(n=null),RA({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?YC(e):e,{state:n,key:e&&e.key||s||jQe()})}function Uee(t){let{pathname:e="/",search:n="",hash:s=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function YC(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let s=t.indexOf("?");s>=0&&(e.search=t.substr(s),t=t.substr(0,s)),t&&(e.pathname=t)}return e}function kQe(t,e,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:o=!1}=s,c=i.history,a=P0.Pop,h=null,m=x();m==null&&(m=0,c.replaceState(RA({},c.state,{idx:m}),""));function x(){return(c.state||{idx:null}).idx}function v(){a=P0.Pop;let T=x(),I=T==null?null:T-m;m=T,h&&h({action:a,location:S.location,delta:I})}function w(T,I){a=P0.Push;let A=jue(S.location,T,I);m=x()+1;let D=awe(A,m),$=S.createHref(A);try{c.pushState(D,"",$)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;i.location.assign($)}o&&h&&h({action:a,location:S.location,delta:1})}function k(T,I){a=P0.Replace;let A=jue(S.location,T,I);m=x();let D=awe(A,m),$=S.createHref(A);c.replaceState(D,"",$),o&&h&&h({action:a,location:S.location,delta:0})}function C(T){let I=i.location.origin!=="null"?i.location.origin:i.location.href,A=typeof T=="string"?T:Uee(T);return A=A.replace(/ $/,"%20"),ac(I,"No window.location.(origin|href) available to create URL for href: "+A),new URL(A,I)}let S={get action(){return a},get location(){return t(i,c)},listen(T){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(iwe,v),h=T,()=>{i.removeEventListener(iwe,v),h=null}},createHref(T){return e(i,T)},createURL:C,encodeLocation(T){let I=C(T);return{pathname:I.pathname,search:I.search,hash:I.hash}},push:w,replace:k,go(T){return c.go(T)}};return S}var owe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(owe||(owe={}));function NQe(t,e,n){return n===void 0&&(n="/"),SQe(t,e,n)}function SQe(t,e,n,s){let i=typeof e=="string"?YC(e):e,o=Kme(i.pathname||"/",n);if(o==null)return null;let c=pEe(t);CQe(c);let a=null;for(let h=0;a==null&&h{let h={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};h.relativePath.startsWith("/")&&(ac(h.relativePath.startsWith(s),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(s.length));let m=f1([s,h.relativePath]),x=n.concat(h);o.children&&o.children.length>0&&(ac(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),pEe(o.children,e,x,m)),!(o.path==null&&!o.index)&&e.push({path:m,score:LQe(m,o.index),routesMeta:x})};return t.forEach((o,c)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,c);else for(let h of mEe(o.path))i(o,c,h)}),e}function mEe(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return i?[o,""]:[o];let c=mEe(s.join("/")),a=[];return a.push(...c.map(h=>h===""?o:[o,h].join("/"))),i&&a.push(...c),a.map(h=>t.startsWith("/")&&h===""?"/":h)}function CQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:OQe(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const MQe=/^:[\w-]+$/,TQe=3,AQe=2,EQe=1,IQe=10,PQe=-2,lwe=t=>t==="*";function LQe(t,e){let n=t.split("/"),s=n.length;return n.some(lwe)&&(s+=PQe),e&&(s+=AQe),n.filter(i=>!lwe(i)).reduce((i,o)=>i+(MQe.test(o)?TQe:o===""?EQe:IQe),s)}function OQe(t,e){return t.length===e.length&&t.slice(0,-1).every((s,i)=>s===e[i])?t[t.length-1]-e[e.length-1]:0}function DQe(t,e,n){let{routesMeta:s}=t,i={},o="/",c=[];for(let a=0;a{let{paramName:w,isOptional:k}=x;if(w==="*"){let S=a[v]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const C=a[v];return k&&!C?m[w]=void 0:m[w]=(C||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:t}}function FQe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),fEe(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let s=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,a,h)=>(s.push({paramName:a,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),s]}function zQe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return fEe(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Kme(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}function BQe(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:i=""}=typeof t=="string"?YC(t):t;return{pathname:n?n.startsWith("/")?n:$Qe(n,e):e,search:VQe(s),hash:HQe(i)}}function $Qe(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function fle(t,e,n,s){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function UQe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Zme(t,e){let n=UQe(t);return e?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function Yme(t,e,n,s){s===void 0&&(s=!1);let i;typeof t=="string"?i=YC(t):(i=RA({},t),ac(!i.pathname||!i.pathname.includes("?"),fle("?","pathname","search",i)),ac(!i.pathname||!i.pathname.includes("#"),fle("#","pathname","hash",i)),ac(!i.search||!i.search.includes("#"),fle("#","search","hash",i)));let o=t===""||i.pathname==="",c=o?"/":i.pathname,a;if(c==null)a=n;else{let v=e.length-1;if(!s&&c.startsWith("..")){let w=c.split("/");for(;w[0]==="..";)w.shift(),v-=1;i.pathname=w.join("/")}a=v>=0?e[v]:"/"}let h=BQe(i,a),m=c&&c!=="/"&&c.endsWith("/"),x=(o||c===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(m||x)&&(h.pathname+="/"),h}const f1=t=>t.join("/").replace(/\/\/+/g,"/"),qQe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),VQe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,HQe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function WQe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const gEe=["post","put","patch","delete"];new Set(gEe);const GQe=["get",...gEe];new Set(GQe);/** * 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 FA(){return FA=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),P.useCallback(function(m,x){if(x===void 0&&(x={}),!a.current)return;if(typeof m=="number"){s.go(m);return}let v=Yme(m,JSON.parse(c),o,x.relative==="path");t==null&&e!=="/"&&(v.pathname=v.pathname==="/"?e:f1([e,v.pathname])),(x.replace?s.replace:s.push)(v,x.state,x)},[e,s,c,o,t])}const XQe=P.createContext(null);function QQe(t){let e=P.useContext(Mg).outlet;return e&&P.createElement(XQe.Provider,{value:t},e)}function hd(){let{matches:t}=P.useContext(Mg),e=t[t.length-1];return e?e.params:{}}function vEe(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=P.useContext(R1),{matches:i}=P.useContext(Mg),{pathname:o}=Tg(),c=JSON.stringify(Zme(i,s.v7_relativeSplatPath));return P.useMemo(()=>Yme(t,JSON.parse(c),o,n==="path"),[t,c,o,n])}function JQe(t,e){return eJe(t,e)}function eJe(t,e,n,s){XC()||ac(!1);let{navigator:i}=P.useContext(R1),{matches:o}=P.useContext(Mg),c=o[o.length-1],a=c?c.params:{};c&&c.pathname;let h=c?c.pathnameBase:"/";c&&c.route;let m=Tg(),x;if(e){var v;let T=typeof e=="string"?YC(e):e;h==="/"||(v=T.pathname)!=null&&v.startsWith(h)||ac(!1),x=T}else x=m;let w=x.pathname||"/",k=w;if(h!=="/"){let T=h.replace(/^\//,"").split("/");k="/"+w.replace(/^\//,"").split("/").slice(T.length).join("/")}let C=NQe(t,{pathname:k}),S=iJe(C&&C.map(T=>Object.assign({},T,{params:Object.assign({},a,T.params),pathname:f1([h,i.encodeLocation?i.encodeLocation(T.pathname).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?h:f1([h,i.encodeLocation?i.encodeLocation(T.pathnameBase).pathname:T.pathnameBase])})),o,n,s);return e&&S?P.createElement(Ane.Provider,{value:{location:FA({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:P0.Pop}},S):S}function tJe(){let t=cJe(),e=WQe(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return P.createElement(P.Fragment,null,P.createElement("h2",null,"Unexpected Application Error!"),P.createElement("h3",{style:{fontStyle:"italic"}},e),n?P.createElement("pre",{style:i},n):null,null)}const rJe=P.createElement(tJe,null);class nJe extends P.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?P.createElement(Mg.Provider,{value:this.props.routeContext},P.createElement(xEe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sJe(t){let{routeContext:e,match:n,children:s}=t,i=P.useContext(Xme);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),P.createElement(Mg.Provider,{value:e},s)}function iJe(t,e,n,s){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),s===void 0&&(s=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=s)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let c=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let x=c.findIndex(v=>v.route.id&&(a==null?void 0:a[v.route.id])!==void 0);x>=0||ac(!1),c=c.slice(0,Math.min(c.length,x+1))}let h=!1,m=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?c=c.slice(0,m+1):c=[c[0]];break}}}return c.reduceRight((x,v,w)=>{let k,C=!1,S=null,T=null;n&&(k=a&&v.route.id?a[v.route.id]:void 0,S=v.route.errorElement||rJe,h&&(m<0&&w===0?(uJe("route-fallback"),C=!0,T=null):m===w&&(C=!0,T=v.route.hydrateFallbackElement||null)));let I=e.concat(c.slice(0,w+1)),A=()=>{let D;return k?D=S:C?D=T:v.route.Component?D=P.createElement(v.route.Component,null):v.route.element?D=v.route.element:D=x,P.createElement(sJe,{match:v,routeContext:{outlet:x,matches:I,isDataRoute:n!=null},children:D})};return n&&(v.route.ErrorBoundary||v.route.errorElement||w===0)?P.createElement(nJe,{location:n.location,revalidation:n.revalidation,component:S,error:k,children:A(),routeContext:{outlet:null,matches:I,isDataRoute:!0}}):A()},null)}var _Ee=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(_Ee||{}),bEe=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}(bEe||{});function aJe(t){let e=P.useContext(Xme);return e||ac(!1),e}function oJe(t){let e=P.useContext(KQe);return e||ac(!1),e}function lJe(t){let e=P.useContext(Mg);return e||ac(!1),e}function wEe(t){let e=lJe(),n=e.matches[e.matches.length-1];return n.route.id||ac(!1),n.route.id}function cJe(){var t;let e=P.useContext(xEe),n=oJe(),s=wEe();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function dJe(){let{router:t}=aJe(_Ee.UseNavigateStable),e=wEe(bEe.UseNavigateStable),n=P.useRef(!1);return yEe(()=>{n.current=!0}),P.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,FA({fromRouteId:e},o)))},[t,e])}const cwe={};function uJe(t,e,n){cwe[t]||(cwe[t]=!0)}function hJe(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function ZJ(t){let{to:e,replace:n,state:s,relative:i}=t;XC()||ac(!1);let{future:o,static:c}=P.useContext(R1),{matches:a}=P.useContext(Mg),{pathname:h}=Tg(),m=ts(),x=Yme(e,Zme(a,o.v7_relativeSplatPath),h,i==="path"),v=JSON.stringify(x);return P.useEffect(()=>m(JSON.parse(v),{replace:n,state:s,relative:i}),[m,v,i,n,s]),null}function fJe(t){return QQe(t.context)}function ln(t){ac(!1)}function pJe(t){let{basename:e="/",children:n=null,location:s,navigationType:i=P0.Pop,navigator:o,static:c=!1,future:a}=t;XC()&&ac(!1);let h=e.replace(/^\/*/,"/"),m=P.useMemo(()=>({basename:h,navigator:o,static:c,future:FA({v7_relativeSplatPath:!1},a)}),[h,a,o,c]);typeof s=="string"&&(s=YC(s));let{pathname:x="/",search:v="",hash:w="",state:k=null,key:C="default"}=s,S=P.useMemo(()=>{let T=Kme(x,h);return T==null?null:{location:{pathname:T,search:v,hash:w,state:k,key:C},navigationType:i}},[h,x,v,w,k,C,i]);return S==null?null:P.createElement(R1.Provider,{value:m},P.createElement(Ane.Provider,{children:n,value:S}))}function mJe(t){let{children:e,location:n}=t;return JQe(kue(e),n)}new Promise(()=>{});function kue(t,e){e===void 0&&(e=[]);let n=[];return P.Children.forEach(t,(s,i)=>{if(!P.isValidElement(s))return;let o=[...e,i];if(s.type===P.Fragment){n.push.apply(n,kue(s.props.children,o));return}s.type!==ln&&ac(!1),!s.props.index||!s.props.children||ac(!1);let c={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=kue(s.props.children,o)),n.push(c)}),n}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Nue(){return Nue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function xJe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yJe(t,e){return t.button===0&&(!e||e==="_self")&&!xJe(t)}function Sue(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let s=t[n];return e.concat(Array.isArray(s)?s.map(i=>[n,i]):[[n,s]])},[]))}function vJe(t,e){let n=Sue(t);return e&&e.forEach((s,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const _Je=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],bJe="6";try{window.__reactRouterVersion=bJe}catch{}const wJe="startTransition",dwe=Dpe[wJe];function jJe(t){let{basename:e,children:n,future:s,window:i}=t,o=P.useRef();o.current==null&&(o.current=wQe({window:i,v5Compat:!0}));let c=o.current,[a,h]=P.useState({action:c.action,location:c.location}),{v7_startTransition:m}=s||{},x=P.useCallback(v=>{m&&dwe?dwe(()=>h(v)):h(v)},[h,m]);return P.useLayoutEffect(()=>c.listen(x),[c,x]),P.useEffect(()=>hJe(s),[s]),P.createElement(pJe,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:c,future:s})}const kJe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",NJe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,io=P.forwardRef(function(e,n){let{onClick:s,relative:i,reloadDocument:o,replace:c,state:a,target:h,to:m,preventScrollReset:x,viewTransition:v}=e,w=gJe(e,_Je),{basename:k}=P.useContext(R1),C,S=!1;if(typeof m=="string"&&NJe.test(m)&&(C=m,kJe))try{let D=new URL(window.location.href),$=m.startsWith("//")?new URL(D.protocol+m):new URL(m),F=Kme($.pathname,k);$.origin===D.origin&&F!=null?m=F+$.search+$.hash:S=!0}catch{}let T=ZQe(m,{relative:i}),I=SJe(m,{replace:c,state:a,target:h,preventScrollReset:x,relative:i,viewTransition:v});function A(D){s&&s(D),D.defaultPrevented||I(D)}return P.createElement("a",Nue({},w,{href:C||T,onClick:S||o?s:A,ref:n,target:h}))});var uwe;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(uwe||(uwe={}));var hwe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(hwe||(hwe={}));function SJe(t,e){let{target:n,replace:s,state:i,preventScrollReset:o,relative:c,viewTransition:a}=e===void 0?{}:e,h=ts(),m=Tg(),x=vEe(t,{relative:c});return P.useCallback(v=>{if(yJe(v,n)){v.preventDefault();let w=s!==void 0?s:Uee(m)===Uee(x);h(t,{replace:w,state:i,preventScrollReset:o,relative:c,viewTransition:a})}},[m,h,x,s,i,n,t,o,c,a])}function Pd(t){let e=P.useRef(Sue(t)),n=P.useRef(!1),s=Tg(),i=P.useMemo(()=>vJe(s.search,n.current?null:e.current),[s.search]),o=ts(),c=P.useCallback((a,h)=>{const m=Sue(typeof a=="function"?a(i):a);n.current=!0,o("?"+m,h)},[o,i]);return[i,c]}var CJe=typeof Element<"u",MJe=typeof Map=="function",TJe=typeof Set=="function",AJe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function YJ(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(s=n;s--!==0;)if(!YJ(t[s],e[s]))return!1;return!0}var o;if(MJe&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(o=t.entries();!(s=o.next()).done;)if(!e.has(s.value[0]))return!1;for(o=t.entries();!(s=o.next()).done;)if(!YJ(s.value[1],e.get(s.value[0])))return!1;return!0}if(TJe&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(o=t.entries();!(s=o.next()).done;)if(!e.has(s.value[0]))return!1;return!0}if(AJe&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(s=n;s--!==0;)if(t[s]!==e[s])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[s]))return!1;if(CJe&&t instanceof Element)return!1;for(s=n;s--!==0;)if(!((i[s]==="_owner"||i[s]==="__v"||i[s]==="__o")&&t.$$typeof)&&!YJ(t[i[s]],e[i[s]]))return!1;return!0}return t!==t&&e!==e}var EJe=function(e,n){try{return YJ(e,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const IJe=Da(EJe);var PJe=function(t,e,n,s,i,o,c,a){if(!t){var h;if(e===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[n,s,i,o,c,a],x=0;h=new Error(e.replace(/%s/g,function(){return m[x++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}},LJe=PJe;const fwe=Da(LJe);var OJe=function(e,n,s,i){var o=s?s.call(i,e,n):void 0;if(o!==void 0)return!!o;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var c=Object.keys(e),a=Object.keys(n);if(c.length!==a.length)return!1;for(var h=Object.prototype.hasOwnProperty.bind(n),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))(jEe||{}),ple={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"]}},pwe=Object.values(jEe),Qme={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},RJe=Object.entries(Qme).reduce((t,[e,n])=>(t[n]=e,t),{}),Jp="data-rh",p4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},m4=(t,e)=>{for(let n=t.length-1;n>=0;n-=1){const s=t[n];if(Object.prototype.hasOwnProperty.call(s,e))return s[e]}return null},FJe=t=>{let e=m4(t,"title");const n=m4(t,p4.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const s=m4(t,p4.DEFAULT_TITLE);return e||s||void 0},zJe=t=>m4(t,p4.ON_CHANGE_CLIENT_STATE)||(()=>{}),mle=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,s)=>({...n,...s}),{}),BJe=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(t),SM=(t,e,n)=>{const s={};return n.filter(i=>Array.isArray(i[t])?!0:(typeof i[t]<"u"&&$Je(`Helmet: ${t} should be of type "Array". Instead found type "${typeof i[t]}"`),!1)).map(i=>i[t]).reverse().reduce((i,o)=>{const c={};o.filter(h=>{let m;const x=Object.keys(h);for(let w=0;wi.push(h));const a=Object.keys(c);for(let h=0;h{if(Array.isArray(t)&&t.length){for(let n=0;n({baseTag:BJe(["href"],t),bodyAttributes:mle("bodyAttributes",t),defer:m4(t,p4.DEFER),encode:m4(t,p4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:mle("htmlAttributes",t),linkTags:SM("link",["rel","href"],t),metaTags:SM("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:SM("noscript",["innerHTML"],t),onChangeClientState:zJe(t),scriptTags:SM("script",["src","innerHTML"],t),styleTags:SM("style",["cssText"],t),title:FJe(t),titleAttributes:mle("titleAttributes",t),prioritizeSeoTags:UJe(t,p4.PRIORITIZE_SEO_TAGS)}),kEe=t=>Array.isArray(t)?t.join(""):t,VJe=(t,e)=>{const n=Object.keys(t);for(let s=0;sArray.isArray(t)?t.reduce((n,s)=>(VJe(s,e)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:t,priority:[]},mwe=(t,e)=>({...t,[e]:void 0}),HJe=["noscript","script","style"],Cue=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),NEe=t=>Object.keys(t).reduce((e,n)=>{const s=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${s}`:s},""),WJe=(t,e,n,s)=>{const i=NEe(n),o=kEe(e);return i?`<${t} ${Jp}="true" ${i}>${Cue(o,s)}`:`<${t} ${Jp}="true">${Cue(o,s)}`},GJe=(t,e,n=!0)=>e.reduce((s,i)=>{const o=i,c=Object.keys(o).filter(m=>!(m==="innerHTML"||m==="cssText")).reduce((m,x)=>{const v=typeof o[x]>"u"?x:`${x}="${Cue(o[x],n)}"`;return m?`${m} ${v}`:v},""),a=o.innerHTML||o.cssText||"",h=HJe.indexOf(t)===-1;return`${s}<${t} ${Jp}="true" ${c}${h?"/>":`>${a}`}`},""),SEe=(t,e={})=>Object.keys(t).reduce((n,s)=>{const i=Qme[s];return n[i||s]=t[s],n},e),KJe=(t,e,n)=>{const s={key:e,[Jp]:!0},i=SEe(n,s);return[lt.createElement("title",i,e)]},XJ=(t,e)=>e.map((n,s)=>{const i={key:s,[Jp]:!0};return Object.keys(n).forEach(o=>{const a=Qme[o]||o;if(a==="innerHTML"||a==="cssText"){const h=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:h}}else i[a]=n[o]}),lt.createElement(t,i)}),kf=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>KJe(t,e.title,e.titleAttributes),toString:()=>WJe(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>SEe(e),toString:()=>NEe(e)};default:return{toComponent:()=>XJ(t,e),toString:()=>GJe(t,e,n)}}},ZJe=({metaTags:t,linkTags:e,scriptTags:n,encode:s})=>{const i=gle(t,ple.meta),o=gle(e,ple.link),c=gle(n,ple.script);return{priorityMethods:{toComponent:()=>[...XJ("meta",i.priority),...XJ("link",o.priority),...XJ("script",c.priority)],toString:()=>`${kf("meta",i.priority,s)} ${kf("link",o.priority,s)} ${kf("script",c.priority,s)}`},metaTags:i.default,linkTags:o.default,scriptTags:c.default}},YJe=t=>{const{baseTag:e,bodyAttributes:n,encode:s=!0,htmlAttributes:i,noscriptTags:o,styleTags:c,title:a="",titleAttributes:h,prioritizeSeoTags:m}=t;let{linkTags:x,metaTags:v,scriptTags:w}=t,k={toComponent:()=>{},toString:()=>""};return m&&({priorityMethods:k,linkTags:x,metaTags:v,scriptTags:w}=ZJe(t)),{priority:k,base:kf("base",e,s),bodyAttributes:kf("bodyAttributes",n,s),htmlAttributes:kf("htmlAttributes",i,s),link:kf("link",x,s),meta:kf("meta",v,s),noscript:kf("noscript",o,s),script:kf("script",w,s),style:kf("style",c,s),title:kf("title",{title:a,titleAttributes:h},s)}},Mue=YJe,X6=[],CEe=!!(typeof window<"u"&&window.document&&window.document.createElement),Tue=class{constructor(t,e){Wn(this,"instances",[]);Wn(this,"canUseDOM",CEe);Wn(this,"context");Wn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?X6:this.instances,add:t=>{(this.canUseDOM?X6:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?X6:this.instances).indexOf(t);(this.canUseDOM?X6:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=Mue({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},XJe={},MEe=lt.createContext(XJe),Uw,TEe=(Uw=class extends P.Component{constructor(n){super(n);Wn(this,"helmetData");this.helmetData=new Tue(this.props.context||{},Uw.canUseDOM)}render(){return lt.createElement(MEe.Provider,{value:this.helmetData.value},this.props.children)}},Wn(Uw,"canUseDOM",CEe),Uw),FN=(t,e)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${t}[${Jp}]`),i=[].slice.call(s),o=[];let c;return e&&e.length&&e.forEach(a=>{const h=document.createElement(t);for(const m in a)if(Object.prototype.hasOwnProperty.call(a,m))if(m==="innerHTML")h.innerHTML=a.innerHTML;else if(m==="cssText")h.styleSheet?h.styleSheet.cssText=a.cssText:h.appendChild(document.createTextNode(a.cssText));else{const x=m,v=typeof a[x]>"u"?"":a[x];h.setAttribute(m,v)}h.setAttribute(Jp,"true"),i.some((m,x)=>(c=x,h.isEqualNode(m)))?i.splice(c,1):o.push(h)}),i.forEach(a=>{var h;return(h=a.parentNode)==null?void 0:h.removeChild(a)}),o.forEach(a=>n.appendChild(a)),{oldTags:i,newTags:o}},Aue=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const s=n.getAttribute(Jp),i=s?s.split(","):[],o=[...i],c=Object.keys(e);for(const a of c){const h=e[a]||"";n.getAttribute(a)!==h&&n.setAttribute(a,h),i.indexOf(a)===-1&&i.push(a);const m=o.indexOf(a);m!==-1&&o.splice(m,1)}for(let a=o.length-1;a>=0;a-=1)n.removeAttribute(o[a]);i.length===o.length?n.removeAttribute(Jp):n.getAttribute(Jp)!==c.join(",")&&n.setAttribute(Jp,c.join(","))},QJe=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=kEe(t)),Aue("title",e)},gwe=(t,e)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:i,linkTags:o,metaTags:c,noscriptTags:a,onChangeClientState:h,scriptTags:m,styleTags:x,title:v,titleAttributes:w}=t;Aue("body",s),Aue("html",i),QJe(v,w);const k={baseTag:FN("base",n),linkTags:FN("link",o),metaTags:FN("meta",c),noscriptTags:FN("noscript",a),scriptTags:FN("script",m),styleTags:FN("style",x)},C={},S={};Object.keys(k).forEach(T=>{const{newTags:I,oldTags:A}=k[T];I.length&&(C[T]=I),A.length&&(S[T]=k[T].oldTags)}),e&&e(),h(t,C,S)},CM=null,JJe=t=>{CM&&cancelAnimationFrame(CM),t.defer?CM=requestAnimationFrame(()=>{gwe(t,()=>{CM=null})}):(gwe(t),CM=null)},eet=JJe,xwe=class extends P.Component{constructor(){super(...arguments);Wn(this,"rendered",!1)}shouldComponentUpdate(e){return!DJe(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:n}=this.props.context;let s=null;const i=qJe(e.get().map(o=>{const c={...o.props};return delete c.context,c}));TEe.canUseDOM?eet(i):Mue&&(s=Mue(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},ide,Ag=(ide=class extends P.Component{shouldComponentUpdate(t){return!IJe(mwe(this.props,"helmetData"),mwe(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,s){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,s)}]}}mapObjectTypeChildren(t,e,n,s){switch(t.type){case"title":return{...e,[t.type]:s,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(s=>{n={...n,[s]:t[s]}}),n}warnOnInvalidChildren(t,e){return fwe(pwe.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${pwe.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),fwe(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return lt.Children.forEach(t,s=>{if(!s||!s.props)return;const{children:i,...o}=s.props,c=Object.keys(o).reduce((h,m)=>(h[RJe[m]||m]=o[m],h),{});let{type:a}=s;switch(typeof a=="symbol"?a=a.toString():this.warnOnInvalidChildren(s,i),a){case"Symbol(react.fragment)":e=this.mapChildrenToProps(i,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,c,i);break;default:e=this.mapObjectTypeChildren(s,e,c,i);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:s}=e;if(t&&(n=this.mapChildrenToProps(t,n)),s&&!(s instanceof Tue)){const i=s;s=new Tue(i.context,!0),delete n.helmetData}return s?lt.createElement(xwe,{...n,context:s.value}):lt.createElement(MEe.Consumer,null,i=>lt.createElement(xwe,{...n,context:i}))}},Wn(ide,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),ide),Eue=function(t,e){return Eue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},Eue(t,e)};function AEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Eue(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Ef=function(){return Ef=Object.assign||function(e){for(var n,s=1,i=arguments.length;s=0;a--)(c=t[a])&&(o=(i<3?c(o):i>3?c(e,n,o):c(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}function IEe(t,e){return function(n,s){e(n,s,t)}}function PEe(t,e,n,s,i,o){function c(I){if(I!==void 0&&typeof I!="function")throw new TypeError("Function expected");return I}for(var a=s.kind,h=a==="getter"?"get":a==="setter"?"set":"value",m=!e&&t?s.static?t:t.prototype:null,x=e||(m?Object.getOwnPropertyDescriptor(m,s.name):{}),v,w=!1,k=n.length-1;k>=0;k--){var C={};for(var S in s)C[S]=S==="access"?{}:s[S];for(var S in s.access)C.access[S]=s.access[S];C.addInitializer=function(I){if(w)throw new TypeError("Cannot add initializers after decoration has completed");o.push(c(I||null))};var T=(0,n[k])(a==="accessor"?{get:x.get,set:x.set}:x[h],C);if(a==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(v=c(T.get))&&(x.get=v),(v=c(T.set))&&(x.set=v),(v=c(T.init))&&i.unshift(v)}else(v=c(T))&&(a==="field"?i.unshift(v):x[h]=v)}m&&Object.defineProperty(m,s.name,x),w=!0}function LEe(t,e,n){for(var s=arguments.length>2,i=0;i0&&o[o.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jme(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),i,o=[],c;try{for(;(e===void 0||e-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(a){c={error:a}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(c)throw c.error}}return o}function BEe(){for(var t=[],e=0;e1||h(k,S)})},C&&(i[k]=C(i[k])))}function h(k,C){try{m(s[k](C))}catch(S){w(o[0][3],S)}}function m(k){k.value instanceof Q4?Promise.resolve(k.value.v).then(x,v):w(o[0][2],k)}function x(k){h("next",k)}function v(k){h("throw",k)}function w(k,C){k(C),o.shift(),o.length&&h(o[0][0],o[0][1])}}function qEe(t){var e,n;return e={},s("next"),s("throw",function(i){throw i}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(i,o){e[i]=t[i]?function(c){return(n=!n)?{value:Q4(t[i](c)),done:!1}:o?o(c):c}:o}}function VEe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof qee=="function"?qee(t):t[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(o){n[o]=t[o]&&function(c){return new Promise(function(a,h){c=t[o](c),i(a,h,c.done,c.value)})}}function i(o,c,a,h){Promise.resolve(h).then(function(m){o({value:m,done:a})},c)}}function HEe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var tet=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},Iue=function(t){return Iue=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},Iue(t)};function WEe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=Iue(t),s=0;s0){document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),a=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=Promise.allSettled(n.map(h=>{if(h=aet(h),h in ywe)return;ywe[h]=!0;const m=h.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":iet,m||(v.as="script"),v.crossOrigin="",v.href=h,a&&v.setAttribute("nonce",a),document.head.appendChild(v),m)return new Promise((w,k)=>{v.addEventListener("load",w),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=c,window.dispatchEvent(a),!a.defaultPrevented)throw c}return i.then(c=>{for(const a of c||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})},oet=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>QC(async()=>{const{default:s}=await Promise.resolve().then(()=>Kj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)};class tge extends Error{constructor(e,n="FunctionsError",s){super(e),this.name=n,this.context=s}}class vwe extends tge{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class _we extends tge{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class bwe extends tge{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Pue;(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"})(Pue||(Pue={}));class cet{constructor(e,{headers:n={},customFetch:s,region:i=Pue.Any}={}){this.url=e,this.headers=n,this.region=i,this.fetch=oet(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ts(this,arguments,void 0,function*(n,s={}){var i;try{const{headers:o,method:c,body:a,signal:h}=s;let m={},{region:x}=s;x||(x=this.region);const v=new URL(`${this.url}/${n}`);x&&x!=="any"&&(m["x-region"]=x,v.searchParams.set("forceFunctionRegion",x));let w;a&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",w=a):typeof a=="string"?(m["Content-Type"]="text/plain",w=a):typeof FormData<"u"&&a instanceof FormData?w=a:(m["Content-Type"]="application/json",w=JSON.stringify(a)):w=a;const k=yield this.fetch(v.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),o),body:w,signal:h}).catch(I=>{throw I.name==="AbortError"?I:new vwe(I)}),C=k.headers.get("x-relay-error");if(C&&C==="true")throw new _we(k);if(!k.ok)throw new bwe(k);let S=((i=k.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),T;return S==="application/json"?T=yield k.json():S==="application/octet-stream"||S==="application/pdf"?T=yield k.blob():S==="text/event-stream"?T=k:S==="multipart/form-data"?T=yield k.formData():T=yield k.text(),{data:T,error:null,response:k}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new vwe(o)}:{data:null,error:o,response:o instanceof bwe||o instanceof _we?o.context:void 0}}})}}var nh={};const JC=j3e(set);var Q6={},J6={},eL={},tL={},rL={},det=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")},J4=det();const uet=J4.fetch,eIe=J4.fetch.bind(J4),tIe=J4.Headers,het=J4.Request,fet=J4.Response,Kj=Object.freeze(Object.defineProperty({__proto__:null,Headers:tIe,Request:het,Response:fet,default:eIe,fetch:uet},Symbol.toStringTag,{value:"Module"})),pet=j3e(Kj);var nL={},wwe;function rIe(){if(wwe)return nL;wwe=1,Object.defineProperty(nL,"__esModule",{value:!0});class t extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return nL.default=t,nL}var jwe;function nIe(){if(jwe)return rL;jwe=1,Object.defineProperty(rL,"__esModule",{value:!0});const t=JC,e=t.__importDefault(pet),n=t.__importDefault(rIe());class s{constructor(o){var c,a;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=(c=o.shouldThrowOnError)!==null&&c!==void 0?c:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,c){return this.headers=new Headers(this.headers),this.headers.set(o,c),this}then(o,c){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 a=this.fetch;let h=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async m=>{var x,v,w,k;let C=null,S=null,T=null,I=m.status,A=m.statusText;if(m.ok){if(this.method!=="HEAD"){const q=await m.text();q===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((x=this.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?S=q:S=JSON.parse(q))}const $=(v=this.headers.get("Prefer"))===null||v===void 0?void 0:v.match(/count=(exact|planned|estimated)/),F=(w=m.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");$&&F&&F.length>1&&(T=parseInt(F[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(S)&&(S.length>1?(C={code:"PGRST116",details:`Results contain ${S.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},S=null,T=null,I=406,A="Not Acceptable"):S.length===1?S=S[0]:S=null)}else{const $=await m.text();try{C=JSON.parse($),Array.isArray(C)&&m.status===404&&(S=[],C=null,I=200,A="OK")}catch{m.status===404&&$===""?(I=204,A="No Content"):C={message:$}}if(C&&this.isMaybeSingle&&(!((k=C==null?void 0:C.details)===null||k===void 0)&&k.includes("0 rows"))&&(C=null,I=200,A="OK"),C&&this.shouldThrowOnError)throw new n.default(C)}return{error:C,data:S,count:T,status:I,statusText:A}});return this.shouldThrowOnError||(h=h.catch(m=>{var x,v,w;return{error:{message:`${(x=m==null?void 0:m.name)!==null&&x!==void 0?x:"FetchError"}: ${m==null?void 0:m.message}`,details:`${(v=m==null?void 0:m.stack)!==null&&v!==void 0?v:""}`,hint:"",code:`${(w=m==null?void 0:m.code)!==null&&w!==void 0?w:""}`},data:null,count:null,status:0,statusText:""}})),h.then(o,c)}returns(){return this}overrideTypes(){return this}}return rL.default=s,rL}var kwe;function sIe(){if(kwe)return tL;kwe=1,Object.defineProperty(tL,"__esModule",{value:!0});const e=JC.__importDefault(nIe());class n extends e.default{select(i){let o=!1;const c=(i??"*").split("").map(a=>/\s/.test(a)&&!o?"":(a==='"'&&(o=!o),a)).join("");return this.url.searchParams.set("select",c),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:o=!0,nullsFirst:c,foreignTable:a,referencedTable:h=a}={}){const m=h?`${h}.order`:"order",x=this.url.searchParams.get(m);return this.url.searchParams.set(m,`${x?`${x},`:""}${i}.${o?"asc":"desc"}${c===void 0?"":c?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:o,referencedTable:c=o}={}){const a=typeof c>"u"?"limit":`${c}.limit`;return this.url.searchParams.set(a,`${i}`),this}range(i,o,{foreignTable:c,referencedTable:a=c}={}){const h=typeof a>"u"?"offset":`${a}.offset`,m=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(h,`${i}`),this.url.searchParams.set(m,`${o-i+1}`),this}abortSignal(i){return this.signal=i,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:i=!1,verbose:o=!1,settings:c=!1,buffers:a=!1,wal:h=!1,format:m="text"}={}){var x;const v=[i?"analyze":null,o?"verbose":null,c?"settings":null,a?"buffers":null,h?"wal":null].filter(Boolean).join("|"),w=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${m}; for="${w}"; options=${v};`),m==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}}return tL.default=n,tL}var Nwe;function rge(){if(Nwe)return eL;Nwe=1,Object.defineProperty(eL,"__esModule",{value:!0});const e=JC.__importDefault(sIe()),n=new RegExp("[,()]");class s extends e.default{eq(o,c){return this.url.searchParams.append(o,`eq.${c}`),this}neq(o,c){return this.url.searchParams.append(o,`neq.${c}`),this}gt(o,c){return this.url.searchParams.append(o,`gt.${c}`),this}gte(o,c){return this.url.searchParams.append(o,`gte.${c}`),this}lt(o,c){return this.url.searchParams.append(o,`lt.${c}`),this}lte(o,c){return this.url.searchParams.append(o,`lte.${c}`),this}like(o,c){return this.url.searchParams.append(o,`like.${c}`),this}likeAllOf(o,c){return this.url.searchParams.append(o,`like(all).{${c.join(",")}}`),this}likeAnyOf(o,c){return this.url.searchParams.append(o,`like(any).{${c.join(",")}}`),this}ilike(o,c){return this.url.searchParams.append(o,`ilike.${c}`),this}ilikeAllOf(o,c){return this.url.searchParams.append(o,`ilike(all).{${c.join(",")}}`),this}ilikeAnyOf(o,c){return this.url.searchParams.append(o,`ilike(any).{${c.join(",")}}`),this}is(o,c){return this.url.searchParams.append(o,`is.${c}`),this}in(o,c){const a=Array.from(new Set(c)).map(h=>typeof h=="string"&&n.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${a})`),this}contains(o,c){return typeof c=="string"?this.url.searchParams.append(o,`cs.${c}`):Array.isArray(c)?this.url.searchParams.append(o,`cs.{${c.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(c)}`),this}containedBy(o,c){return typeof c=="string"?this.url.searchParams.append(o,`cd.${c}`):Array.isArray(c)?this.url.searchParams.append(o,`cd.{${c.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(c)}`),this}rangeGt(o,c){return this.url.searchParams.append(o,`sr.${c}`),this}rangeGte(o,c){return this.url.searchParams.append(o,`nxl.${c}`),this}rangeLt(o,c){return this.url.searchParams.append(o,`sl.${c}`),this}rangeLte(o,c){return this.url.searchParams.append(o,`nxr.${c}`),this}rangeAdjacent(o,c){return this.url.searchParams.append(o,`adj.${c}`),this}overlaps(o,c){return typeof c=="string"?this.url.searchParams.append(o,`ov.${c}`):this.url.searchParams.append(o,`ov.{${c.join(",")}}`),this}textSearch(o,c,{config:a,type:h}={}){let m="";h==="plain"?m="pl":h==="phrase"?m="ph":h==="websearch"&&(m="w");const x=a===void 0?"":`(${a})`;return this.url.searchParams.append(o,`${m}fts${x}.${c}`),this}match(o){return Object.entries(o).forEach(([c,a])=>{this.url.searchParams.append(c,`eq.${a}`)}),this}not(o,c,a){return this.url.searchParams.append(o,`not.${c}.${a}`),this}or(o,{foreignTable:c,referencedTable:a=c}={}){const h=a?`${a}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,c,a){return this.url.searchParams.append(o,`${c}.${a}`),this}}return eL.default=s,eL}var Swe;function iIe(){if(Swe)return J6;Swe=1,Object.defineProperty(J6,"__esModule",{value:!0});const e=JC.__importDefault(rge());class n{constructor(i,{headers:o={},schema:c,fetch:a}){this.url=i,this.headers=new Headers(o),this.schema=c,this.fetch=a}select(i,o){const{head:c=!1,count:a}=o??{},h=c?"HEAD":"GET";let m=!1;const x=(i??"*").split("").map(v=>/\s/.test(v)&&!m?"":(v==='"'&&(m=!m),v)).join("");return this.url.searchParams.set("select",x),a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(i,{count:o,defaultToNull:c=!0}={}){var a;const h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),c||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const m=i.reduce((x,v)=>x.concat(Object.keys(v)),[]);if(m.length>0){const x=[...new Set(m)].map(v=>`"${v}"`);this.url.searchParams.set("columns",x.join(","))}}return new e.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(i,{onConflict:o,ignoreDuplicates:c=!1,count:a,defaultToNull:h=!0}={}){var m;const x="POST";if(this.headers.append("Prefer",`resolution=${c?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),a&&this.headers.append("Prefer",`count=${a}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const v=i.reduce((w,k)=>w.concat(Object.keys(k)),[]);if(v.length>0){const w=[...new Set(v)].map(k=>`"${k}"`);this.url.searchParams.set("columns",w.join(","))}}return new e.default({method:x,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(m=this.fetch)!==null&&m!==void 0?m:fetch})}update(i,{count:o}={}){var c;const a="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new e.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch})}delete({count:i}={}){var o;const c="DELETE";return i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:c,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return J6.default=n,J6}var Cwe;function met(){if(Cwe)return Q6;Cwe=1,Object.defineProperty(Q6,"__esModule",{value:!0});const t=JC,e=t.__importDefault(iIe()),n=t.__importDefault(rge());class s{constructor(o,{headers:c={},schema:a,fetch:h}={}){this.url=o,this.headers=new Headers(c),this.schemaName=a,this.fetch=h}from(o){const c=new URL(`${this.url}/${o}`);return new e.default(c,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new s(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,c={},{head:a=!1,get:h=!1,count:m}={}){var x;let v;const w=new URL(`${this.url}/rpc/${o}`);let k;a||h?(v=a?"HEAD":"GET",Object.entries(c).filter(([S,T])=>T!==void 0).map(([S,T])=>[S,Array.isArray(T)?`{${T.join(",")}}`:`${T}`]).forEach(([S,T])=>{w.searchParams.append(S,T)})):(v="POST",k=c);const C=new Headers(this.headers);return m&&C.set("Prefer",`count=${m}`),new n.default({method:v,url:w,headers:C,schema:this.schemaName,body:k,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return Q6.default=s,Q6}Object.defineProperty(nh,"__esModule",{value:!0});var aIe=nh.PostgrestError=gIe=nh.PostgrestBuilder=pIe=nh.PostgrestTransformBuilder=hIe=nh.PostgrestFilterBuilder=dIe=nh.PostgrestQueryBuilder=lIe=nh.PostgrestClient=void 0;const e5=JC,oIe=e5.__importDefault(met());var lIe=nh.PostgrestClient=oIe.default;const cIe=e5.__importDefault(iIe());var dIe=nh.PostgrestQueryBuilder=cIe.default;const uIe=e5.__importDefault(rge());var hIe=nh.PostgrestFilterBuilder=uIe.default;const fIe=e5.__importDefault(sIe());var pIe=nh.PostgrestTransformBuilder=fIe.default;const mIe=e5.__importDefault(nIe());var gIe=nh.PostgrestBuilder=mIe.default;const xIe=e5.__importDefault(rIe());aIe=nh.PostgrestError=xIe.default;var yIe=nh.default={PostgrestClient:oIe.default,PostgrestQueryBuilder:cIe.default,PostgrestFilterBuilder:uIe.default,PostgrestTransformBuilder:fIe.default,PostgrestBuilder:mIe.default,PostgrestError:xIe.default};const get=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return gIe},get PostgrestClient(){return lIe},get PostgrestError(){return aIe},get PostgrestFilterBuilder(){return hIe},get PostgrestQueryBuilder(){return dIe},get PostgrestTransformBuilder(){return pIe},default:yIe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:xet,PostgrestQueryBuilder:JGt,PostgrestFilterBuilder:eKt,PostgrestTransformBuilder:tKt,PostgrestBuilder:rKt,PostgrestError:nKt}=yIe||get;class yet{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=` Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const s=this.getWebSocketConstructor();return new s(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const vet="2.78.0",_et=`realtime-js/${vet}`,bet="1.0.0",Lue=1e4,wet=1e3,jet=100;var WT;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(WT||(WT={}));var Ec;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ec||(Ec={}));var Vp;(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"})(Vp||(Vp={}));var Oue;(function(t){t.websocket="websocket"})(Oue||(Oue={}));var pw;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(pw||(pw={}));class ket{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,n,s)}_decodeBroadcast(e,n,s){const i=n.getUint8(1),o=n.getUint8(2);let c=this.HEADER_LENGTH+2;const a=s.decode(e.slice(c,c+i));c=c+i;const h=s.decode(e.slice(c,c+o));c=c+o;const m=JSON.parse(s.decode(e.slice(c,e.byteLength)));return{ref:null,topic:a,event:h,payload:m}}}class vIe{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Uo;(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"})(Uo||(Uo={}));const Mwe=(t,e,n={})=>{var s;const i=(s=n.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((o,c)=>(o[c]=Net(c,t,e,i),o),{}):{}},Net=(t,e,n,s)=>{const i=e.find(a=>a.name===t),o=i==null?void 0:i.type,c=n[t];return o&&!s.includes(o)?_Ie(o,c):Due(c)},_Ie=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Aet(e,n)}switch(t){case Uo.bool:return Cet(e);case Uo.float4:case Uo.float8:case Uo.int2:case Uo.int4:case Uo.int8:case Uo.numeric:case Uo.oid:return Met(e);case Uo.json:case Uo.jsonb:return Tet(e);case Uo.timestamp:return Eet(e);case Uo.abstime:case Uo.date:case Uo.daterange:case Uo.int4range:case Uo.int8range:case Uo.money:case Uo.reltime:case Uo.text:case Uo.time:case Uo.timestamptz:case Uo.timetz:case Uo.tsrange:case Uo.tstzrange:return Due(e);default:return Due(e)}},Due=t=>t,Cet=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Met=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Tet=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},Aet=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,s=t[n];if(t[0]==="{"&&s==="}"){let o;const c=t.slice(1,n);try{o=JSON.parse("["+c+"]")}catch{o=c?c.split(","):[]}return o.map(a=>_Ie(e,a))}return t},Eet=t=>typeof t=="string"?t.replace(" ","T"):t,bIe=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class xle{constructor(e,n,s={},i=Lue){this.channel=e,this.event=n,this.payload=s,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var s;return this._hasReceived(e)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Twe;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Twe||(Twe={}));class GT{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},i=>{const{onJoin:o,onLeave:c,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=GT.syncState(this.state,i,o,c),this.pendingDiffs.forEach(h=>{this.state=GT.syncDiff(this.state,h,o,c)}),this.pendingDiffs=[],a()}),this.channel._on(s.diff,{},i=>{const{onJoin:o,onLeave:c,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=GT.syncDiff(this.state,i,o,c),a())}),this.onJoin((i,o,c)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:c})}),this.onLeave((i,o,c)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:c})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,s,i){const o=this.cloneDeep(e),c=this.transformState(n),a={},h={};return this.map(o,(m,x)=>{c[m]||(h[m]=x)}),this.map(c,(m,x)=>{const v=o[m];if(v){const w=x.map(T=>T.presence_ref),k=v.map(T=>T.presence_ref),C=x.filter(T=>k.indexOf(T.presence_ref)<0),S=v.filter(T=>w.indexOf(T.presence_ref)<0);C.length>0&&(a[m]=C),S.length>0&&(h[m]=S)}else a[m]=x}),this.syncDiff(o,{joins:a,leaves:h},s,i)}static syncDiff(e,n,s,i){const{joins:o,leaves:c}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),i||(i=()=>{}),this.map(o,(a,h)=>{var m;const x=(m=e[a])!==null&&m!==void 0?m:[];if(e[a]=this.cloneDeep(h),x.length>0){const v=e[a].map(k=>k.presence_ref),w=x.filter(k=>v.indexOf(k.presence_ref)<0);e[a].unshift(...w)}s(a,x,h)}),this.map(c,(a,h)=>{let m=e[a];if(!m)return;const x=h.map(v=>v.presence_ref);m=m.filter(v=>x.indexOf(v.presence_ref)<0),e[a]=m,i(a,m,h),m.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(s=>n(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,s)=>{const i=e[s];return"metas"in i?n[s]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=i,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Awe;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Awe||(Awe={}));var KT;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(KT||(KT={}));var fx;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(fx||(fx={}));class nge{constructor(e,n={config:{}},s){var i,o;if(this.topic=e,this.params=n,this.socket=s,this.bindings={},this.state=Ec.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new xle(this,Vp.join,this.params,this.timeout),this.rejoinTimer=new vIe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ec.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(c=>c.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ec.closed,this.socket._remove(this)}),this._onError(c=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,c),this.state=Ec.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ec.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",c=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,c),this.state=Ec.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Vp.reply,{},(c,a)=>{this._trigger(this._replyEventName(a),c)}),this.presence=new GT(this),this.broadcastEndpointURL=bIe(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var s,i,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Ec.closed){const{config:{broadcast:c,presence:a,private:h}}=this.params,m=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(k=>k.filter))!==null&&i!==void 0?i:[],x=!!this.bindings[KT.PRESENCE]&&this.bindings[KT.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,v={},w={broadcast:c,presence:Object.assign(Object.assign({},a),{enabled:x}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(v.access_token=this.socket.accessTokenValue),this._onError(k=>e==null?void 0:e(fx.CHANNEL_ERROR,k)),this._onClose(()=>e==null?void 0:e(fx.CLOSED)),this.updateJoinPayload(Object.assign({config:w},v)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:k})=>{var C;if(this.socket.setAuth(),k===void 0){e==null||e(fx.SUBSCRIBED);return}else{const S=this.bindings.postgres_changes,T=(C=S==null?void 0:S.length)!==null&&C!==void 0?C:0,I=[];for(let A=0;A{this.state=Ec.errored,e==null||e(fx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(k).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(fx.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,s){return this.state===Ec.joined&&e===KT.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,n,s)}async httpSend(e,n,s={}){var i;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(n==null)return Promise.reject("Payload is required for httpSend()");const c={method:"POST",headers:{Authorization:o,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(i=s.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let h=a.statusText;try{const m=await a.json();h=m.error||m.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var s,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:c}=e,h={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:c,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=m.body)===null||i===void 0?void 0:i.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var c,a,h;const m=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(a=(c=this.params)===null||c===void 0?void 0:c.config)===null||a===void 0?void 0:a.broadcast)===null||h===void 0)&&h.ack)&&o("ok"),m.receive("ok",()=>o("ok")),m.receive("error",()=>o("error")),m.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ec.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Vp.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(i=>{s=new xle(this,Vp.leave,{},e),s.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ec.closed,this.bindings={}}async _fetchWithTimeout(e,n,s){const i=new AbortController,o=setTimeout(()=>i.abort(),s),c=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(o),c}_push(e,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new xle(this,e,n,s);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>jet){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,s){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,s){var i,o;const c=e.toLocaleLowerCase(),{close:a,error:h,leave:m,join:x}=Vp;if(s&&[a,h,m,x].indexOf(c)>=0&&s!==this._joinRef())return;let w=this._onMessage(c,n,s);if(n&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(c)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(k=>{var C,S,T;return((C=k.filter)===null||C===void 0?void 0:C.event)==="*"||((T=(S=k.filter)===null||S===void 0?void 0:S.event)===null||T===void 0?void 0:T.toLocaleLowerCase())===c}).map(k=>k.callback(w,s)):(o=this.bindings[c])===null||o===void 0||o.filter(k=>{var C,S,T,I,A,D;if(["broadcast","presence","postgres_changes"].includes(c))if("id"in k){const $=k.id,F=(C=k.filter)===null||C===void 0?void 0:C.event;return $&&((S=n.ids)===null||S===void 0?void 0:S.includes($))&&(F==="*"||(F==null?void 0:F.toLocaleLowerCase())===((T=n.data)===null||T===void 0?void 0:T.type.toLocaleLowerCase()))}else{const $=(A=(I=k==null?void 0:k.filter)===null||I===void 0?void 0:I.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return $==="*"||$===((D=n==null?void 0:n.event)===null||D===void 0?void 0:D.toLocaleLowerCase())}else return k.type.toLocaleLowerCase()===c}).map(k=>{if(typeof w=="object"&&"ids"in w){const C=w.data,{schema:S,table:T,commit_timestamp:I,type:A,errors:D}=C;w=Object.assign(Object.assign({},{schema:S,table:T,commit_timestamp:I,eventType:A,new:{},old:{},errors:D}),this._getPayloadRecords(C))}k.callback(w,s)})}_isClosed(){return this.state===Ec.closed}_isJoined(){return this.state===Ec.joined}_isJoining(){return this.state===Ec.joining}_isLeaving(){return this.state===Ec.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,s){const i=e.toLocaleLowerCase(),o={type:i,filter:n,callback:s};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(e,n){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&nge.isEqual(i.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Vp.close,{},e)}_onError(e){this._on(Vp.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ec.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Mwe(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Mwe(e.columns,e.old_record)),n}}const yle=()=>{},sL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Iet=[1e3,2e3,5e3,1e4],Pet=1e4,Let=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class Oet{constructor(e,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Lue,this.transport=null,this.heartbeatIntervalMs=sL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=yle,this.ref=0,this.reconnectTimer=null,this.logger=yle,this.conn=null,this.sendBuffer=[],this.serializer=new ket,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>{let o;return i?o=i:typeof fetch>"u"?o=(...c)=>QC(async()=>{const{default:a}=await Promise.resolve().then(()=>Kj);return{default:a}},void 0).then(({default:a})=>a(...c)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...c)=>o(...c)},!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Oue.websocket}`,this.httpEndpoint=bIe(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=yet.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:bet}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},e?this.conn.close(e,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,s){this.logger(e,n,s)}connectionState(){switch(this.conn&&this.conn.readyState){case WT.connecting:return pw.Connecting;case WT.open:return pw.Open;case WT.closing:return pw.Closing;default:return pw.Closed}}isConnected(){return this.connectionState()===pw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const s=`realtime:${e}`,i=this.getChannels().find(o=>o.topic===s);if(i)return i;{const o=new nge(`realtime:${e}`,n,this);return this.channels.push(o),o}}push(e){const{topic:n,event:s,payload:i,ref:o}=e,c=()=>{this.encode(e,a=>{var h;(h=this.conn)===null||h===void 0||h.send(a)})};this.log("push",`${n} ${s} (${o})`,i),this.isConnected()?c():this.sendBuffer.push(c)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(wet,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},sL.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(m){this.log("error","error in heartbeat callback",m)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:i,payload:o,ref:c}=n,a=c?`(${c})`:"",h=o.status||"";this.log("receive",`${h} ${s} ${i} ${a}`.trim(),o),this.channels.filter(m=>m._isMember(s)).forEach(m=>m._trigger(i,o,c)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Vp.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const s=e.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${e}${s}${i}`}_workerObjectUrl(e){let n;if(e)n=e;else{const s=new Blob([Let],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n;e?n=e:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:_et};n&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Vp.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(s=>{try{s(n)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new vIe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},sL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,s,i,o,c,a,h,m,x;if(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:Lue,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:sL.HEARTBEAT_INTERVAL,this.worker=(o=e==null?void 0:e.worker)!==null&&o!==void 0?o:!1,this.accessToken=(c=e==null?void 0:e.accessToken)!==null&&c!==void 0?c:null,this.heartbeatCallback=(a=e==null?void 0:e.heartbeatCallback)!==null&&a!==void 0?a:yle,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(h=e==null?void 0:e.reconnectAfterMs)!==null&&h!==void 0?h:v=>Iet[v-1]||Pet,this.encode=(m=e==null?void 0:e.encode)!==null&&m!==void 0?m:(v,w)=>w(JSON.stringify(v)),this.decode=(x=e==null?void 0:e.decode)!==null&&x!==void 0?x:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class sge extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Nl(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class Det extends sge{constructor(e,n,s){super(e),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Rue extends sge{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}const ige=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>QC(async()=>{const{default:s}=await Promise.resolve().then(()=>Kj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Ret=()=>Ts(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield QC(()=>Promise.resolve().then(()=>Kj),void 0)).Response:Response}),Fue=t=>{if(Array.isArray(t))return t.map(n=>Fue(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,s])=>{const i=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[i]=Fue(s)}),e},Fet=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},vle=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},zet=(t,e,n)=>Ts(void 0,void 0,void 0,function*(){const s=yield Ret();t instanceof s&&!(n!=null&&n.noResolveJson)?t.json().then(i=>{const o=t.status||500,c=(i==null?void 0:i.statusCode)||o+"";e(new Det(vle(i),o,c))}).catch(i=>{e(new Rue(vle(i),i))}):e(new Rue(vle(t),t))}),Bet=(t,e,n,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!s?i:(Fet(s)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(s)):i.body=s,e!=null&&e.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),n))};function iI(t,e,n,s,i,o){return Ts(this,void 0,void 0,function*(){return new Promise((c,a)=>{t(n,Bet(e,s,i,o)).then(h=>{if(!h.ok)throw h;return s!=null&&s.noResolveJson?h:h.json()}).then(h=>c(h)).catch(h=>zet(h,a,s))})})}function zA(t,e,n,s){return Ts(this,void 0,void 0,function*(){return iI(t,"GET",e,n,s)})}function Bp(t,e,n,s,i){return Ts(this,void 0,void 0,function*(){return iI(t,"POST",e,s,i,n)})}function zue(t,e,n,s,i){return Ts(this,void 0,void 0,function*(){return iI(t,"PUT",e,s,i,n)})}function $et(t,e,n,s){return Ts(this,void 0,void 0,function*(){return iI(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function age(t,e,n,s,i){return Ts(this,void 0,void 0,function*(){return iI(t,"DELETE",e,s,i,n)})}class Uet{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return Ts(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Nl(e))return{data:null,error:e};throw e}})}}var wIe;class qet{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n,this[wIe]="BlobDownloadBuilder",this.promise=null}asStream(){return new Uet(this.downloadFn,this.shouldThrowOnError)}then(e,n){return this.getPromise().then(e,n)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return Ts(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Nl(e))return{data:null,error:e};throw e}})}}wIe=Symbol.toStringTag;const Vet={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ewe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Het{constructor(e,n={},s,i){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=s,this.fetch=ige(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,s,i){return Ts(this,void 0,void 0,function*(){try{let o;const c=Object.assign(Object.assign({},Ewe),i);let a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(c.upsert)});const h=c.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",c.cacheControl),h&&o.append("metadata",this.encodeMetadata(h)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",c.cacheControl),h&&o.append("metadata",this.encodeMetadata(h))):(o=s,a["cache-control"]=`max-age=${c.cacheControl}`,a["content-type"]=c.contentType,h&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(h)))),i!=null&&i.headers&&(a=Object.assign(Object.assign({},a),i.headers));const m=this._removeEmptyFolders(n),x=this._getFinalPath(m),v=yield(e=="PUT"?zue:Bp)(this.fetch,`${this.url}/object/${x}`,o,Object.assign({headers:a},c!=null&&c.duplex?{duplex:c.duplex}:{}));return{data:{path:m,id:v.Id,fullPath:v.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Nl(o))return{data:null,error:o};throw o}})}upload(e,n,s){return Ts(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,s)})}uploadToSignedUrl(e,n,s,i){return Ts(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),c=this._getFinalPath(o),a=new URL(this.url+`/object/upload/sign/${c}`);a.searchParams.set("token",n);try{let h;const m=Object.assign({upsert:Ewe.upsert},i),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(m.upsert)});typeof Blob<"u"&&s instanceof Blob?(h=new FormData,h.append("cacheControl",m.cacheControl),h.append("",s)):typeof FormData<"u"&&s instanceof FormData?(h=s,h.append("cacheControl",m.cacheControl)):(h=s,x["cache-control"]=`max-age=${m.cacheControl}`,x["content-type"]=m.contentType);const v=yield zue(this.fetch,a.toString(),h,{headers:x});return{data:{path:o,fullPath:v.Key},error:null}}catch(h){if(this.shouldThrowOnError)throw h;if(Nl(h))return{data:null,error:h};throw h}})}createSignedUploadUrl(e,n){return Ts(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const i=Object.assign({},this.headers);n!=null&&n.upsert&&(i["x-upsert"]="true");const o=yield Bp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:i}),c=new URL(this.url+o.url),a=c.searchParams.get("token");if(!a)throw new sge("No token returned by API");return{data:{signedUrl:c.toString(),path:e,token:a},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Nl(s))return{data:null,error:s};throw s}})}update(e,n,s){return Ts(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,s)})}move(e,n,s){return Ts(this,void 0,void 0,function*(){try{return{data:yield Bp(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Nl(i))return{data:null,error:i};throw i}})}copy(e,n,s){return Ts(this,void 0,void 0,function*(){try{return{data:{path:(yield Bp(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Nl(i))return{data:null,error:i};throw i}})}createSignedUrl(e,n,s){return Ts(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),o=yield Bp(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:n},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const c=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${c}`)},{data:o,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Nl(i))return{data:null,error:i};throw i}})}createSignedUrls(e,n,s){return Ts(this,void 0,void 0,function*(){try{const i=yield Bp(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:i.map(c=>Object.assign(Object.assign({},c),{signedUrl:c.signedURL?encodeURI(`${this.url}${c.signedURL}${o}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Nl(i))return{data:null,error:i};throw i}})}download(e,n){const i=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),c=o?`?${o}`:"",a=this._getFinalPath(e),h=()=>zA(this.fetch,`${this.url}/${i}/${a}${c}`,{headers:this.headers,noResolveJson:!0});return new qet(h,this.shouldThrowOnError)}info(e){return Ts(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const s=yield zA(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Fue(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Nl(s))return{data:null,error:s};throw s}})}exists(e){return Ts(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield $et(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Nl(s)&&s instanceof Rue){const i=s.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,n){const s=this._getFinalPath(e),i=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&i.push(o);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",h=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});h!==""&&i.push(h);let m=i.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${s}${m}`)}}}remove(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield age(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}list(e,n,s){return Ts(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},Vet),n),{prefix:e||""});return{data:yield Bp(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},s),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Nl(i))return{data:null,error:i};throw i}})}listV2(e,n){return Ts(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield Bp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Nl(s))return{data:null,error:s};throw s}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const jIe="2.78.0",kIe={"X-Client-Info":`storage-js/${jIe}`};class Wet{constructor(e,n={},s,i){this.shouldThrowOnError=!1;const o=new URL(e);i!=null&&i.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({},kIe),n),this.fetch=ige(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Ts(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(e);return{data:yield zA(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}getBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield zA(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}createBucket(e){return Ts(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield Bp(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:s.type,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Nl(i))return{data:null,error:i};throw i}})}updateBucket(e,n){return Ts(this,void 0,void 0,function*(){try{return{data:yield zue(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Nl(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield Bp(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield age(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}listBucketOptionsToQueryString(e){const n={};return e&&("limit"in e&&(n.limit=String(e.limit)),"offset"in e&&(n.offset=String(e.offset)),e.search&&(n.search=e.search),e.sortColumn&&(n.sortColumn=e.sortColumn),e.sortOrder&&(n.sortOrder=e.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}}class Get{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},kIe),n),this.fetch=ige(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield Bp(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}listBuckets(e){return Ts(this,void 0,void 0,function*(){try{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const s=n.toString(),i=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield zA(this.fetch,i,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield age(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Nl(n))return{data:null,error:n};throw n}})}}const oge={"X-Client-Info":`storage-js/${jIe}`,"Content-Type":"application/json"};class NIe extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Dh(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class _le extends NIe{constructor(e,n,s){super(e),this.name="StorageVectorsApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Ket extends NIe{constructor(e,n){super(e),this.name="StorageVectorsUnknownError",this.originalError=n}}var Iwe;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Iwe||(Iwe={}));const lge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>QC(async()=>{const{default:s}=await Promise.resolve().then(()=>Kj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Zet=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Pwe=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Yet=(t,e,n)=>Ts(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(n!=null&&n.noResolveJson)){const i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(c=>{const a=(c==null?void 0:c.statusCode)||(c==null?void 0:c.code)||i+"";e(new _le(Pwe(c),i,a))}).catch(()=>{const c=i+"",a=o.statusText||`HTTP ${i} error`;e(new _le(a,i,c))});else{const c=i+"",a=o.statusText||`HTTP ${i} error`;e(new _le(a,i,c))}}else e(new Ket(Pwe(t),t))}),Xet=(t,e,n,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return s?(Zet(s)?(i.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(s)):i.body=s,Object.assign(Object.assign({},i),n)):i};function Qet(t,e,n,s,i,o){return Ts(this,void 0,void 0,function*(){return new Promise((c,a)=>{t(n,Xet(e,s,i,o)).then(h=>{if(!h.ok)throw h;if(s!=null&&s.noResolveJson)return h;const m=h.headers.get("content-type");return!m||!m.includes("application/json")?{}:h.json()}).then(h=>c(h)).catch(h=>Yet(h,a,s))})})}function Rh(t,e,n,s,i){return Ts(this,void 0,void 0,function*(){return Qet(t,"POST",e,s,i,n)})}class Jet{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},oge),n),this.fetch=lge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Ts(this,void 0,void 0,function*(){try{return{data:(yield Rh(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}getIndex(e,n){return Ts(this,void 0,void 0,function*(){try{return{data:yield Rh(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dh(s))return{data:null,error:s};throw s}})}listIndexes(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield Rh(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}deleteIndex(e,n){return Ts(this,void 0,void 0,function*(){try{return{data:(yield Rh(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dh(s))return{data:null,error:s};throw s}})}}class ett{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},oge),n),this.fetch=lge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ts(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield Rh(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}getVectors(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield Rh(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}listVectors(e){return Ts(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield Rh(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}queryVectors(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield Rh(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}deleteVectors(e){return Ts(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield Rh(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}}class ttt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},oge),n),this.fetch=lge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:(yield Rh(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}getBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:yield Rh(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}listBuckets(){return Ts(this,arguments,void 0,function*(e={}){try{return{data:yield Rh(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Ts(this,void 0,void 0,function*(){try{return{data:(yield Rh(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dh(n))return{data:null,error:n};throw n}})}}class rtt extends ttt{constructor(e,n={}){super(e,n.headers||{},n.fetch)}from(e){return new ntt(this.url,this.headers,e,this.fetch)}}class ntt extends Jet{constructor(e,n,s,i){super(e,n,i),this.vectorBucketName=s}createIndex(e){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Ts(this,void 0,void 0,function*(){return n.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Ts(this,arguments,void 0,function*(n={}){return e.listIndexes.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){const n=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Ts(this,void 0,void 0,function*(){return n.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){const n=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Ts(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new stt(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class stt extends ett{constructor(e,n,s,i,o){super(e,n,o),this.vectorBucketName=s,this.indexName=i}putVectors(e){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Ts(this,void 0,void 0,function*(){return n.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){const n=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Ts(this,void 0,void 0,function*(){return n.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Ts(this,arguments,void 0,function*(n={}){return e.listVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){const n=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Ts(this,void 0,void 0,function*(){return n.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){const n=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Ts(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class itt extends Wet{constructor(e,n={},s,i){super(e,n,s,i)}from(e){return new Het(this.url,this.headers,e,this.fetch)}get vectors(){return new rtt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Get(this.url+"/iceberg",this.headers,this.fetch)}}const att="2.78.0";let tT="";typeof Deno<"u"?tT="deno":typeof document<"u"?tT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?tT="react-native":tT="node";const ott={"X-Client-Info":`supabase-js-${tT}/${att}`},ltt={headers:ott},ctt={schema:"public"},dtt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},utt={},htt=t=>{let e;return t?e=t:typeof fetch>"u"?e=eIe:e=fetch,(...n)=>e(...n)},ftt=()=>typeof Headers>"u"?tIe:Headers,ptt=(t,e,n)=>{const s=htt(n),i=ftt();return async(o,c)=>{var a;const h=(a=await e())!==null&&a!==void 0?a:t;let m=new i(c==null?void 0:c.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${h}`),s(o,Object.assign(Object.assign({},c),{headers:m}))}};function mtt(t){return t.endsWith("/")?t:t+"/"}function gtt(t,e){var n,s;const{db:i,auth:o,realtime:c,global:a}=t,{db:h,auth:m,realtime:x,global:v}=e,w={db:Object.assign(Object.assign({},h),i),auth:Object.assign(Object.assign({},m),o),realtime:Object.assign(Object.assign({},x),c),storage:{},global:Object.assign(Object.assign(Object.assign({},v),a),{headers:Object.assign(Object.assign({},(n=v==null?void 0:v.headers)!==null&&n!==void 0?n:{}),(s=a==null?void 0:a.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function xtt(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(mtt(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const SIe="2.78.0",oS=30*1e3,Bue=3,ble=Bue*oS,ytt="http://localhost:9999",vtt="supabase.auth.token",_tt={"X-Client-Info":`gotrue-js/${SIe}`},$ue="X-Supabase-Api-Version",CIe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},btt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,wtt=10*60*1e3;class BA extends Error{constructor(e,n,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Ys(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class jtt extends BA{constructor(e,n,s){super(e,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function ktt(t){return Ys(t)&&t.name==="AuthApiError"}class mw extends BA{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class z1 extends BA{constructor(e,n,s,i){super(e,s,i),this.name=n,this.status=s}}class Op extends z1{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ntt(t){return Ys(t)&&t.name==="AuthSessionMissingError"}class zN extends z1{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class iL extends z1{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class aL extends z1{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Stt(t){return Ys(t)&&t.name==="AuthImplicitGrantRedirectError"}class Lwe extends z1{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Uue extends z1{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function wle(t){return Ys(t)&&t.name==="AuthRetryableFetchError"}class Owe extends z1{constructor(e,n,s){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class que extends z1{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Vee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Dwe=` \r=`.split(""),Ctt=(()=>{const t=new Array(128);for(let e=0;e=6;){const s=e.queue>>e.queuedBits-6&63;n(Vee[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;n(Vee[s]),e.queuedBits-=6}}function MIe(t,e,n){const s=Ctt[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Fwe(t){const e=[],n=c=>{e.push(String.fromCodePoint(c))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},o=c=>{Att(c,s,n)};for(let c=0;c>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Ttt(t,e){for(let n=0;n55295&&s<=56319){const i=(s-55296)*1024&65535;s=(t.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}Mtt(s,e)}}function Att(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let s=1;s<6;s+=1)if(!(t>>7-s&1)){e.utf8seq=s;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function g4(t){const e=[],n={queue:0,queuedBits:0},s=i=>{e.push(i)};for(let i=0;ie.push(n)),new Uint8Array(e)}function ww(t){const e=[],n={queue:0,queuedBits:0},s=i=>{e.push(i)};return t.forEach(i=>Rwe(i,n,s)),Rwe(null,n,s),e.join("")}function Itt(t){return Math.round(Date.now()/1e3)+t}function Ptt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const hu=()=>typeof window<"u"&&typeof document<"u",$v={tested:!1,writable:!1},TIe=()=>{if(!hu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if($v.tested)return $v.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),$v.tested=!0,$v.writable=!0}catch{$v.tested=!0,$v.writable=!1}return $v.writable};function Ltt(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,o)=>{e[o]=i})}catch{}return n.searchParams.forEach((s,i)=>{e[i]=s}),e}const AIe=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>QC(async()=>{const{default:s}=await Promise.resolve().then(()=>Kj);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Ott=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",lS=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Uv=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Ky=async(t,e)=>{await t.removeItem(e)};class Ine{constructor(){this.promise=new Ine.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Ine.promiseConstructor=Promise;function jle(t){const e=t.split(".");if(e.length!==3)throw new que("Invalid JWT structure");for(let s=0;s{setTimeout(()=>e(null),t)})}function Rtt(t,e){return new Promise((s,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{const c=await t(o);if(!e(o,null,c)){s(c);return}}catch(c){if(!e(o,c)){i(c);return}}})()})}function Ftt(t){return("0"+t.toString(16)).substr(-2)}function ztt(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let i="";for(let o=0;o<56;o++)i+=n.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(e),Array.from(e,Ftt).join("")}async function Btt(t){const n=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(s);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}async function $tt(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Btt(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function BN(t,e,n=!1){const s=ztt();let i=s;n&&(i+="/PASSWORD_RECOVERY"),await lS(t,`${e}-code-verifier`,i);const o=await $tt(s);return[o,s===o?"plain":"s256"]}const Utt=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function qtt(t){const e=t.headers.get($ue);if(!e||!e.match(Utt))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Vtt(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Htt(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 Wtt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function $N(t){if(!Wtt.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function kle(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Gtt(t,e){return new Proxy(t,{get:(n,s,i)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const o=s.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,s,i)}return!e.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,s,i)}})}function zwe(t){return JSON.parse(JSON.stringify(t))}const cw=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Ktt=[502,503,504];async function Bwe(t){var e;if(!Ott(t))throw new Uue(cw(t),0);if(Ktt.includes(t.status))throw new Uue(cw(t),t.status);let n;try{n=await t.json()}catch(o){throw new mw(cw(o),o)}let s;const i=qtt(t);if(i&&i.getTime()>=CIe["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new Owe(cw(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new Op}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,c)=>o&&typeof c=="string",!0))throw new Owe(cw(n),t.status,n.weak_password.reasons);throw new jtt(cw(n),t.status||500,s)}const Ztt=(t,e,n,s)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),n))};async function ji(t,e,n,s){var i;const o=Object.assign({},s==null?void 0:s.headers);o[$ue]||(o[$ue]=CIe["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const c=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(c.redirect_to=s.redirectTo);const a=Object.keys(c).length?"?"+new URLSearchParams(c).toString():"",h=await Ytt(t,e,n+a,{headers:o,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(h):{data:Object.assign({},h),error:null}}async function Ytt(t,e,n,s,i,o){const c=Ztt(e,s,i,o);let a;try{a=await t(n,Object.assign({},c))}catch(h){throw console.error(h),new Uue(cw(h),0)}if(a.ok||await Bwe(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(h){await Bwe(h)}}function Dp(t){var e;let n=null;Jtt(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Itt(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:s},error:null}}function $we(t){const e=Dp(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,s)=>n&&typeof s=="string",!0)&&(e.data.weak_password=t.weak_password),e}function g0(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Xtt(t){return{data:t,error:null}}function Qtt(t){const{action_link:e,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o}=t,c=F1(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o},h=Object.assign({},c);return{data:{properties:a,user:h},error:null}}function Uwe(t){return t}function Jtt(t){return t.access_token&&t.refresh_token&&t.expires_in}const Nle=["global","local","others"];class ert{constructor({url:e="",headers:n={},fetch:s}){this.url=e,this.headers=n,this.fetch=AIe(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=Nle[0]){if(Nle.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Nle.join(", ")}`);try{return await ji(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Ys(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,n={}){try{return await ji(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:g0})}catch(s){if(Ys(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:n}=e,s=F1(e,["options"]),i=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await ji(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:Qtt,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Ys(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await ji(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:g0})}catch(n){if(Ys(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,s,i,o,c,a,h;try{const m={nextPage:null,lastPage:0,total:0},x=await ji(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:Uwe});if(x.error)throw x.error;const v=await x.json(),w=(c=x.headers.get("x-total-count"))!==null&&c!==void 0?c:0,k=(h=(a=x.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&h!==void 0?h:[];return k.length>0&&(k.forEach(C=>{const S=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(C.split(";")[1].split("=")[1]);m[`${T}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(Ys(m))return{data:{users:[]},error:m};throw m}}async getUserById(e){$N(e);try{return await ji(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:g0})}catch(n){if(Ys(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){$N(e);try{return await ji(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:g0})}catch(s){if(Ys(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,n=!1){$N(e);try{return await ji(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:g0})}catch(s){if(Ys(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){$N(e.userId);try{const{data:n,error:s}=await ji(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:s}}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _deleteFactor(e){$N(e.userId),$N(e.id);try{return{data:await ji(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,s,i,o,c,a,h;try{const m={nextPage:null,lastPage:0,total:0},x=await ji(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:Uwe});if(x.error)throw x.error;const v=await x.json(),w=(c=x.headers.get("x-total-count"))!==null&&c!==void 0?c:0,k=(h=(a=x.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&h!==void 0?h:[];return k.length>0&&(k.forEach(C=>{const S=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(C.split(";")[1].split("=")[1]);m[`${T}Page`]=S}),m.total=parseInt(w)),{data:Object.assign(Object.assign({},v),m),error:null}}catch(m){if(Ys(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(e){try{return await ji(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await ji(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await ji(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Ys(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{return await ji(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await ji(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}}function qwe(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const UN={debug:!!(globalThis&&TIe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class EIe extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class trt extends EIe{}async function rrt(t,e,n){UN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),UN.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){UN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await n()}finally{UN.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw UN.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new trt(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(UN.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function nrt(){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 IIe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function srt(t){return parseInt(t,16)}function irt(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function art(t){var e;const{chainId:n,domain:s,expirationTime:i,issuedAt:o=new Date,nonce:c,notBefore:a,requestId:h,resources:m,scheme:x,uri:v,version:w}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(c&&c.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${c}`);if(!v)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const k=IIe(t.address),C=x?`${x}://${s}`:s,S=t.statement?`${t.statement} `:"",T=`${C} wants you to sign in with your Ethereum account: ${k} ${S}`;let I=`URI: ${v} Version: ${w} Chain ID: ${n}${c?` Nonce: ${c}`:""} Issued At: ${o.toISOString()}`;if(i&&(I+=` Expiration Time: ${i.toISOString()}`),a&&(I+=` Not Before: ${a.toISOString()}`),h&&(I+=` Request ID: ${h}`),m){let A=` Resources:`;for(const D of m){if(!D||typeof D!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${D}`);A+=` - ${D}`}I+=A}return`${T} ${I}`}class gc extends Error{constructor({message:e,code:n,cause:s,name:i}){var o;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(o=i??(s instanceof Error?s.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class Hee extends gc{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function ort({error:t,options:e}){var n,s,i;const{publicKey:o}=e;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new gc({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new gc({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new gc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=o.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new gc({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 gc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new gc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new gc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new gc({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 c=window.location.hostname;if(PIe(c)){if(o.rp.id!==c)return new gc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new gc({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 gc({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 gc({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 gc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function lrt({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new gc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new gc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(PIe(s)){if(n.rpId!==s)return new gc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new gc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new gc({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 gc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class crt{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const drt=new crt;function urt(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:s}=t,i=F1(t,["challenge","user","excludeCredentials"]),o=g4(e).buffer,c=Object.assign(Object.assign({},n),{id:g4(n.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:o,user:c});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let h=0;h0){o.allowCredentials=new Array(n.length);for(let c=0;ci!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of t)if(i)for(const o in i){const c=i[o];if(c!==void 0)if(Array.isArray(c))s[o]=c;else if(n(c))s[o]=c;else if(e(c)){const a=s[o];e(a)?s[o]=Wee(a,c):s[o]=Wee(c)}else s[o]=c}return s}function vrt(t,e){return Wee(xrt,t,e||{})}function _rt(t,e){return Wee(yrt,t,e||{})}class brt{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:s,signal:i},o){try{const{data:c,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!c)return{data:null,error:a};const h=i??drt.createNewAbortSignal();if(c.webauthn.type==="create"){const{user:m}=c.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${s}`),m.displayName||(m.displayName=m.name)}switch(c.webauthn.type){case"create":{const m=vrt(c.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:v}=await mrt({publicKey:m,signal:h});return x?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:x}},error:null}:{data:null,error:v}}case"request":{const m=_rt(c.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:v}=await grt(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:m,signal:h}));return x?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:x}},error:null}:{data:null,error:v}}}}catch(c){return Ys(c)?{data:null,error:c}:{data:null,error:new mw("Unexpected error in challenge",c)}}}async _verify({challengeId:e,factorId:n,webauthn:s}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:s})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i}},o){if(!n)return{data:null,error:new BA("rpId is required for WebAuthn authentication")};try{if(!Vwe())return{data:null,error:new mw("Browser does not support WebAuthn",null)};const{data:c,error:a}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:s},signal:i},{request:o});if(!c)return{data:null,error:a};const{webauthn:h}=c;return this._verify({factorId:e,challengeId:c.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:s,credential_response:h.credential_response}})}catch(c){return Ys(c)?{data:null,error:c}:{data:null,error:new mw("Unexpected error in authenticate",c)}}}async _register({friendlyName:e,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i},o){if(!n)return{data:null,error:new BA("rpId is required for WebAuthn registration")};try{if(!Vwe())return{data:null,error:new mw("Browser does not support WebAuthn",null)};const{data:c,error:a}=await this._enroll({friendlyName:e});if(!c)return await this.client.mfa.listFactors().then(x=>{var v;return(v=x.data)===null||v===void 0?void 0:v.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:a};const{data:h,error:m}=await this._challenge({factorId:c.id,friendlyName:c.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:i},{create:o});return h?this._verify({factorId:c.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(c){return Ys(c)?{data:null,error:c}:{data:null,error:new mw("Unexpected error in register",c)}}}}nrt();const wrt={url:ytt,storageKey:vtt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:_tt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Hwe(t,e,n){return await n()}const qN={};class $A{get jwks(){var e,n;return(n=(e=qN[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){qN[this.storageKey]=Object.assign(Object.assign({},qN[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=qN[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){qN[this.storageKey]=Object.assign(Object.assign({},qN[this.storageKey]),{cachedAt:e})}constructor(e){var n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=$A.nextInstanceID,$A.nextInstanceID+=1,this.instanceID>0&&hu()&&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 i=Object.assign(Object.assign({},wrt),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new ert({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=AIe(i.fetch),this.lock=i.lock||Hwe,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:hu()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=rrt:this.lock=Hwe,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new brt(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:TIe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=qwe(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=qwe(this.memoryStorage)),hu()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${SIe}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const n=Ltt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),hu()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:o}=await this._getSessionFromURL(n,s);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),Stt(o)){const h=(e=o.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:c,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",c,"redirect type",a),await this._saveSession(c),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",c):await this._notifyAllSubscribers("SIGNED_IN",c)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Ys(n)?{error:n}:{error:new mw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,s,i;try{const o=await ji(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:Dp}),{data:c,error:a}=o;if(a||!c)return{data:{user:null,session:null},error:a};const h=c.session,m=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:m,session:h},error:null}}catch(o){if(Ys(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(e){var n,s,i;try{let o;if("email"in e){const{email:x,password:v,options:w}=e;let k=null,C=null;this.flowType==="pkce"&&([k,C]=await BN(this.storage,this.storageKey)),o=await ji(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w==null?void 0:w.emailRedirectTo,body:{email:x,password:v,data:(n=w==null?void 0:w.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken},code_challenge:k,code_challenge_method:C},xform:Dp})}else if("phone"in e){const{phone:x,password:v,options:w}=e;o=await ji(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:v,data:(s=w==null?void 0:w.data)!==null&&s!==void 0?s:{},channel:(i=w==null?void 0:w.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:w==null?void 0:w.captchaToken}},xform:Dp})}else throw new iL("You must provide either an email or phone number and a password");const{data:c,error:a}=o;if(a||!c)return{data:{user:null,session:null},error:a};const h=c.session,m=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:m,session:h},error:null}}catch(o){if(Ys(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(e){try{let n;if("email"in e){const{email:o,password:c,options:a}=e;n=await ji(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:c,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:$we})}else if("phone"in e){const{phone:o,password:c,options:a}=e;n=await ji(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:c,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:$we})}else throw new iL("You must provide either an email or phone number and a password");const{data:s,error:i}=n;return i?{data:{user:null,session:null},error:i}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new zN}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:i})}catch(n){if(Ys(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,s,i,o;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(o=e.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,s,i,o,c,a,h,m,x,v,w;let k,C;if("message"in e)k=e.message,C=e.signature;else{const{chain:S,wallet:T,statement:I,options:A}=e;let D;if(hu())if(typeof T=="object")D=T;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")D=Z.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 T!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=T}const $=new URL((n=A==null?void 0:A.url)!==null&&n!==void 0?n:window.location.href),F=await D.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const q=IIe(F[0]);let W=(s=A==null?void 0:A.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!W){const Z=await D.request({method:"eth_chainId"});W=srt(Z)}const K={domain:$.host,address:q,statement:I,uri:$.href,version:"1",chainId:W,nonce:(i=A==null?void 0:A.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(c=(o=A==null?void 0:A.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&c!==void 0?c:new Date,expirationTime:(a=A==null?void 0:A.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(h=A==null?void 0:A.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(m=A==null?void 0:A.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(x=A==null?void 0:A.signInWithEthereum)===null||x===void 0?void 0:x.resources};k=art(K),C=await D.request({method:"personal_sign",params:[irt(k),q]})}try{const{data:S,error:T}=await ji(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:k,signature:C},!((v=e.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:Dp});if(T)throw T;return!S||!S.session||!S.user?{data:{user:null,session:null},error:new zN}:(S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),{data:Object.assign({},S),error:T})}catch(S){if(Ys(S))return{data:{user:null,session:null},error:S};throw S}}async signInWithSolana(e){var n,s,i,o,c,a,h,m,x,v,w,k;let C,S;if("message"in e)C=e.message,S=e.signature;else{const{chain:T,wallet:I,statement:A,options:D}=e;let $;if(hu())if(typeof I=="object")$=I;else{const q=window;if("solana"in q&&typeof q.solana=="object"&&("signIn"in q.solana&&typeof q.solana.signIn=="function"||"signMessage"in q.solana&&typeof q.solana.signMessage=="function"))$=q.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof I!="object"||!(D!=null&&D.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");$=I}const F=new URL((n=D==null?void 0:D.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in $&&$.signIn){const q=await $.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},D==null?void 0:D.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),A?{statement:A}:null));let W;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")W=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)W=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in W&&"signature"in W&&(typeof W.signedMessage=="string"||W.signedMessage instanceof Uint8Array)&&W.signature instanceof Uint8Array)C=typeof W.signedMessage=="string"?W.signedMessage:new TextDecoder().decode(W.signedMessage),S=W.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in $)||typeof $.signMessage!="function"||!("publicKey"in $)||typeof $!="object"||!$.publicKey||!("toBase58"in $.publicKey)||typeof $.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${F.host} wants you to sign in with your Solana account:`,$.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(i=(s=D==null?void 0:D.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((o=D==null?void 0:D.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${D.signInWithSolana.notBefore}`]:[],...!((c=D==null?void 0:D.signInWithSolana)===null||c===void 0)&&c.expirationTime?[`Expiration Time: ${D.signInWithSolana.expirationTime}`]:[],...!((a=D==null?void 0:D.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${D.signInWithSolana.chainId}`]:[],...!((h=D==null?void 0:D.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${D.signInWithSolana.nonce}`]:[],...!((m=D==null?void 0:D.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${D.signInWithSolana.requestId}`]:[],...!((v=(x=D==null?void 0:D.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||v===void 0)&&v.length?["Resources",...D.signInWithSolana.resources.map(W=>`- ${W}`)]:[]].join(` `);const q=await $.signMessage(new TextEncoder().encode(C),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=q}}try{const{data:T,error:I}=await ji(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:ww(S)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(k=e.options)===null||k===void 0?void 0:k.captchaToken}}:null),xform:Dp});if(I)throw I;return!T||!T.session||!T.user?{data:{user:null,session:null},error:new zN}:(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),{data:Object.assign({},T),error:I})}catch(T){if(Ys(T))return{data:{user:null,session:null},error:T};throw T}}async _exchangeCodeForSession(e){const n=await Uv(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(n??"").split("/");try{const{data:o,error:c}=await ji(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:Dp});if(await Ky(this.storage,`${this.storageKey}-code-verifier`),c)throw c;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new zN}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:i??null}),error:c})}catch(o){if(Ys(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(e){try{const{options:n,provider:s,token:i,access_token:o,nonce:c}=e,a=await ji(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:o,nonce:c,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Dp}),{data:h,error:m}=a;return m?{data:{user:null,session:null},error:m}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new zN}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),{data:h,error:m})}catch(n){if(Ys(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,s,i,o,c;try{if("email"in e){const{email:a,options:h}=e;let m=null,x=null;this.flowType==="pkce"&&([m,x]=await BN(this.storage,this.storageKey));const{error:v}=await ji(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},create_user:(s=h==null?void 0:h.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:m,code_challenge_method:x},redirectTo:h==null?void 0:h.emailRedirectTo});return{data:{user:null,session:null},error:v}}if("phone"in e){const{phone:a,options:h}=e,{data:m,error:x}=await ji(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=h==null?void 0:h.data)!==null&&i!==void 0?i:{},create_user:(o=h==null?void 0:h.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(c=h==null?void 0:h.channel)!==null&&c!==void 0?c:"sms"}});return{data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:x}}throw new iL("You must provide either an email or phone number.")}catch(a){if(Ys(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,s;try{let i,o;"options"in e&&(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo,o=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:c,error:a}=await ji(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:i,xform:Dp});if(a)throw a;if(!c)throw new Error("An error occurred on token verification.");const h=c.session,m=c.user;return h!=null&&h.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),{data:{user:m,session:h},error:null}}catch(i){if(Ys(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(e){var n,s,i;try{let o=null,c=null;return this.flowType==="pkce"&&([o,c]=await BN(this.storage,this.storageKey)),await ji(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:c}),headers:this.headers,xform:Xtt})}catch(o){if(Ys(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:s}=e;if(s)throw s;if(!n)throw new Op;const{error:i}=await ji(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(Ys(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:s,type:i,options:o}=e,{error:c}=await ji(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:i,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:c}}else if("phone"in e){const{phone:s,type:i,options:o}=e,{data:c,error:a}=await ji(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:a}}throw new iL("You must provide either an email or phone number and a type")}catch(n){if(Ys(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Uv(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(e){try{return e?await ji(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:g0}):await this._useSession(async n=>{var s,i,o;const{data:c,error:a}=n;if(a)throw a;return!(!((s=c.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Op}:await ji(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(i=c.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0,xform:g0})})}catch(n){if(Ys(n))return Ntt(n)&&(await this._removeSession(),await Ky(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async s=>{const{data:i,error:o}=s;if(o)throw o;if(!i.session)throw new Op;const c=i.session;let a=null,h=null;this.flowType==="pkce"&&e.email!=null&&([a,h]=await BN(this.storage,this.storageKey));const{data:m,error:x}=await ji(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:h}),jwt:c.access_token,xform:g0});if(x)throw x;return c.user=m.user,await this._saveSession(c),await this._notifyAllSubscribers("USER_UPDATED",c),{data:{user:c.user},error:null}})}catch(s){if(Ys(s))return{data:{user:null},error:s};throw s}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Op;const n=Date.now()/1e3;let s=n,i=!0,o=null;const{payload:c}=jle(e.access_token);if(c.exp&&(s=c.exp,i=s<=n),i){const{data:a,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return{data:{user:null,session:null},error:h};if(!a)return{data:{user:null,session:null},error:null};o=a}else{const{data:a,error:h}=await this._getUser(e.access_token);if(h)throw h;o={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(Ys(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var s;if(!e){const{data:c,error:a}=n;if(a)throw a;e=(s=c.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new Op;const{data:i,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{user:null,session:null},error:o}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Ys(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!hu())throw new aL("No browser detected.");if(e.error||e.error_description||e.error_code)throw new aL(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Lwe("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new aL("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Lwe("No code detected.");const{data:A,error:D}=await this._exchangeCodeForSession(e.code);if(D)throw D;const $=new URL(window.location.href);return $.searchParams.delete("code"),window.history.replaceState(window.history.state,"",$.toString()),{data:{session:A.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:c,expires_in:a,expires_at:h,token_type:m}=e;if(!o||!a||!c||!m)throw new aL("No session defined in URL");const x=Math.round(Date.now()/1e3),v=parseInt(a);let w=x+v;h&&(w=parseInt(h));const k=w-x;k*1e3<=oS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${k}s, should have been closer to ${v}s`);const C=w-v;x-C>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",C,w,x):x-C<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",C,w,x);const{data:S,error:T}=await this._getUser(o);if(T)throw T;const I={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:v,expires_at:w,refresh_token:c,token_type:m,user:S.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:I,redirectType:e.type},error:null}}catch(s){if(Ys(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await Uv(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{error:o};const c=(s=i.session)===null||s===void 0?void 0:s.access_token;if(c){const{error:a}=await this.admin.signOut(c,e);if(a&&!(ktt(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await Ky(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=Ptt(),s={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async n=>{var s,i;try{const{data:{session:o},error:c}=n;if(c)throw c;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",e,"session",o)}catch(o){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",o),console.error(o)}})}async resetPasswordForEmail(e,n={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await BN(this.storage,this.storageKey,!0));try{return await ji(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(Ys(o))return{data:null,error:o};throw o}}async getUserIdentities(){var e;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:s,error:i}=await this._useSession(async o=>{var c,a,h,m,x;const{data:v,error:w}=o;if(w)throw w;const k=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(c=e.options)===null||c===void 0?void 0:c.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await ji(this.fetch,"GET",k,{headers:this.headers,jwt:(x=(m=v.session)===null||m===void 0?void 0:m.access_token)!==null&&x!==void 0?x:void 0})});if(i)throw i;return hu()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:e.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(Ys(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var s;try{const{error:i,data:{session:o}}=n;if(i)throw i;const{options:c,provider:a,token:h,access_token:m,nonce:x}=e,v=await ji(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=o==null?void 0:o.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:h,access_token:m,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:Dp}),{data:w,error:k}=v;return k?{data:{user:null,session:null},error:k}:!w||!w.session||!w.user?{data:{user:null,session:null},error:new zN}:(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),{data:w,error:k})}catch(i){if(Ys(i))return{data:{user:null,session:null},error:i};throw i}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var s,i;const{data:o,error:c}=n;if(c)throw c;return await ji(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await Rtt(async i=>(i>0&&await Dtt(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await ji(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Dp})),(i,o)=>{const c=200*Math.pow(2,i);return o&&wle(o)&&Date.now()+c-s{try{await a.callback(e,n)}catch(h){o.push(h)}});if(await Promise.all(c),o.length>0){for(let a=0;athis._autoRefreshTokenTick(),oS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:s}}=n;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((s.expires_at*1e3-e)/oS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${oS}ms, refresh threshold is ${Bue} ticks`),i<=Bue&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof EIe)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!hu()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,s){const i=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[o,c]=await BN(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(c)}`});i.push(a.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);i.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;return o?{data:null,error:o}:await ji(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var s,i;const{data:o,error:c}=n;if(c)return{data:null,error:c};const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:m}=await ji(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return m?{data:null,error:m}:(e.factorType==="totp"&&h.type==="totp"&&(!((i=h==null?void 0:h.totp)===null||i===void 0)&&i.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),{data:h,error:null})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const c=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?frt(e.webauthn.credential_response):prt(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:h}=await ji(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:c,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return h?{data:null,error:h}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:h})})}catch(n){if(Ys(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const c=await ji(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(c.error)return c;const{data:a}=c;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:urt(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:hrt(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Ys(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:s}=await this.getUser();if(s)return{data:null,error:s};const i={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])i.all.push(o),o.status==="verified"&&i[o.factor_type].push(o);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:s},error:i}=await this.getSession();if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=jle(s.access_token);let c=null;o.aal&&(c=o.aal);let a=c;((n=(e=s.user.factors)===null||e===void 0?void 0:e.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(a="aal2");const m=o.amr||[];return{data:{currentLevel:c,nextLevel:a,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;return i?{data:null,error:i}:s?await ji(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new Op}})}catch(n){if(Ys(n))return{data:null,error:n};throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Op};const c=await ji(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return c.data&&c.data.redirect_url&&hu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(s){if(Ys(s))return{data:null,error:s};throw s}}async _denyAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Op};const c=await ji(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return c.data&&c.data.redirect_url&&hu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(s){if(Ys(s))return{data:null,error:s};throw s}}async fetchJwk(e,n={keys:[]}){let s=n.keys.find(a=>a.kid===e);if(s)return s;const i=Date.now();if(s=this.jwks.keys.find(a=>a.kid===e),s&&this.jwks_cached_at+wtt>i)return s;const{data:o,error:c}=await ji(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(c)throw c;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=i,s=o.keys.find(a=>a.kid===e),!s)?null:s}async getClaims(e,n={}){try{let s=e;if(!s){const{data:k,error:C}=await this.getSession();if(C||!k.session)return{data:null,error:C};s=k.session.access_token}const{header:i,payload:o,signature:c,raw:{header:a,payload:h}}=jle(s);n!=null&&n.allowExpired||Vtt(o.exp);const m=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!m){const{error:k}=await this.getUser(s);if(k)throw k;return{data:{claims:o,header:i,signature:c},error:null}}const x=Htt(i.alg),v=await crypto.subtle.importKey("jwk",m,x,!0,["verify"]);if(!await crypto.subtle.verify(x,v,c,Ett(`${a}.${h}`)))throw new que("Invalid JWT signature");return{data:{claims:o,header:i,signature:c},error:null}}catch(s){if(Ys(s))return{data:null,error:s};throw s}}}$A.nextInstanceID=0;const jrt=$A;class krt extends jrt{constructor(e){super(e)}}class Nrt{constructor(e,n,s){var i,o,c;this.supabaseUrl=e,this.supabaseKey=n;const a=xtt(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const h=`sb-${a.hostname.split(".")[0]}-auth-token`,m={db:ctt,realtime:utt,auth:Object.assign(Object.assign({},dtt),{storageKey:h}),global:ltt},x=gtt(s??{},m);this.storageKey=(i=x.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=x.global.headers)!==null&&o!==void 0?o:{},x.accessToken?(this.accessToken=x.accessToken,this.auth=new Proxy({},{get:(v,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((c=x.auth)!==null&&c!==void 0?c:{},this.headers,x.global.fetch),this.fetch=ptt(n,this._getAccessToken.bind(this),x.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},x.realtime)),this.rest=new xet(new URL("rest/v1",a).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new itt(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new cet(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,n,s)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,n;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(n=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,storageKey:c,flowType:a,lock:h,debug:m},x,v){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new krt({url:this.authUrl.href,headers:Object.assign(Object.assign({},w),x),storageKey:c,autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,flowType:a,lock:h,debug:m,fetch:v,hasCustomAuthorizationHeader:Object.keys(this.headers).some(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Oet(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,s)=>{this._handleTokenChanged(n,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(e,n,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Srt=(t,e,n)=>new Nrt(t,e,n);function Crt(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Crt()&&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 Mrt="https://relzejiswnotikjgvjhz.supabase.co",Trt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",ee=Srt(Mrt,Trt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),LIe=P.createContext(void 0),Art=({children:t})=>{const[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState(!0),[a,h]=P.useState(!1),[m,x]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState([]),[S,T]=P.useState(null),I=ts(),A=async q=>{try{console.log("Checking roles via RPC for user:",q);const[{data:W,error:K},{data:Z,error:re}]=await Promise.all([ee.rpc("has_role",{_user_id:q,_role:"admin"}),ee.rpc("has_role",{_user_id:q,_role:"brokerage_manager"})]);if(K||re)console.error("Role RPC errors:",{isAdminError:K,isBrokerError:re}),h(!1),x(!1);else{const je=!!W,ne=!!Z;console.log("RPC roles result:",{adminValue:je,brokerValue:ne}),h(je),x(ne)}const{data:he,error:ue}=await ee.from("profiles").select("brokerage_id").eq("id",q).single();if(w(!ue&&he?he.brokerage_id:null),Z){console.log("Fetching managed brokerages for user:",q);const{data:je,error:ne}=await ee.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",q);if(console.log("Managed brokerage assignments result:",{assignments:je,assignmentsError:ne}),ne||!je){console.error("Error fetching managed brokerage assignments:",ne),C([]);return}const ye=Array.from(new Set(je.map(ve=>ve.brokerage_id).filter(Boolean)));if(ye.length===0){C([]);return}const{data:ie,error:me}=await ee.from("brokerages").select("id, name").in("id",ye);if(console.log("Managed brokerages details result:",{brokeragesData:ie,brokeragesError:me}),me||!ie){console.error("Error fetching managed brokerages details:",me),C([]);return}const fe=ie.map(ve=>({id:ve.id,name:ve.name})).sort((ve,Ie)=>ye.indexOf(ve.id)-ye.indexOf(Ie.id));console.log("Parsed managed brokerages:",fe),C(fe),fe.length>0&&!S&&T(fe[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),C([])}catch(W){console.error("Unexpected error in checkRoles:",W),h(!1),x(!1),w(null),C([])}};P.useEffect(()=>{const{data:{subscription:q}}=ee.auth.onAuthStateChange((W,K)=>{console.log("Auth event:",W),i(K),n((K==null?void 0:K.user)??null),W==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{I("/profile?reset=true")},100)),K!=null&&K.user?setTimeout(()=>{A(K.user.id)},0):(h(!1),x(!1),w(null),C([]),T(null))});return ee.auth.getSession().then(({data:{session:W}})=>{i(W),n((W==null?void 0:W.user)??null),W!=null&&W.user?A(W.user.id).finally(()=>{c(!1)}):c(!1)}),()=>q.unsubscribe()},[]);const D=async(q,W)=>{const{error:K}=await ee.auth.signInWithPassword({email:q,password:W});if(K)throw He.error(K.message),K;He.success("Welcome back!"),I("/dashboard")},$=async(q,W,K)=>{const Z=`${window.location.origin}/dashboard`,{error:re}=await ee.auth.signUp({email:q,password:W,options:{emailRedirectTo:Z,data:{name:K}}});if(re)throw He.error(re.message),re;He.success("Account created! Welcome to LevelUp."),I("/dashboard")},F=async()=>{try{const{data:{session:q}}=await ee.auth.getSession();if(q){const{error:W}=await ee.auth.signOut();W?W.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",W.message):(console.error("Sign out error:",W),He.error(W.message)):He.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),i(null),h(!1),x(!1),w(null),C([]),T(null),I("/auth")}catch(q){console.error("Unexpected sign out error:",q),I("/auth")}};return r.jsx(LIe.Provider,{value:{user:e,session:s,loading:o,signIn:D,signUp:$,signOut:F,isAdmin:a,isBrokerageManager:m,brokerageId:v,managedBrokerages:k,selectedBrokerageId:S,setSelectedBrokerageId:T},children:t})},zr=()=>{const t=P.useContext(LIe);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},OIe=P.createContext(void 0),VN="levelup_admin_session",qv="levelup_impersonation",Ert=({children:t})=>{const[e,n]=P.useState(!1),[s,i]=P.useState(null),[o,c]=P.useState(!1);P.useEffect(()=>{const m=sessionStorage.getItem(qv);if(m)try{const x=JSON.parse(m);n(!0),i(x)}catch{sessionStorage.removeItem(qv)}},[]);const a=async m=>{c(!0);try{const{data:{session:x}}=await ee.auth.getSession();if(!x)return He.error("No active session found"),!1;const v={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(VN,JSON.stringify(v));const w=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.access_token}`},body:JSON.stringify({targetUserId:m})}),k=await w.json();if(!w.ok)throw new Error(k.error||"Failed to impersonate user");const C={id:k.targetUser.id,name:k.targetUser.name,email:k.targetUser.email};sessionStorage.setItem(qv,JSON.stringify(C));const{error:S}=await ee.auth.verifyOtp({token_hash:k.token_hash,type:"magiclink"});if(S)throw console.error("Verify OTP error:",S),sessionStorage.removeItem(VN),sessionStorage.removeItem(qv),new Error("Failed to establish impersonation session");return n(!0),i(C),He.success(`Now viewing as ${C.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),He.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(VN),sessionStorage.removeItem(qv),!1}finally{c(!1)}},h=async()=>{c(!0);try{const m=sessionStorage.getItem(VN);if(!m){await ee.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(m);await ee.auth.signOut();const{error:v}=await ee.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(VN),sessionStorage.removeItem(qv),v){console.error("Failed to restore admin session:",v),He.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),i(null),He.success("Returned to admin account"),window.location.href="/admin/members"}catch(m){console.error("Stop impersonation error:",m),He.error("Failed to restore admin session"),sessionStorage.removeItem(VN),sessionStorage.removeItem(qv),window.location.href="/auth"}finally{c(!1)}};return r.jsx(OIe.Provider,{value:{isImpersonating:e,impersonatedUser:s,startImpersonation:a,stopImpersonation:h,isLoading:o},children:t})},DIe=()=>{const t=P.useContext(OIe);if(t===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return t},UA=VC("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-full px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),te=P.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,...i},o)=>{const c=s?Mme:"button";return r.jsx(c,{className:$t(UA({variant:e,size:n,className:t})),ref:o,...i})});te.displayName="Button";const Irt=()=>{const{isImpersonating:t,impersonatedUser:e,stopImpersonation:n,isLoading:s}=DIe();return!t||!e?null:r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[100] bg-amber-500 text-amber-950 px-4 py-2 shadow-lg",children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Lh,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("span",{className:"font-medium text-sm md:text-base",children:[r.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),r.jsx("strong",{children:e.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",e.email,")"]})]})]}),r.jsx(te,{size:"sm",variant:"secondary",onClick:n,disabled:s,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:s?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(Es,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Exit Impersonation"}),r.jsx("span",{className:"sm:hidden",children:"Exit"})]})})]})})},Cn=({children:t,requireAdmin:e=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:i,isAdmin:o,isBrokerageManager:c}=zr();return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):s?e&&!o?r.jsx(ZJ,{to:"/dashboard",replace:!0}):n&&!c&&!o?r.jsx(ZJ,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:t}):r.jsx(ZJ,{to:"/auth",replace:!0})};var cge={};(function t(e,n,s,i){var o=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),c=typeof Path2D=="function"&&typeof DOMMatrix=="function",a=function(){if(!e.OffscreenCanvas)return!1;try{var Ie=new OffscreenCanvas(1,1),Se=Ie.getContext("2d");Se.fillRect(0,0,1,1);var oe=Ie.transferToImageBitmap();Se.createPattern(oe,"no-repeat")}catch{return!1}return!0}();function h(){}function m(Ie){var Se=n.exports.Promise,oe=Se!==void 0?Se:e.Promise;return typeof oe=="function"?new oe(Ie):(Ie(h,h),null)}var x=function(Ie,Se){return{transform:function(oe){if(Ie)return oe;if(Se.has(oe))return Se.get(oe);var ae=new OffscreenCanvas(oe.width,oe.height),Ne=ae.getContext("2d");return Ne.drawImage(oe,0,0),Se.set(oe,ae),ae},clear:function(){Se.clear()}}}(a,new Map),v=function(){var Ie=Math.floor(16.666666666666668),Se,oe,ae={},Ne=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Se=function(Te){var Be=Math.random();return ae[Be]=requestAnimationFrame(function Le(Qe){Ne===Qe||Ne+Ie-1{const{data:e,error:n}=await ee.from("celebration_queue").select("*").eq("user_id",t.id).is("seen_at",null).order("created_at",{ascending:!0});if(n)throw n;return e},enabled:!!(t!=null&&t.id),refetchOnWindowFocus:!0,staleTime:0})}function Lrt(){const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}function Ort(){const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{error:s}=await ee.from("celebration_queue").insert({user_id:n.user_id,celebration_type:n.celebration_type,title:n.title,message:n.message||null,points_amount:n.points_amount||null,created_by:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}var Sle="focusScope.autoFocusOnMount",Cle="focusScope.autoFocusOnUnmount",Gwe={bubbles:!1,cancelable:!0},Drt="FocusScope",aI=P.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...c}=t,[a,h]=P.useState(null),m=ql(i),x=ql(o),v=P.useRef(null),w=Xs(e,S=>h(S)),k=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(s){let S=function(D){if(k.paused||!a)return;const $=D.target;a.contains($)?v.current=$:Qy(v.current,{select:!0})},T=function(D){if(k.paused||!a)return;const $=D.relatedTarget;$!==null&&(a.contains($)||Qy(v.current,{select:!0}))},I=function(D){if(document.activeElement===document.body)for(const F of D)F.removedNodes.length>0&&Qy(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",T);const A=new MutationObserver(I);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",T),A.disconnect()}}},[s,a,k.paused]),P.useEffect(()=>{if(a){Zwe.add(k);const S=document.activeElement;if(!a.contains(S)){const I=new CustomEvent(Sle,Gwe);a.addEventListener(Sle,m),a.dispatchEvent(I),I.defaultPrevented||(Rrt(Urt(RIe(a)),{select:!0}),document.activeElement===S&&Qy(a))}return()=>{a.removeEventListener(Sle,m),setTimeout(()=>{const I=new CustomEvent(Cle,Gwe);a.addEventListener(Cle,x),a.dispatchEvent(I),I.defaultPrevented||Qy(S??document.body,{select:!0}),a.removeEventListener(Cle,x),Zwe.remove(k)},0)}}},[a,m,x,k]);const C=P.useCallback(S=>{if(!n&&!s||k.paused)return;const T=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,I=document.activeElement;if(T&&I){const A=S.currentTarget,[D,$]=Frt(A);D&&$?!S.shiftKey&&I===$?(S.preventDefault(),n&&Qy(D,{select:!0})):S.shiftKey&&I===D&&(S.preventDefault(),n&&Qy($,{select:!0})):I===A&&S.preventDefault()}},[n,s,k.paused]);return r.jsx(Dn.div,{tabIndex:-1,...c,ref:w,onKeyDown:C})});aI.displayName=Drt;function Rrt(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(Qy(s,{select:e}),document.activeElement!==n)return}function Frt(t){const e=RIe(t),n=Kwe(e,t),s=Kwe(e.reverse(),t);return[n,s]}function RIe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Kwe(t,e){for(const n of t)if(!zrt(n,{upTo:e}))return n}function zrt(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Brt(t){return t instanceof HTMLInputElement&&"select"in t}function Qy(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Brt(t)&&e&&t.select()}}var Zwe=$rt();function $rt(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Ywe(t,e),t.unshift(e)},remove(e){var n;t=Ywe(t,e),(n=t[0])==null||n.resume()}}}function Ywe(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function Urt(t){return t.filter(e=>e.tagName!=="A")}var Mle=0;function Pne(){P.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Xwe()),document.body.insertAdjacentElement("beforeend",t[1]??Xwe()),Mle++,()=>{Mle===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Mle--}},[])}function Xwe(){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 QJ="right-scroll-bar-position",JJ="width-before-scroll-bar",qrt="with-scroll-bars-hidden",Vrt="--removed-body-scroll-bar-size";function Tle(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Hrt(t,e){var n=P.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=e,n.facade}var Wrt=typeof window<"u"?P.useLayoutEffect:P.useEffect,Qwe=new WeakMap;function Grt(t,e){var n=Hrt(null,function(s){return t.forEach(function(i){return Tle(i,s)})});return Wrt(function(){var s=Qwe.get(n);if(s){var i=new Set(s),o=new Set(t),c=n.current;i.forEach(function(a){o.has(a)||Tle(a,null)}),o.forEach(function(a){i.has(a)||Tle(a,c)})}Qwe.set(n,t)},[t]),n}function Krt(t){return t}function Zrt(t,e){e===void 0&&(e=Krt);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(o){var c=e(o,s);return n.push(c),function(){n=n.filter(function(a){return a!==c})}},assignSyncMedium:function(o){for(s=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){s=!0;var c=[];if(n.length){var a=n;n=[],a.forEach(o),c=n}var h=function(){var x=c;c=[],x.forEach(o)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(x){c.push(x),m()},filter:function(x){return c=c.filter(x),n}}}};return i}function Yrt(t){t===void 0&&(t={});var e=Zrt(null);return e.options=Ef({async:!0,ssr:!1},t),e}var FIe=function(t){var e=t.sideCar,n=F1(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=e.read();if(!s)throw new Error("Sidecar medium not found");return P.createElement(s,Ef({},n))};FIe.isSideCarExport=!0;function Xrt(t,e){return t.useMedium(e),FIe}var zIe=Yrt(),Ale=function(){},Lne=P.forwardRef(function(t,e){var n=P.useRef(null),s=P.useState({onScrollCapture:Ale,onWheelCapture:Ale,onTouchMoveCapture:Ale}),i=s[0],o=s[1],c=t.forwardProps,a=t.children,h=t.className,m=t.removeScrollBar,x=t.enabled,v=t.shards,w=t.sideCar,k=t.noRelative,C=t.noIsolation,S=t.inert,T=t.allowPinchZoom,I=t.as,A=I===void 0?"div":I,D=t.gapMode,$=F1(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=w,q=Grt([n,e]),W=Ef(Ef({},$),i);return P.createElement(P.Fragment,null,x&&P.createElement(F,{sideCar:zIe,removeScrollBar:m,shards:v,noRelative:k,noIsolation:C,inert:S,setCallbacks:o,allowPinchZoom:!!T,lockRef:n,gapMode:D}),c?P.cloneElement(P.Children.only(a),Ef(Ef({},W),{ref:q})):P.createElement(A,Ef({},W,{className:h,ref:q}),a))});Lne.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lne.classNames={fullWidth:JJ,zeroRight:QJ};var Qrt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Jrt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Qrt();return e&&t.setAttribute("nonce",e),t}function ent(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function tnt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var rnt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Jrt())&&(ent(e,n),tnt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},nnt=function(){var t=rnt();return function(e,n){P.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},BIe=function(){var t=nnt(),e=function(n){var s=n.styles,i=n.dynamic;return t(s,i),null};return e},snt={left:0,top:0,right:0,gap:0},Ele=function(t){return parseInt(t||"",10)||0},int=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Ele(n),Ele(s),Ele(i)]},ant=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return snt;var e=int(t),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-n+e[2]-e[0])}},ont=BIe(),x4="data-scroll-locked",lnt=function(t,e,n,s){var i=t.left,o=t.top,c=t.right,a=t.gap;return n===void 0&&(n="margin"),` .`.concat(qrt,` { overflow: hidden `).concat(s,`; padding-right: `).concat(a,"px ").concat(s,`; } body[`).concat(x4,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([e&&"position: relative ".concat(s,";"),n==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(o,`px; padding-right: `).concat(c,`px; margin-left:0; margin-top:0; margin-right: `).concat(a,"px ").concat(s,`; `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),` } .`).concat(QJ,` { right: `).concat(a,"px ").concat(s,`; } .`).concat(JJ,` { margin-right: `).concat(a,"px ").concat(s,`; } .`).concat(QJ," .").concat(QJ,` { right: 0 `).concat(s,`; } .`).concat(JJ," .").concat(JJ,` { margin-right: 0 `).concat(s,`; } body[`).concat(x4,`] { `).concat(Vrt,": ").concat(a,`px; } `)},Jwe=function(){var t=parseInt(document.body.getAttribute(x4)||"0",10);return isFinite(t)?t:0},cnt=function(){P.useEffect(function(){return document.body.setAttribute(x4,(Jwe()+1).toString()),function(){var t=Jwe()-1;t<=0?document.body.removeAttribute(x4):document.body.setAttribute(x4,t.toString())}},[])},dnt=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,i=s===void 0?"margin":s;cnt();var o=P.useMemo(function(){return ant(i)},[i]);return P.createElement(ont,{styles:lnt(o,!e,i,n?"":"!important")})},Vue=!1;if(typeof window<"u")try{var oL=Object.defineProperty({},"passive",{get:function(){return Vue=!0,!0}});window.addEventListener("test",oL,oL),window.removeEventListener("test",oL,oL)}catch{Vue=!1}var HN=Vue?{passive:!1}:!1,unt=function(t){return t.tagName==="TEXTAREA"},$Ie=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!unt(t)&&n[e]==="visible")},hnt=function(t){return $Ie(t,"overflowY")},fnt=function(t){return $Ie(t,"overflowX")},eje=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=UIe(t,s);if(i){var o=qIe(t,s),c=o[1],a=o[2];if(c>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},pnt=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},mnt=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},UIe=function(t,e){return t==="v"?hnt(e):fnt(e)},qIe=function(t,e){return t==="v"?pnt(e):mnt(e)},gnt=function(t,e){return t==="h"&&e==="rtl"?-1:1},xnt=function(t,e,n,s,i){var o=gnt(t,window.getComputedStyle(e).direction),c=o*s,a=n.target,h=e.contains(a),m=!1,x=c>0,v=0,w=0;do{if(!a)break;var k=qIe(t,a),C=k[0],S=k[1],T=k[2],I=S-T-o*C;(C||I)&&UIe(t,a)&&(v+=I,w+=C);var A=a.parentNode;a=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!h&&a!==document.body||h&&(e.contains(a)||e===a));return(x&&Math.abs(v)<1||!x&&Math.abs(w)<1)&&(m=!0),m},lL=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},tje=function(t){return[t.deltaX,t.deltaY]},rje=function(t){return t&&"current"in t?t.current:t},ynt=function(t,e){return t[0]===e[0]&&t[1]===e[1]},vnt=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},_nt=0,WN=[];function bnt(t){var e=P.useRef([]),n=P.useRef([0,0]),s=P.useRef(),i=P.useState(_nt++)[0],o=P.useState(BIe)[0],c=P.useRef(t);P.useEffect(function(){c.current=t},[t]),P.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=ege([t.lockRef.current],(t.shards||[]).map(rje),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=P.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!c.current.allowPinchZoom;var I=lL(S),A=n.current,D="deltaX"in S?S.deltaX:A[0]-I[0],$="deltaY"in S?S.deltaY:A[1]-I[1],F,q=S.target,W=Math.abs(D)>Math.abs($)?"h":"v";if("touches"in S&&W==="h"&&q.type==="range")return!1;var K=eje(W,q);if(!K)return!0;if(K?F=W:(F=W==="v"?"h":"v",K=eje(W,q)),!K)return!1;if(!s.current&&"changedTouches"in S&&(D||$)&&(s.current=F),!F)return!0;var Z=s.current||F;return xnt(Z,T,S,Z==="h"?D:$)},[]),h=P.useCallback(function(S){var T=S;if(!(!WN.length||WN[WN.length-1]!==o)){var I="deltaY"in T?tje(T):lL(T),A=e.current.filter(function(F){return F.name===T.type&&(F.target===T.target||T.target===F.shadowParent)&&ynt(F.delta,I)})[0];if(A&&A.should){T.cancelable&&T.preventDefault();return}if(!A){var D=(c.current.shards||[]).map(rje).filter(Boolean).filter(function(F){return F.contains(T.target)}),$=D.length>0?a(T,D[0]):!c.current.noIsolation;$&&T.cancelable&&T.preventDefault()}}},[]),m=P.useCallback(function(S,T,I,A){var D={name:S,delta:T,target:I,should:A,shadowParent:wnt(I)};e.current.push(D),setTimeout(function(){e.current=e.current.filter(function($){return $!==D})},1)},[]),x=P.useCallback(function(S){n.current=lL(S),s.current=void 0},[]),v=P.useCallback(function(S){m(S.type,tje(S),S.target,a(S,t.lockRef.current))},[]),w=P.useCallback(function(S){m(S.type,lL(S),S.target,a(S,t.lockRef.current))},[]);P.useEffect(function(){return WN.push(o),t.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",h,HN),document.addEventListener("touchmove",h,HN),document.addEventListener("touchstart",x,HN),function(){WN=WN.filter(function(S){return S!==o}),document.removeEventListener("wheel",h,HN),document.removeEventListener("touchmove",h,HN),document.removeEventListener("touchstart",x,HN)}},[]);var k=t.removeScrollBar,C=t.inert;return P.createElement(P.Fragment,null,C?P.createElement(o,{styles:vnt(i)}):null,k?P.createElement(dnt,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function wnt(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const jnt=Xrt(zIe,bnt);var oI=P.forwardRef(function(t,e){return P.createElement(Lne,Ef({},t,{ref:e,sideCar:jnt}))});oI.classNames=Lne.classNames;var knt=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},GN=new WeakMap,cL=new WeakMap,dL={},Ile=0,VIe=function(t){return t&&(t.host||VIe(t.parentNode))},Nnt=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=VIe(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Snt=function(t,e,n,s){var i=Nnt(e,Array.isArray(t)?t:[t]);dL[n]||(dL[n]=new WeakMap);var o=dL[n],c=[],a=new Set,h=new Set(i),m=function(v){!v||a.has(v)||(a.add(v),m(v.parentNode))};i.forEach(m);var x=function(v){!v||h.has(v)||Array.prototype.forEach.call(v.children,function(w){if(a.has(w))x(w);else try{var k=w.getAttribute(s),C=k!==null&&k!=="false",S=(GN.get(w)||0)+1,T=(o.get(w)||0)+1;GN.set(w,S),o.set(w,T),c.push(w),S===1&&C&&cL.set(w,!0),T===1&&w.setAttribute(n,"true"),C||w.setAttribute(s,"true")}catch(I){console.error("aria-hidden: cannot operate on ",w,I)}})};return x(e),a.clear(),Ile++,function(){c.forEach(function(v){var w=GN.get(v)-1,k=o.get(v)-1;GN.set(v,w),o.set(v,k),w||(cL.has(v)||v.removeAttribute(s),cL.delete(v)),k||v.removeAttribute(n)}),Ile--,Ile||(GN=new WeakMap,GN=new WeakMap,cL=new WeakMap,dL={})}},One=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),i=knt(t);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live]"))),Snt(s,i,n,"aria-hidden")):function(){return null}},Dne="Dialog",[HIe,WIe]=Zl(Dne),[Cnt,gm]=HIe(Dne),GIe=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:c=!0}=t,a=P.useRef(null),h=P.useRef(null),[m,x]=Eu({prop:s,defaultProp:i??!1,onChange:o,caller:Dne});return r.jsx(Cnt,{scope:e,triggerRef:a,contentRef:h,contentId:zc(),titleId:zc(),descriptionId:zc(),open:m,onOpenChange:x,onOpenToggle:P.useCallback(()=>x(v=>!v),[x]),modal:c,children:n})};GIe.displayName=Dne;var KIe="DialogTrigger",ZIe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=gm(KIe,n),o=Xs(e,i.triggerRef);return r.jsx(Dn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":hge(i.open),...s,ref:o,onClick:an(t.onClick,i.onOpenToggle)})});ZIe.displayName=KIe;var dge="DialogPortal",[Mnt,YIe]=HIe(dge,{forceMount:void 0}),XIe=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:i}=t,o=gm(dge,e);return r.jsx(Mnt,{scope:e,forceMount:n,children:P.Children.map(s,c=>r.jsx(lc,{present:n||o.open,children:r.jsx(qC,{asChild:!0,container:i,children:c})}))})};XIe.displayName=dge;var Gee="DialogOverlay",QIe=P.forwardRef((t,e)=>{const n=YIe(Gee,t.__scopeDialog),{forceMount:s=n.forceMount,...i}=t,o=gm(Gee,t.__scopeDialog);return o.modal?r.jsx(lc,{present:s||o.open,children:r.jsx(Ant,{...i,ref:e})}):null});QIe.displayName=Gee;var Tnt=N1("DialogOverlay.RemoveScroll"),Ant=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=gm(Gee,n);return r.jsx(oI,{as:Tnt,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(Dn.div,{"data-state":hge(i.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),jj="DialogContent",JIe=P.forwardRef((t,e)=>{const n=YIe(jj,t.__scopeDialog),{forceMount:s=n.forceMount,...i}=t,o=gm(jj,t.__scopeDialog);return r.jsx(lc,{present:s||o.open,children:o.modal?r.jsx(Ent,{...i,ref:e}):r.jsx(Int,{...i,ref:e})})});JIe.displayName=jj;var Ent=P.forwardRef((t,e)=>{const n=gm(jj,t.__scopeDialog),s=P.useRef(null),i=Xs(e,n.contentRef,s);return P.useEffect(()=>{const o=s.current;if(o)return One(o)},[]),r.jsx(ePe,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:an(t.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:an(t.onPointerDownOutside,o=>{const c=o.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0;(c.button===2||a)&&o.preventDefault()}),onFocusOutside:an(t.onFocusOutside,o=>o.preventDefault())})}),Int=P.forwardRef((t,e)=>{const n=gm(jj,t.__scopeDialog),s=P.useRef(!1),i=P.useRef(!1);return r.jsx(ePe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,a;(c=t.onCloseAutoFocus)==null||c.call(t,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var h,m;(h=t.onInteractOutside)==null||h.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),ePe=P.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,...c}=t,a=gm(jj,n),h=P.useRef(null),m=Xs(e,h);return Pne(),r.jsxs(r.Fragment,{children:[r.jsx(aI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(D1,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":hge(a.open),...c,ref:m,onDismiss:()=>a.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Lnt,{titleId:a.titleId}),r.jsx(Dnt,{contentRef:h,descriptionId:a.descriptionId})]})]})}),uge="DialogTitle",tPe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=gm(uge,n);return r.jsx(Dn.h2,{id:i.titleId,...s,ref:e})});tPe.displayName=uge;var rPe="DialogDescription",nPe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=gm(rPe,n);return r.jsx(Dn.p,{id:i.descriptionId,...s,ref:e})});nPe.displayName=rPe;var sPe="DialogClose",iPe=P.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,i=gm(sPe,n);return r.jsx(Dn.button,{type:"button",...s,ref:e,onClick:an(t.onClick,()=>i.onOpenChange(!1))})});iPe.displayName=sPe;function hge(t){return t?"open":"closed"}var aPe="DialogTitleWarning",[Pnt,oPe]=QGe(aPe,{contentName:jj,titleName:uge,docsSlug:"dialog"}),Lnt=({titleId:t})=>{const e=oPe(aPe),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return P.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Ont="DialogDescriptionWarning",Dnt=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oPe(Ont).contentName}}.`;return P.useEffect(()=>{var o;const i=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},Rne=GIe,fge=ZIe,Fne=XIe,t5=QIe,r5=JIe,lI=tPe,cI=nPe,zne=iPe;const Ur=Rne,Oo=fge,Rnt=Fne,lPe=P.forwardRef(({className:t,...e},n)=>r.jsx(t5,{ref:n,className:$t("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));lPe.displayName=t5.displayName;const Br=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(Rnt,{children:[r.jsx(lPe,{}),r.jsxs(r5,{ref:s,className:$t("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,r.jsxs(zne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(Es,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Br.displayName=r5.displayName;const Yr=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Yr.displayName="DialogHeader";const ai=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ai.displayName="DialogFooter";const Zr=P.forwardRef(({className:t,...e},n)=>r.jsx(lI,{ref:n,className:$t("text-lg font-semibold leading-none tracking-tight",t),...e}));Zr.displayName=lI.displayName;const us=P.forwardRef(({className:t,...e},n)=>r.jsx(cI,{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));us.displayName=cI.displayName;const Fnt={points_earned:qa,listing_created:ui,deal_closed:ad,custom:Bs},nje={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 znt(){const{user:t}=zr(),e=Qr(),{data:n}=Prt(),s=Lrt(),[i,o]=P.useState(null),[c,a]=P.useState(!1),h=P.useCallback(()=>{const k=Date.now()+3e3,C={startVelocity:30,spread:360,ticks:60,zIndex:9999},S=(I,A)=>Math.random()*(A-I)+I,T=setInterval(()=>{const I=k-Date.now();if(I<=0){clearInterval(T);return}const A=50*(I/3e3);Wwe({...C,particleCount:A,origin:{x:S(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),Wwe({...C,particleCount:A,origin:{x:S(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);P.useEffect(()=>{n&&n.length>0&&!i&&(o(n[0]),a(!0),setTimeout(h,100))},[n,i,h]);const m=async()=>{if(i){const w=i.id;a(!1),o(null),e.setQueryData(["celebrations","pending",t==null?void 0:t.id],k=>(k==null?void 0:k.filter(C=>C.id!==w))??[]),await s.mutateAsync(w)}};if(!i)return null;const x=Fnt[i.celebration_type]||Bs,v=nje[i.celebration_type]||nje.custom;return r.jsx(Ur,{open:c,onOpenChange:w=>!w&&m(),children:r.jsxs(Br,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${v} opacity-10`}),r.jsxs("div",{className:"relative z-10 py-6",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:`w-20 h-20 rounded-full bg-gradient-to-br ${v} flex items-center justify-center animate-bounce`,children:r.jsx(x,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[r.jsx(As,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(As,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(As,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-150"})]}),r.jsxs("h2",{className:"text-2xl font-bold mb-2 bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent",children:["🎉 ",i.title]}),i.points_amount&&i.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",i.points_amount," points!"]}),i.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:i.message}),r.jsx(te,{onClick:m,className:"w-full",size:"lg",children:"Awesome! 🙌"}),n&&n.length>1&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",n.length-1," more celebration",n.length>2?"s":""," waiting"]})]})]})})}const qA="/assets/levelup-logo-color-D3mY9gCJ.png",pge="/assets/levelup-logo-white-C2RAgAoG.png",Bnt="/assets/listings-hero-BI9Ki9Dq.jpg",xt=P.forwardRef(({className:t,type:e,...n},s)=>r.jsx("input",{type:e,className:$t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...n}));xt.displayName="Input";const $nt=VC("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 Ft({className:t,variant:e,...n}){return r.jsx("div",{className:$t($nt({variant:e}),t),...n})}function Kr({className:t,...e}){return r.jsx("div",{className:$t("animate-pulse rounded-md bg-muted",t),...e})}function VA(t,[e,n]){return Math.min(n,Math.max(e,t))}var Unt=P.createContext(void 0);function Zj(t){const e=P.useContext(Unt);return t||e||"ltr"}function dI(t){const e=P.useRef({value:t,previous:t});return P.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var qnt=[" ","Enter","ArrowUp","ArrowDown"],Vnt=[" ","Enter"],kj="Select",[Bne,$ne,Hnt]=XE(kj),[n5]=Zl(kj,[Hnt,Cg]),Une=Cg(),[Wnt,B1]=n5(kj),[Gnt,Knt]=n5(kj),cPe=t=>{const{__scopeSelect:e,children:n,open:s,defaultOpen:i,onOpenChange:o,value:c,defaultValue:a,onValueChange:h,dir:m,name:x,autoComplete:v,disabled:w,required:k,form:C}=t,S=Une(e),[T,I]=P.useState(null),[A,D]=P.useState(null),[$,F]=P.useState(!1),q=Zj(m),[W,K]=Eu({prop:s,defaultProp:i??!1,onChange:o,caller:kj}),[Z,re]=Eu({prop:c,defaultProp:a,onChange:h,caller:kj}),he=P.useRef(null),ue=T?C||!!T.closest("form"):!0,[je,ne]=P.useState(new Set),ye=Array.from(je).map(ie=>ie.props.value).join(";");return r.jsx(tI,{...S,children:r.jsxs(Wnt,{required:k,scope:e,trigger:T,onTriggerChange:I,valueNode:A,onValueNodeChange:D,valueNodeHasChildren:$,onValueNodeHasChildrenChange:F,contentId:zc(),value:Z,onValueChange:re,open:W,onOpenChange:K,dir:q,triggerPointerDownPosRef:he,disabled:w,children:[r.jsx(Bne.Provider,{scope:e,children:r.jsx(Gnt,{scope:t.__scopeSelect,onNativeOptionAdd:P.useCallback(ie=>{ne(me=>new Set(me).add(ie))},[]),onNativeOptionRemove:P.useCallback(ie=>{ne(me=>{const fe=new Set(me);return fe.delete(ie),fe})},[]),children:n})}),ue?r.jsxs(PPe,{"aria-hidden":!0,required:k,tabIndex:-1,name:x,autoComplete:v,value:Z,onChange:ie=>re(ie.target.value),disabled:w,form:C,children:[Z===void 0?r.jsx("option",{value:""}):null,Array.from(je)]},ye):null]})})};cPe.displayName=kj;var dPe="SelectTrigger",uPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:s=!1,...i}=t,o=Une(n),c=B1(dPe,n),a=c.disabled||s,h=Xs(e,c.onTriggerChange),m=$ne(n),x=P.useRef("touch"),[v,w,k]=OPe(S=>{const T=m().filter(D=>!D.disabled),I=T.find(D=>D.value===c.value),A=DPe(T,S,I);A!==void 0&&c.onValueChange(A.value)}),C=S=>{a||(c.onOpenChange(!0),k()),S&&(c.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return r.jsx(KC,{asChild:!0,...o,children:r.jsx(Dn.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":LPe(c.value)?"":void 0,...i,ref:h,onClick:an(i.onClick,S=>{S.currentTarget.focus(),x.current!=="mouse"&&C(S)}),onPointerDown:an(i.onPointerDown,S=>{x.current=S.pointerType;const T=S.target;T.hasPointerCapture(S.pointerId)&&T.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(C(S),S.preventDefault())}),onKeyDown:an(i.onKeyDown,S=>{const T=v.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(T&&S.key===" ")&&qnt.includes(S.key)&&(C(),S.preventDefault())})})})});uPe.displayName=dPe;var hPe="SelectValue",fPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:i,children:o,placeholder:c="",...a}=t,h=B1(hPe,n),{onValueNodeHasChildrenChange:m}=h,x=o!==void 0,v=Xs(e,h.onValueNodeChange);return Gl(()=>{m(x)},[m,x]),r.jsx(Dn.span,{...a,ref:v,style:{pointerEvents:"none"},children:LPe(h.value)?r.jsx(r.Fragment,{children:c}):o})});fPe.displayName=hPe;var Znt="SelectIcon",pPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,children:s,...i}=t;return r.jsx(Dn.span,{"aria-hidden":!0,...i,ref:e,children:s||"▼"})});pPe.displayName=Znt;var Ynt="SelectPortal",mPe=t=>r.jsx(qC,{asChild:!0,...t});mPe.displayName=Ynt;var Nj="SelectContent",gPe=P.forwardRef((t,e)=>{const n=B1(Nj,t.__scopeSelect),[s,i]=P.useState();if(Gl(()=>{i(new DocumentFragment)},[]),!n.open){const o=s;return o?ny.createPortal(r.jsx(xPe,{scope:t.__scopeSelect,children:r.jsx(Bne.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),o):null}return r.jsx(yPe,{...t,ref:e})});gPe.displayName=Nj;var Fp=10,[xPe,$1]=n5(Nj),Xnt="SelectContentImpl",Qnt=N1("SelectContent.RemoveScroll"),yPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:c,side:a,sideOffset:h,align:m,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:k,sticky:C,hideWhenDetached:S,avoidCollisions:T,...I}=t,A=B1(Nj,n),[D,$]=P.useState(null),[F,q]=P.useState(null),W=Xs(e,Le=>$(Le)),[K,Z]=P.useState(null),[re,he]=P.useState(null),ue=$ne(n),[je,ne]=P.useState(!1),ye=P.useRef(!1);P.useEffect(()=>{if(D)return One(D)},[D]),Pne();const ie=P.useCallback(Le=>{const[Qe,...Fe]=ue().map(Ae=>Ae.ref.current),[Ce]=Fe.slice(-1),Je=document.activeElement;for(const Ae of Le)if(Ae===Je||(Ae==null||Ae.scrollIntoView({block:"nearest"}),Ae===Qe&&F&&(F.scrollTop=0),Ae===Ce&&F&&(F.scrollTop=F.scrollHeight),Ae==null||Ae.focus(),document.activeElement!==Je))return},[ue,F]),me=P.useCallback(()=>ie([K,D]),[ie,K,D]);P.useEffect(()=>{je&&me()},[je,me]);const{onOpenChange:fe,triggerPointerDownPosRef:ve}=A;P.useEffect(()=>{if(D){let Le={x:0,y:0};const Qe=Ce=>{var Je,Ae;Le={x:Math.abs(Math.round(Ce.pageX)-(((Je=ve.current)==null?void 0:Je.x)??0)),y:Math.abs(Math.round(Ce.pageY)-(((Ae=ve.current)==null?void 0:Ae.y)??0))}},Fe=Ce=>{Le.x<=10&&Le.y<=10?Ce.preventDefault():D.contains(Ce.target)||fe(!1),document.removeEventListener("pointermove",Qe),ve.current=null};return ve.current!==null&&(document.addEventListener("pointermove",Qe),document.addEventListener("pointerup",Fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Qe),document.removeEventListener("pointerup",Fe,{capture:!0})}}},[D,fe,ve]),P.useEffect(()=>{const Le=()=>fe(!1);return window.addEventListener("blur",Le),window.addEventListener("resize",Le),()=>{window.removeEventListener("blur",Le),window.removeEventListener("resize",Le)}},[fe]);const[Ie,Se]=OPe(Le=>{const Qe=ue().filter(Je=>!Je.disabled),Fe=Qe.find(Je=>Je.ref.current===document.activeElement),Ce=DPe(Qe,Le,Fe);Ce&&setTimeout(()=>Ce.ref.current.focus())}),oe=P.useCallback((Le,Qe,Fe)=>{const Ce=!ye.current&&!Fe;(A.value!==void 0&&A.value===Qe||Ce)&&(Z(Le),Ce&&(ye.current=!0))},[A.value]),ae=P.useCallback(()=>D==null?void 0:D.focus(),[D]),Ne=P.useCallback((Le,Qe,Fe)=>{const Ce=!ye.current&&!Fe;(A.value!==void 0&&A.value===Qe||Ce)&&he(Le)},[A.value]),Te=s==="popper"?Hue:vPe,Be=Te===Hue?{side:a,sideOffset:h,align:m,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:k,sticky:C,hideWhenDetached:S,avoidCollisions:T}:{};return r.jsx(xPe,{scope:n,content:D,viewport:F,onViewportChange:q,itemRefCallback:oe,selectedItem:K,onItemLeave:ae,itemTextRefCallback:Ne,focusSelectedItem:me,selectedItemText:re,position:s,isPositioned:je,searchRef:Ie,children:r.jsx(oI,{as:Qnt,allowPinchZoom:!0,children:r.jsx(aI,{asChild:!0,trapped:A.open,onMountAutoFocus:Le=>{Le.preventDefault()},onUnmountAutoFocus:an(i,Le=>{var Qe;(Qe=A.trigger)==null||Qe.focus({preventScroll:!0}),Le.preventDefault()}),children:r.jsx(D1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:Le=>Le.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:r.jsx(Te,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:Le=>Le.preventDefault(),...I,...Be,onPlaced:()=>ne(!0),ref:W,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:an(I.onKeyDown,Le=>{const Qe=Le.ctrlKey||Le.altKey||Le.metaKey;if(Le.key==="Tab"&&Le.preventDefault(),!Qe&&Le.key.length===1&&Se(Le.key),["ArrowUp","ArrowDown","Home","End"].includes(Le.key)){let Ce=ue().filter(Je=>!Je.disabled).map(Je=>Je.ref.current);if(["ArrowUp","End"].includes(Le.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(Le.key)){const Je=Le.target,Ae=Ce.indexOf(Je);Ce=Ce.slice(Ae+1)}setTimeout(()=>ie(Ce)),Le.preventDefault()}})})})})})})});yPe.displayName=Xnt;var Jnt="SelectItemAlignedPosition",vPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:s,...i}=t,o=B1(Nj,n),c=$1(Nj,n),[a,h]=P.useState(null),[m,x]=P.useState(null),v=Xs(e,W=>x(W)),w=$ne(n),k=P.useRef(!1),C=P.useRef(!0),{viewport:S,selectedItem:T,selectedItemText:I,focusSelectedItem:A}=c,D=P.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&m&&S&&T&&I){const W=o.trigger.getBoundingClientRect(),K=m.getBoundingClientRect(),Z=o.valueNode.getBoundingClientRect(),re=I.getBoundingClientRect();if(o.dir!=="rtl"){const Je=re.left-K.left,Ae=Z.left-Je,Ye=W.left-Ae,ge=W.width+Ye,ft=Math.max(ge,K.width),nt=window.innerWidth-Fp,Ve=VA(Ae,[Fp,Math.max(Fp,nt-ft)]);a.style.minWidth=ge+"px",a.style.left=Ve+"px"}else{const Je=K.right-re.right,Ae=window.innerWidth-Z.right-Je,Ye=window.innerWidth-W.right-Ae,ge=W.width+Ye,ft=Math.max(ge,K.width),nt=window.innerWidth-Fp,Ve=VA(Ae,[Fp,Math.max(Fp,nt-ft)]);a.style.minWidth=ge+"px",a.style.right=Ve+"px"}const he=w(),ue=window.innerHeight-Fp*2,je=S.scrollHeight,ne=window.getComputedStyle(m),ye=parseInt(ne.borderTopWidth,10),ie=parseInt(ne.paddingTop,10),me=parseInt(ne.borderBottomWidth,10),fe=parseInt(ne.paddingBottom,10),ve=ye+ie+je+fe+me,Ie=Math.min(T.offsetHeight*5,ve),Se=window.getComputedStyle(S),oe=parseInt(Se.paddingTop,10),ae=parseInt(Se.paddingBottom,10),Ne=W.top+W.height/2-Fp,Te=ue-Ne,Be=T.offsetHeight/2,Le=T.offsetTop+Be,Qe=ye+ie+Le,Fe=ve-Qe;if(Qe<=Ne){const Je=he.length>0&&T===he[he.length-1].ref.current;a.style.bottom="0px";const Ae=m.clientHeight-S.offsetTop-S.offsetHeight,Ye=Math.max(Te,Be+(Je?ae:0)+Ae+me),ge=Qe+Ye;a.style.height=ge+"px"}else{const Je=he.length>0&&T===he[0].ref.current;a.style.top="0px";const Ye=Math.max(Ne,ye+S.offsetTop+(Je?oe:0)+Be)+Fe;a.style.height=Ye+"px",S.scrollTop=Qe-Ne+S.offsetTop}a.style.margin=`${Fp}px 0`,a.style.minHeight=Ie+"px",a.style.maxHeight=ue+"px",s==null||s(),requestAnimationFrame(()=>k.current=!0)}},[w,o.trigger,o.valueNode,a,m,S,T,I,o.dir,s]);Gl(()=>D(),[D]);const[$,F]=P.useState();Gl(()=>{m&&F(window.getComputedStyle(m).zIndex)},[m]);const q=P.useCallback(W=>{W&&C.current===!0&&(D(),A==null||A(),C.current=!1)},[D,A]);return r.jsx(tst,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:k,onScrollButtonChange:q,children:r.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:$},children:r.jsx(Dn.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});vPe.displayName=Jnt;var est="SelectPopperPosition",Hue=P.forwardRef((t,e)=>{const{__scopeSelect:n,align:s="start",collisionPadding:i=Fp,...o}=t,c=Une(n);return r.jsx(rI,{...c,...o,ref:e,align:s,collisionPadding:i,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)"}})});Hue.displayName=est;var[tst,mge]=n5(Nj,{}),Wue="SelectViewport",_Pe=P.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:s,...i}=t,o=$1(Wue,n),c=mge(Wue,n),a=Xs(e,o.onViewportChange),h=P.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Bne.Slot,{scope:n,children:r.jsx(Dn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:an(i.onScroll,m=>{const x=m.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=c;if(w!=null&&w.current&&v){const k=Math.abs(h.current-x.scrollTop);if(k>0){const C=window.innerHeight-Fp*2,S=parseFloat(v.style.minHeight),T=parseFloat(v.style.height),I=Math.max(S,T);if(I0?$:0,v.style.justifyContent="flex-end")}}}h.current=x.scrollTop})})})]})});_Pe.displayName=Wue;var bPe="SelectGroup",[rst,nst]=n5(bPe),sst=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,i=zc();return r.jsx(rst,{scope:n,id:i,children:r.jsx(Dn.div,{role:"group","aria-labelledby":i,...s,ref:e})})});sst.displayName=bPe;var wPe="SelectLabel",jPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,i=nst(wPe,n);return r.jsx(Dn.div,{id:i.id,...s,ref:e})});jPe.displayName=wPe;var Kee="SelectItem",[ist,kPe]=n5(Kee),NPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,value:s,disabled:i=!1,textValue:o,...c}=t,a=B1(Kee,n),h=$1(Kee,n),m=a.value===s,[x,v]=P.useState(o??""),[w,k]=P.useState(!1),C=Xs(e,A=>{var D;return(D=h.itemRefCallback)==null?void 0:D.call(h,A,s,i)}),S=zc(),T=P.useRef("touch"),I=()=>{i||(a.onValueChange(s),a.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(ist,{scope:n,value:s,disabled:i,textId:S,isSelected:m,onItemTextChange:P.useCallback(A=>{v(D=>D||((A==null?void 0:A.textContent)??"").trim())},[]),children:r.jsx(Bne.ItemSlot,{scope:n,value:s,disabled:i,textValue:x,children:r.jsx(Dn.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":m&&w,"data-state":m?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:C,onFocus:an(c.onFocus,()=>k(!0)),onBlur:an(c.onBlur,()=>k(!1)),onClick:an(c.onClick,()=>{T.current!=="mouse"&&I()}),onPointerUp:an(c.onPointerUp,()=>{T.current==="mouse"&&I()}),onPointerDown:an(c.onPointerDown,A=>{T.current=A.pointerType}),onPointerMove:an(c.onPointerMove,A=>{var D;T.current=A.pointerType,i?(D=h.onItemLeave)==null||D.call(h):T.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:an(c.onPointerLeave,A=>{var D;A.currentTarget===document.activeElement&&((D=h.onItemLeave)==null||D.call(h))}),onKeyDown:an(c.onKeyDown,A=>{var $;(($=h.searchRef)==null?void 0:$.current)!==""&&A.key===" "||(Vnt.includes(A.key)&&I(),A.key===" "&&A.preventDefault())})})})})});NPe.displayName=Kee;var rT="SelectItemText",SPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:i,...o}=t,c=B1(rT,n),a=$1(rT,n),h=kPe(rT,n),m=Knt(rT,n),[x,v]=P.useState(null),w=Xs(e,I=>v(I),h.onItemTextChange,I=>{var A;return(A=a.itemTextRefCallback)==null?void 0:A.call(a,I,h.value,h.disabled)}),k=x==null?void 0:x.textContent,C=P.useMemo(()=>r.jsx("option",{value:h.value,disabled:h.disabled,children:k},h.value),[h.disabled,h.value,k]),{onNativeOptionAdd:S,onNativeOptionRemove:T}=m;return Gl(()=>(S(C),()=>T(C)),[S,T,C]),r.jsxs(r.Fragment,{children:[r.jsx(Dn.span,{id:h.textId,...o,ref:w}),h.isSelected&&c.valueNode&&!c.valueNodeHasChildren?ny.createPortal(o.children,c.valueNode):null]})});SPe.displayName=rT;var CPe="SelectItemIndicator",MPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return kPe(CPe,n).isSelected?r.jsx(Dn.span,{"aria-hidden":!0,...s,ref:e}):null});MPe.displayName=CPe;var Gue="SelectScrollUpButton",TPe=P.forwardRef((t,e)=>{const n=$1(Gue,t.__scopeSelect),s=mge(Gue,t.__scopeSelect),[i,o]=P.useState(!1),c=Xs(e,s.onScrollButtonChange);return Gl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const m=h.scrollTop>0;o(m)};const h=n.viewport;return a(),h.addEventListener("scroll",a),()=>h.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(EPe,{...t,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:h}=n;a&&h&&(a.scrollTop=a.scrollTop-h.offsetHeight)}}):null});TPe.displayName=Gue;var Kue="SelectScrollDownButton",APe=P.forwardRef((t,e)=>{const n=$1(Kue,t.__scopeSelect),s=mge(Kue,t.__scopeSelect),[i,o]=P.useState(!1),c=Xs(e,s.onScrollButtonChange);return Gl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const m=h.scrollHeight-h.clientHeight,x=Math.ceil(h.scrollTop)h.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(EPe,{...t,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:h}=n;a&&h&&(a.scrollTop=a.scrollTop+h.offsetHeight)}}):null});APe.displayName=Kue;var EPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:s,...i}=t,o=$1("SelectScrollButton",n),c=P.useRef(null),a=$ne(n),h=P.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return P.useEffect(()=>()=>h(),[h]),Gl(()=>{var x;const m=a().find(v=>v.ref.current===document.activeElement);(x=m==null?void 0:m.ref.current)==null||x.scrollIntoView({block:"nearest"})},[a]),r.jsx(Dn.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:an(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(s,50))}),onPointerMove:an(i.onPointerMove,()=>{var m;(m=o.onItemLeave)==null||m.call(o),c.current===null&&(c.current=window.setInterval(s,50))}),onPointerLeave:an(i.onPointerLeave,()=>{h()})})}),ast="SelectSeparator",IPe=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return r.jsx(Dn.div,{"aria-hidden":!0,...s,ref:e})});IPe.displayName=ast;var Zue="SelectArrow",ost=P.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,i=Une(n),o=B1(Zue,n),c=$1(Zue,n);return o.open&&c.position==="popper"?r.jsx(nI,{...i,...s,ref:e}):null});ost.displayName=Zue;var lst="SelectBubbleInput",PPe=P.forwardRef(({__scopeSelect:t,value:e,...n},s)=>{const i=P.useRef(null),o=Xs(s,i),c=dI(e);return P.useEffect(()=>{const a=i.current;if(!a)return;const h=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(c!==e&&x){const v=new Event("change",{bubbles:!0});x.call(a,e),a.dispatchEvent(v)}},[c,e]),r.jsx(Dn.select,{...n,style:{...UTe,...n.style},ref:o,defaultValue:e})});PPe.displayName=lst;function LPe(t){return t===""||t===void 0}function OPe(t){const e=ql(t),n=P.useRef(""),s=P.useRef(0),i=P.useCallback(c=>{const a=n.current+c;e(a),function h(m){n.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>h(""),1e3))}(a)},[e]),o=P.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return P.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,i,o]}function DPe(t,e,n){const i=e.length>1&&Array.from(e).every(m=>m===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let c=cst(t,Math.max(o,0));i.length===1&&(c=c.filter(m=>m!==n));const h=c.find(m=>m.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function cst(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var dst=cPe,RPe=uPe,ust=fPe,hst=pPe,fst=mPe,FPe=gPe,pst=_Pe,zPe=jPe,BPe=NPe,mst=SPe,gst=MPe,$Pe=TPe,UPe=APe,qPe=IPe;const _n=dst,bn=ust,yn=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(RPe,{ref:s,className:$t("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,r.jsx(hst,{asChild:!0,children:r.jsx(Tu,{className:"h-4 w-4 opacity-50"})})]}));yn.displayName=RPe.displayName;const VPe=P.forwardRef(({className:t,...e},n)=>r.jsx($Pe,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(K0,{className:"h-4 w-4"})}));VPe.displayName=$Pe.displayName;const HPe=P.forwardRef(({className:t,...e},n)=>r.jsx(UPe,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(Tu,{className:"h-4 w-4"})}));HPe.displayName=UPe.displayName;const vn=P.forwardRef(({className:t,children:e,position:n="popper",...s},i)=>r.jsx(fst,{children:r.jsxs(FPe,{ref:i,className:$t("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:[r.jsx(VPe,{}),r.jsx(pst,{className:$t("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),r.jsx(HPe,{})]})}));vn.displayName=FPe.displayName;const xst=P.forwardRef(({className:t,...e},n)=>r.jsx(zPe,{ref:n,className:$t("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));xst.displayName=zPe.displayName;const tr=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(BPe,{ref:s,className:$t("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(gst,{children:r.jsx($a,{className:"h-4 w-4"})})}),r.jsx(mst,{children:e})]}));tr.displayName=BPe.displayName;const yst=P.forwardRef(({className:t,...e},n)=>r.jsx(qPe,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",t),...e}));yst.displayName=qPe.displayName;const vst=t=>rr({queryKey:["public-listings",t],queryFn:async()=>{let e=ee.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0).order("created_at",{ascending:!1});t!=null&&t.status&&(e=e.eq("status",t.status)),t!=null&&t.propertyType&&(e=e.eq("property_type",t.propertyType)),t!=null&&t.city&&(e=e.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(e=e.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(e=e.lte("price",t.maxPrice));const{data:n,error:s}=await e;if(s)throw s;return n}}),WPe=t=>rr({queryKey:["public-listing",t],queryFn:async()=>{const e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);let n=ee.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, agent_notes, agent_notes_public, mls_link, video_link, video_id, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary, sort_order), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds, bunny_video_id) `).eq("is_approved",!0).eq("is_public",!0);e?n=n.eq("id",t):n=n.eq("slug",t);const{data:s,error:i}=await n.single();if(i)throw i;return s},enabled:!!t}),GPe=()=>dr({mutationFn:async({listingId:t,agentId:e,firstName:n,lastName:s,email:i,phone:o,shareToken:c})=>{let a=null,h=null;if(c){const{data:w}=await ee.from("listing_shares").select("id, sharing_agent_id").eq("share_token",c).eq("listing_id",t).maybeSingle();w&&(a=w.id,h=w.sharing_agent_id)}const{data:m,error:x}=await ee.from("listing_leads").insert({listing_id:t,agent_id:h||e,first_name:n,last_name:s,email:i,phone:o,share_id:a,referred_by_agent_id:h}).select().single();if(x)throw x;const{error:v}=await ee.functions.invoke("process-listing-lead",{body:{leadId:m.id}});return v&&console.error("Error processing lead:",v),m}}),_st=()=>dr({mutationFn:async t=>{const{error:e}=await ee.rpc("increment_listing_share_click",{p_share_token:t});if(e)throw e}}),bst={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},sje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},wst={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function KPe(){const[t,e]=P.useState(""),[n,s]=P.useState(!1),[i,o]=P.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:c,isLoading:a}=vst({city:t||void 0,status:i.status||void 0,propertyType:i.propertyType||void 0,minPrice:i.minPrice?Number(i.minPrice):void 0,maxPrice:i.maxPrice?Number(i.maxPrice):void 0}),h=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(v),m=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),e("")},x=t||i.status||i.propertyType||i.minPrice||i.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:"LevelUp Listings - Find Your Dream Home | Real Estate for Sale"}),r.jsx("meta",{name:"description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, condos, townhouses, and luxury properties. View photos, prices, and connect with agents."}),r.jsx("link",{rel:"canonical",href:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{property:"og:description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, view photos, and connect with agents."}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{name:"twitter:description",content:"Browse exclusive property listings from LevelUp real estate agents."}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"keywords",content:"homes for sale, real estate, property listings, houses, condos, townhouses, luxury homes, LevelUp"}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"LevelUp Listings",url:"https://listings.relevelup.com",description:"Browse exclusive property listings from LevelUp real estate agents",potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:"https://listings.relevelup.com?q={search_term_string}"},"query-input":"required name=search_term_string"}})}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateAgent",name:"LevelUp",url:"https://relevelup.com",logo:"https://listings.relevelup.com/assets/levelup-logo-color.png"})})]}),r.jsxs("div",{className:"min-h-screen bg-gray-50",children:[r.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(io,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:qA,alt:"LevelUp",className:"h-8"})}),r.jsx("nav",{className:"hidden md:flex items-center gap-6",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors",children:"About LevelUp"})})]})})}),r.jsxs("section",{className:"relative bg-cover bg-center py-20 md:py-32",style:{backgroundImage:`url(${Bnt})`},children:[r.jsx("div",{className:"absolute inset-0 bg-black/40"}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4",children:[r.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 text-center drop-shadow-lg",children:"Find Your Perfect Home"}),r.jsx("p",{className:"text-white/90 text-center mb-10 text-lg md:text-xl drop-shadow",children:"Exclusive listings from LevelUp agents"}),r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex gap-0 shadow-2xl rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"relative flex-1 bg-white",children:[r.jsx(Ei,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(xt,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:t,onChange:v=>e(v.target.value),className:"pl-12 h-14 md:h-16 text-base md:text-lg border-0 focus-visible:ring-0 rounded-none bg-white"})]}),r.jsx(te,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(Ei,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(te,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(FT,{className:"h-4 w-4"}),n?"Hide Filters":"More Filters"]})}),n&&r.jsxs("div",{className:"mt-4 p-6 bg-white rounded-lg shadow-xl",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Status"}),r.jsxs(_n,{value:i.status||"all",onValueChange:v=>o({...i,status:v==="all"?"":v}),children:[r.jsx(yn,{className:"bg-white",children:r.jsx(bn,{placeholder:"Any status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"Any status"}),Object.entries(sje).map(([v,w])=>r.jsx(tr,{value:v,children:w},v))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(_n,{value:i.propertyType||"all",onValueChange:v=>o({...i,propertyType:v==="all"?"":v}),children:[r.jsx(yn,{className:"bg-white",children:r.jsx(bn,{placeholder:"Any type"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"Any type"}),Object.entries(wst).map(([v,w])=>r.jsx(tr,{value:v,children:w},v))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(xt,{type:"number",placeholder:"No min",value:i.minPrice,onChange:v=>o({...i,minPrice:v.target.value}),className:"bg-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),r.jsx(xt,{type:"number",placeholder:"No max",value:i.maxPrice,onChange:v=>o({...i,maxPrice:v.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:m,className:"gap-1 text-gray-500",children:[r.jsx(Es,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((v,w)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Kr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Kr,{className:"h-7 w-28"}),r.jsx(Kr,{className:"h-4 w-full"}),r.jsx(Kr,{className:"h-4 w-3/4"})]})]},w))}):c&&c.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[c.length," ",c.length===1?"Home":"Homes"," Available"]})}),r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:c.map(v=>{var S,T,I;const w=((S=v.photos)==null?void 0:S.find(A=>A.is_primary))||((T=v.photos)==null?void 0:T[0]),C=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${v.slug||v.id}`:`/public/listing/${v.slug||v.id}`;return r.jsx(io,{to:C,children:r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[r.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[w?r.jsx("img",{src:w.photo_url,alt:v.property_address||v.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(ui,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Ft,{className:`absolute top-2 left-2 ${bst[v.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:sje[v.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:A=>A.preventDefault(),children:r.jsx(oa,{className:"h-5 w-5 text-gray-600"})})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:h(v.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[v.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:v.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),v.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:v.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),v.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:v.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),v.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:v.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[v.city,", ",v.state]}),v.agent&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[r.jsx("p",{className:"text-xs text-gray-500 truncate",children:v.agent.name}),((I=v.agent.brokerage)==null?void 0:I.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:v.agent.brokerage.name})]})]})]})},v.id)})})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:r.jsx(ui,{className:"h-10 w-10 text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No listings found"}),r.jsx("p",{className:"text-gray-500 mb-6",children:x?"Try adjusting your search or filters":"Check back soon for new listings"}),x&&r.jsx(te,{variant:"outline",onClick:m,children:"Clear filters"})]})})}),r.jsx("footer",{className:"bg-gray-900 text-white py-10 mt-auto",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("img",{src:pge,alt:"LevelUp",className:"h-6"})}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-white text-sm transition-colors",children:"relevelup.com"})]})})})]})]})}const Ze=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Ze.displayName="Card";const Wt=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("flex flex-col space-y-1.5 p-6",t),...e}));Wt.displayName="CardHeader";const Xt=P.forwardRef(({className:t,...e},n)=>r.jsx("h3",{ref:n,className:$t("text-2xl font-semibold leading-none tracking-tight",t),...e}));Xt.displayName="CardTitle";const In=P.forwardRef(({className:t,...e},n)=>r.jsx("p",{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));In.displayName="CardDescription";const et=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("p-6 pt-0",t),...e}));et.displayName="CardContent";const ZT=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("flex items-center p-6 pt-0",t),...e}));ZT.displayName="CardFooter";var jst="Label",ZPe=P.forwardRef((t,e)=>r.jsx(Dn.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ZPe.displayName=jst;var YPe=ZPe;const kst=VC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Xe=P.forwardRef(({className:t,...e},n)=>r.jsx(YPe,{ref:n,className:$t(kst(),t),...e}));Xe.displayName=YPe.displayName;function Nst(){const t=Tg(),e=window.location.hostname;if(!(e==="listings.relevelup.com"||e.startsWith("listings.")))return null;const s=t.pathname.slice(1);return!s||s===""?r.jsx(KPe,{}):s.startsWith("public/")?null:r.jsx(Sst,{slug:s})}function Sst({slug:t}){return r.jsx(Tst,{slug:t})}const Cst={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Mst={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},ije={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Tst({slug:t}){var Z,re;const{data:e,isLoading:n}=WPe(t),s=GPe(),[i,o]=P.useState(""),[c,a]=P.useState(""),[h,m]=P.useState(""),[x,v]=P.useState(""),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(null),A=he=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(he),D=async he=>{if(he.preventDefault(),!(!i.trim()||!h.trim()||!e)){k(!0);try{await s.mutateAsync({listingId:e.id,agentId:e.agent_id,firstName:i.trim(),lastName:c.trim(),email:h.trim(),phone:x.trim()}),S(!0),He.success("Thanks! The agent will be in touch soon.")}catch(ue){console.error("Lead submission error:",ue),He.error(`Failed to submit: ${ue.message||"Please try again"}`)}finally{k(!1)}}},$=(e==null?void 0:e.photos)||[],F=$.find(he=>he.is_primary)||$[0],q=()=>{T!==null&&I(T===0?$.length-1:T-1)},W=()=>{T!==null&&I(T===$.length-1?0:T+1)};if(n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Kr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Kr,{className:"h-10 w-48 mb-6"}),r.jsx(Kr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Kr,{className:"h-12 w-48"}),r.jsx(Kr,{className:"h-6 w-full"}),r.jsx(Kr,{className:"h-6 w-3/4"})]}),r.jsx(Kr,{className:"h-64"})]})]})]});if(!e)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:qA,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(ui,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(te,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const K=e.property_address?`${e.property_address} - ${e.city}, ${e.state}`:`${e.city}, ${e.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsxs("title",{children:[K," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${A(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA ${e.square_footage?e.square_footage.toLocaleString()+" sqft":""} ${ije[e.property_type]} in ${e.city}, ${e.state}. ${((Z=e.description)==null?void 0:Z.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:K}),r.jsx("meta",{property:"og:description",content:`${A(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA in ${e.city}, ${e.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),F&&r.jsx("meta",{property:"og:image",content:F.photo_url})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:qA,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs("a",{href:"/",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),$.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>I(0),children:r.jsx("img",{src:F==null?void 0:F.photo_url,alt:"Primary",className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:$.slice(1,5).map((he,ue)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>I(ue+1),children:[r.jsx("img",{src:he.photo_url,alt:`Photo ${ue+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ue===3&&$.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",$.length-5," more"]})]},he.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Ft,{className:`${Cst[e.status]} text-white border-0`,children:Mst[e.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:A(e.price)}),e.property_address&&r.jsx("p",{className:"text-xl font-medium",children:e.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(cl,{className:"h-4 w-4"}),e.city,", ",e.state,e.neighborhood&&` • ${e.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[e.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(zf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),e.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ff,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),e.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(cm,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),e.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ft,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),ije[e.property_type]]}),e.lot_size&&r.jsxs(Ft,{variant:"secondary",children:["Lot: ",e.lot_size]}),e.has_hoa&&r.jsx(Ft,{variant:"secondary",children:"HOA"})]}),e.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.description})]}),e.agent_notes&&e.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.agent_notes})]}),e.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:e.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[e.agent&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(jc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:e.agent.name}),((re=e.agent.brokerage)==null?void 0:re.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.agent.brokerage.name})]})]}),r.jsxs(Ze,{className:"border-primary",children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{children:C?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(oi,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:D,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"firstName",children:"First Name *"}),r.jsx(xt,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:he=>o(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"lastName",children:"Last Name"}),r.jsx(xt,{id:"lastName",type:"text",placeholder:"Doe",value:c,onChange:he=>a(he.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"email",children:"Email *"}),r.jsx(xt,{id:"email",type:"email",placeholder:"you@example.com",value:h,onChange:he=>m(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone"}),r.jsx(xt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:he=>v(he.target.value)})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:w,children:w?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Ur,{open:T!==null,onOpenChange:()=>I(null),children:r.jsxs(Br,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Yr,{className:"sr-only",children:r.jsx(Zr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>I(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Es,{className:"h-5 w-5"})}),T!==null&&$[T]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:$[T].photo_url,alt:`Photo ${T+1}`,className:"w-full max-h-[80vh] object-contain"}),$.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:q,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(id,{className:"h-6 w-6"})}),r.jsx("button",{onClick:W,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ka,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[T+1," / ",$.length]})]})]})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}const Yue="levelup_affiliate_ref",Ast=30,Est=()=>{const[t]=Pd();P.useEffect(()=>{const e=t.get("ref");if(e){const n={code:e.toUpperCase(),timestamp:Date.now()};localStorage.setItem(Yue,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",e)}},[t])},Ist=()=>{try{const t=localStorage.getItem(Yue);if(!t)return null;const e=JSON.parse(t),n=Ast*24*60*60*1e3;return Date.now()-e.timestamp>n?(localStorage.removeItem(Yue),console.log("[Affiliate] Referral code expired"),null):e.code}catch{return null}},Zee="/assets/levelup-logo-header-_ZX7DvlA.png",Pst="/assets/scale-your-team-ku4MPatU.png";function Lst({open:t,onOpenChange:e}){return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Yr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-[#4a6b6d]/10 rounded-lg",children:r.jsx(na,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(us,{children:"Learn how LevelUp can empower your entire team"})]})]})}),t&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/brokerinterestmeeting",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Brokerage Interest Meeting"})]})})}const Qc={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"]}},Ost=[{icon:Af,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Yd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:li,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Wl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Si,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ua,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Dst=[{icon:fs,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:As,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ma,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Uh,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:cl,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:oa,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:u1,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Rst=[{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."}],Fst=()=>{const{user:t,loading:e}=zr(),n=ts(),[s]=Pd();P.useEffect(()=>{const W=window.location.host==="listings.relevelup.com",K=window.location.pathname==="/";if(W&&K){n("/public/listings",{replace:!0});return}},[n]);const[i,o]=P.useState(null),[c,a]=P.useState(null),[h,m]=P.useState(!1),[x,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(""),[T,I]=P.useState(!1),[A,D]=P.useState(!1),$=(W,K=!1)=>{a({tier:W,skipTrial:K}),m(!0)};Est(),P.useEffect(()=>{const W=window.location.host==="listings.relevelup.com",K=location.pathname.startsWith("/public/");!e&&t&&!W&&!K&&n("/dashboard")},[t,e,n,location.pathname]),P.useEffect(()=>{s.get("canceled")==="true"&&He.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const F=async(W,K=!1)=>{if(!x){He.error("Please enter your email address");return}if(!w.trim()){He.error("Please enter your full name");return}I(!0),o(W+(K?"_direct":""));const Z=Ist();try{const{data:re,error:he}=await ee.functions.invoke("create-checkout",{body:{tier:W,email:x,name:w.trim(),couponCode:C.trim()||void 0,skipTrial:K,referralCode:Z}});if(he)throw he;if(re!=null&&re.url)window.open(re.url,"_blank","noopener,noreferrer"),He.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(re){console.error("Checkout error:",re),He.error(re.message||"Failed to start checkout. Please try again.")}finally{I(!1),o(null),m(!1),a(null)}},q=()=>{c&&F(c.tier,c.skipTrial)};return e?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Zee,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var W;return(W=document.getElementById("features"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(te,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("free-trial"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",children:["Start Your Free Trial",r.jsx(Ho,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(te,{size:"lg",variant:"outline",onClick:()=>{var W;return(W=document.getElementById("features"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#1e3a4c] rounded-full",children:"See What's Included"})]})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[r.jsxs(te,{size:"lg",variant:"outline",onClick:()=>{var W;return(W=document.getElementById("brokerage"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(na,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(jc,{className:"mr-2 h-5 w-5"}),"Individual Membership"]})]})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Ost.map((W,K)=>r.jsxs(Ze,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Wt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(W.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Xt,{className:"text-xl font-sans",children:W.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:W.description})})]},K))})]})}),r.jsxs("section",{id:"agent-os",className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(As,{className:"w-4 h-4"}),"Included with Membership"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:Dst.map((W,K)=>r.jsxs(Ze,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(W.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Xt,{className:"text-lg font-semibold text-white",children:W.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:W.description})})]},K))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"bg-white text-[#4a6b6d] hover:bg-white/90 shadow-xl transition-all hover:scale-105",children:["Get Agent OS with Your Membership",r.jsx(Ho,{className:"ml-2 w-5 h-5"})]})})]})]}),r.jsx("section",{id:"brokerage",className:"py-20 bg-[#4a6b6d]/5",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsx("div",{className:"max-w-6xl mx-auto",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[#4a6b6d]/10 text-[#4a6b6d] text-sm font-medium",children:[r.jsx(na,{className:"w-4 h-4"}),"For Brokerages"]}),r.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Give every agent on your team access to world-class training and resources. Track performance, streamline onboarding, and watch your brokerage thrive."}),r.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center flex-shrink-0",children:r.jsx($a,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:W})]},K))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Ka,{className:"ml-2 w-5 h-5"})]}),r.jsxs(te,{size:"lg",variant:"outline",onClick:()=>D(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(li,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:Pst,alt:"Scale Your Team from 5 to 500 Agents",className:"w-full rounded-3xl shadow-lg"})})]})})})}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Agents Love ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"LevelUp"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what top producers are saying about the platform."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Rst.map((W,K)=>r.jsx(Ze,{className:"bg-muted/30 border-0",children:r.jsxs(et,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(Z=>r.jsx(Bs,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},Z))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',W.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:W.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:W.role})]})]})},K))})]})}),r.jsxs("section",{id:"free-trial",className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center space-y-8",children:[r.jsxs("h2",{className:"text-3xl md:text-5xl font-bold text-white",children:["Start Your Free Trial ",r.jsx("span",{className:"italic",children:"Today"})]}),r.jsx("p",{className:"text-lg md:text-xl text-white/80 leading-relaxed",children:"Get instant access to 7 days of trainings, templates, and tools — designed to give you quick wins now and resources you'll keep forever."}),r.jsx("div",{className:"pt-4",children:r.jsxs(te,{size:"lg",className:"px-12 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",onClick:()=>$("individual_agent"),children:["Start Free Trial",r.jsx(Ho,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]})})]}),r.jsx("section",{id:"pricing",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Simple, Transparent ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Pricing"})]}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Choose the plan that fits your needs. All plans include everything you need to succeed."})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[r.jsxs(Ze,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(jc,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Xt,{className:"text-xl font-sans",children:Qc.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Qc.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Qc.individual_agent.period})]}),r.jsx(In,{className:"text-base mt-2",children:Qc.individual_agent.description}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-500/10 text-green-600 text-sm font-medium mt-4",children:[r.jsx(Gi,{className:"w-4 h-4"}),Qc.individual_agent.trial]})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Qc.individual_agent.features.map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx($a,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:W})]},K))})}),r.jsxs(ZT,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>$("individual_agent"),children:"Start Free Trial"}),r.jsx(te,{variant:"outline",className:"w-full rounded-full border-2 border-[#4a6b6d] text-[#4a6b6d] bg-white hover:bg-[#4a6b6d]/5 uppercase text-sm font-medium tracking-wide",onClick:()=>$("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(Ze,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[r.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 px-6 py-2 bg-[#4a6b6d] text-white text-sm font-semibold rounded-full shadow-lg",children:"Most Popular"}),r.jsxs(Wt,{className:"pb-4 pt-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(na,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-xl font-sans",children:Qc.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Qc.brokerage_under_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Qc.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Qc.brokerage_under_25.period})]}),r.jsx(In,{className:"text-base mt-2",children:Qc.brokerage_under_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Qc.brokerage_under_25.features.map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx($a,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:W})]},K))})}),r.jsx(ZT,{className:"pt-4",children:r.jsx(te,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>$("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(Ze,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(na,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-xl font-sans",children:Qc.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Qc.brokerage_over_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Qc.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Qc.brokerage_over_25.period})]}),r.jsx(In,{className:"text-base mt-2",children:Qc.brokerage_over_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Qc.brokerage_over_25.features.map((W,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx($a,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:W})]},K))})}),r.jsx(ZT,{className:"pt-4",children:r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>$("brokerage_over_25"),children:"Get Started"})})]})]})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),r.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"Join thousands of agents who are closing more deals, saving time, and growing their business with LevelUp."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(te,{size:"lg",onClick:()=>{var W;return(W=document.getElementById("pricing"))==null?void 0:W.scrollIntoView({behavior:"smooth"})},className:"px-10 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105",children:["Start Your Free Trial",r.jsx(Ho,{className:"ml-2 w-5 h-5"})]}),r.jsx(te,{size:"lg",onClick:()=>n("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:Zee,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),r.jsx(Lst,{open:A,onOpenChange:D}),r.jsx(Ur,{open:h,onOpenChange:m,children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(us,{children:(c==null?void 0:c.tier)==="individual_agent"&&!(c!=null&&c.skipTrial)?"Start your 7-day free trial":(c==null?void 0:c.tier)==="individual_agent"?"Subscribe to Individual Agent":(c==null?void 0:c.tier)==="brokerage_under_25"?"Subscribe to Brokerage (Under 25 Agents)":"Subscribe to Brokerage (Over 25 Agents)"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs(Xe,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(xt,{id:"dialog-name",type:"text",placeholder:"John Smith",value:w,onChange:W=>k(W.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Xe,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(xt,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:W=>v(W.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Xe,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(xt,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:C,onChange:W=>S(W.target.value),className:"mt-1"})]})]}),r.jsx(te,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:q,disabled:T,children:T?"Loading...":"Continue to Checkout"})]})})]})},zst=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:"Privacy Policy | LevelUp"}),r.jsx("meta",{name:"description",content:"Privacy Policy for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Privacy Policy"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Introduction"}),r.jsx("p",{children:'Welcome to LevelUp ("we," "our," or "us"). We are committed to protecting your personal information and your right to privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our platform.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Information We Collect"}),r.jsx("p",{children:"We collect information that you provide directly to us, including:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Name and contact information (email address, phone number)"}),r.jsx("li",{children:"Account credentials"}),r.jsx("li",{children:"Profile information"}),r.jsx("li",{children:"Transaction and billing information"}),r.jsx("li",{children:"Communications you send to us"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. How We Use Your Information"}),r.jsx("p",{children:"We use the information we collect to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide, maintain, and improve our services"}),r.jsx("li",{children:"Process transactions and send related information"}),r.jsx("li",{children:"Send you technical notices and support messages"}),r.jsx("li",{children:"Respond to your comments and questions"}),r.jsx("li",{children:"Communicate with you about products, services, and events"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Information Sharing"}),r.jsx("p",{children:"We do not sell, trade, or otherwise transfer your personal information to third parties without your consent, except as described in this policy or as required by law."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Data Security"}),r.jsx("p",{children:"We implement appropriate technical and organizational measures to protect the security of your personal information. However, no method of transmission over the Internet is 100% secure."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Your Rights"}),r.jsx("p",{children:"You have the right to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Access your personal information"}),r.jsx("li",{children:"Correct inaccurate data"}),r.jsx("li",{children:"Request deletion of your data"}),r.jsx("li",{children:"Opt-out of marketing communications"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Third-Party Services"}),r.jsx("p",{children:"Our platform may integrate with third-party services such as Facebook and Instagram for social media posting features. When you connect these accounts, you are subject to their respective privacy policies."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Contact Us"}),r.jsxs("p",{children:["If you have questions about this Privacy Policy, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),Bst=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:"Terms of Service | LevelUp"}),r.jsx("meta",{name:"description",content:"Terms of Service for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Terms of Service"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Acceptance of Terms"}),r.jsx("p",{children:'By accessing or using the LevelUp platform ("Service"), you agree to be bound by these Terms of Service. If you do not agree to these terms, please do not use our Service.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Description of Service"}),r.jsx("p",{children:"LevelUp provides a platform for real estate professionals to access training, resources, marketing tools, and community features. We reserve the right to modify or discontinue the Service at any time."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. User Accounts"}),r.jsx("p",{children:"To use certain features, you must create an account. You agree to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide accurate and complete information"}),r.jsx("li",{children:"Maintain the security of your account credentials"}),r.jsx("li",{children:"Notify us immediately of any unauthorized access"}),r.jsx("li",{children:"Accept responsibility for all activities under your account"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Acceptable Use"}),r.jsx("p",{children:"You agree not to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Violate any applicable laws or regulations"}),r.jsx("li",{children:"Infringe on the rights of others"}),r.jsx("li",{children:"Upload malicious code or interfere with the Service"}),r.jsx("li",{children:"Attempt to gain unauthorized access to any part of the Service"}),r.jsx("li",{children:"Use the Service for any unlawful purpose"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Intellectual Property"}),r.jsx("p",{children:"The Service and its original content, features, and functionality are owned by LevelUp and are protected by international copyright, trademark, and other intellectual property laws."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Third-Party Integrations"}),r.jsx("p",{children:"Our Service may integrate with third-party platforms such as Facebook and Instagram. Your use of these integrations is subject to the terms and policies of those third parties. We are not responsible for the content or practices of any third-party services."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Payment Terms"}),r.jsx("p",{children:"Certain features may require payment. By subscribing to paid features, you agree to pay all applicable fees. All payments are non-refundable unless otherwise specified."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Limitation of Liability"}),r.jsx("p",{children:"To the maximum extent permitted by law, LevelUp shall not be liable for any indirect, incidental, special, consequential, or punitive damages resulting from your use of the Service."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"9. Termination"}),r.jsx("p",{children:"We may terminate or suspend your account at any time, without prior notice, for conduct that we believe violates these Terms or is harmful to other users, us, or third parties."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"10. Changes to Terms"}),r.jsx("p",{children:"We reserve the right to modify these Terms at any time. We will notify you of significant changes by posting a notice on our platform. Continued use of the Service constitutes acceptance of the modified terms."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"11. Contact Us"}),r.jsxs("p",{children:["If you have questions about these Terms, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),$st=()=>r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:"Data Deletion | LevelUp"}),r.jsx("meta",{name:"description",content:"Data deletion instructions for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Data Deletion Instructions"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"How to Request Data Deletion"}),r.jsx("p",{children:"If you wish to have your data deleted from LevelUp, you can request deletion through one of the following methods:"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 1: Email Request"}),r.jsxs("p",{children:["Send an email to"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})," ",'with the subject line "Data Deletion Request" and include:']}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your full name"}),r.jsx("li",{children:"The email address associated with your account"}),r.jsx("li",{children:"A clear statement requesting deletion of your data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 2: Account Settings"}),r.jsx("p",{children:"If you have an active account, you can request data deletion through your account settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Log in to your LevelUp account"}),r.jsx("li",{children:"Navigate to your Profile settings"}),r.jsx("li",{children:"Contact support through the Support page to request account deletion"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"What Data Will Be Deleted"}),r.jsx("p",{children:"Upon a valid deletion request, we will delete:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your account information (name, email, profile data)"}),r.jsx("li",{children:"Any content you have created or uploaded"}),r.jsx("li",{children:"Your activity history and preferences"}),r.jsx("li",{children:"Connected social media account tokens and data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Data Retention"}),r.jsx("p",{children:"Some data may be retained for legal or legitimate business purposes, such as:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Transaction records required for financial reporting"}),r.jsx("li",{children:"Data necessary to comply with legal obligations"}),r.jsx("li",{children:"Anonymized or aggregated data that cannot identify you"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Facebook/Instagram Data"}),r.jsx("p",{children:"If you have connected your Facebook or Instagram account to LevelUp, you can also manage your data through Facebook's settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Go to your Facebook Settings & Privacy → Settings"}),r.jsx("li",{children:'Click on "Apps and Websites"'}),r.jsx("li",{children:'Find LevelUp and click "Remove"'}),r.jsx("li",{children:"This will revoke our access to your Facebook/Instagram data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Processing Time"}),r.jsx("p",{children:"We will process your data deletion request within 30 days of receiving it. You will receive a confirmation email once your data has been deleted."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Contact Us"}),r.jsxs("p",{children:["If you have questions about data deletion, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]});var Qa;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const c of i)o[c]=c;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),c={};for(const a of o)c[a]=i[a];return t.objectValues(c)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&o.push(c);return o},t.find=(i,o)=>{for(const c of i)if(o(c))return c},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,o=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Qa||(Qa={}));var aje;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(aje||(aje={}));const Ns=Qa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a0=t=>{switch(typeof t){case"undefined":return Ns.undefined;case"string":return Ns.string;case"number":return Number.isNaN(t)?Ns.nan:Ns.number;case"boolean":return Ns.boolean;case"function":return Ns.function;case"bigint":return Ns.bigint;case"symbol":return Ns.symbol;case"object":return Array.isArray(t)?Ns.array:t===null?Ns.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ns.promise:typeof Map<"u"&&t instanceof Map?Ns.map:typeof Set<"u"&&t instanceof Set?Ns.set:typeof Date<"u"&&t instanceof Date?Ns.date:Ns.object;default:return Ns.unknown}},Ln=Qa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class bg extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(o){return o.message},s={_errors:[]},i=o=>{for(const c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)s._errors.push(n(c));else{let a=s,h=0;for(;hn.message){const n={},s=[];for(const i of this.issues)if(i.path.length>0){const o=i.path[0];n[o]=n[o]||[],n[o].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}bg.create=t=>new bg(t);const Xue=(t,e)=>{let n;switch(t.code){case Ln.invalid_type:t.received===Ns.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ln.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Qa.jsonStringifyReplacer)}`;break;case Ln.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qa.joinValues(t.keys,", ")}`;break;case Ln.invalid_union:n="Invalid input";break;case Ln.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qa.joinValues(t.options)}`;break;case Ln.invalid_enum_value:n=`Invalid enum value. Expected ${Qa.joinValues(t.options)}, received '${t.received}'`;break;case Ln.invalid_arguments:n="Invalid function arguments";break;case Ln.invalid_return_type:n="Invalid function return type";break;case Ln.invalid_date:n="Invalid date";break;case Ln.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Qa.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ln.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ln.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ln.custom:n="Invalid input";break;case Ln.invalid_intersection_types:n="Intersection results could not be merged";break;case Ln.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ln.not_finite:n="Number must be finite";break;default:n=e.defaultError,Qa.assertNever(t)}return{message:n}};let Ust=Xue;function qst(){return Ust}const Vst=t=>{const{data:e,path:n,errorMaps:s,issueData:i}=t,o=[...n,...i.path||[]],c={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="";const h=s.filter(m=>!!m).slice().reverse();for(const m of h)a=m(c,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};function ds(t,e){const n=qst(),s=Vst({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Xue?void 0:Xue].filter(i=>!!i)});t.common.issues.push(s)}class Yh{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const s=[];for(const i of n){if(i.status==="aborted")return Vi;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,n){const s=[];for(const i of n){const o=await i.key,c=await i.value;s.push({key:o,value:c})}return Yh.mergeObjectSync(e,s)}static mergeObjectSync(e,n){const s={};for(const i of n){const{key:o,value:c}=i;if(o.status==="aborted"||c.status==="aborted")return Vi;o.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(s[o.value]=c.value)}return{status:e.value,value:s}}}const Vi=Object.freeze({status:"aborted"}),nT=t=>({status:"dirty",value:t}),Qf=t=>({status:"valid",value:t}),oje=t=>t.status==="aborted",lje=t=>t.status==="dirty",eC=t=>t.status==="valid",Yee=t=>typeof Promise<"u"&&t instanceof Promise;var Ls;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ls||(Ls={}));class M1{constructor(e,n,s,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=i}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 cje=(t,e)=>{if(eC(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new bg(t.common.issues);return this._error=n,this._error}}};function ga(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:i}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,a)=>{const{message:h}=t;return c.code==="invalid_enum_value"?{message:h??a.defaultError}:typeof a.data>"u"?{message:h??s??a.defaultError}:c.code!=="invalid_type"?{message:a.defaultError}:{message:h??n??a.defaultError}},description:i}}class Za{get description(){return this._def.description}_getType(e){return a0(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:a0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yh,ctx:{common:e.parent.common,data:e.data,parsedType:a0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Yee(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a0(e)},i=this._parseSync({data:e,path:s.path,parent:s});return cje(s,i)}"~validate"(e){var s,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a0(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return eC(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(i=(s=o==null?void 0:o.message)==null?void 0:s.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(o=>eC(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(e,n){const s=await this.safeParseAsync(e,n);if(s.success)return s.data;throw s.error}async safeParseAsync(e,n){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a0(e)},i=this._parse({data:e,path:s.path,parent:s}),o=await(Yee(i)?i:Promise.resolve(i));return cje(s,o)}refine(e,n){const s=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const c=e(i),a=()=>o.addIssue({code:Ln.custom,...s(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(a(),!1)):c?!0:(a(),!1)})}refinement(e,n){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof n=="function"?n(s,i):n),!1))}_refinement(e){return new nC({schema:this,typeName:Hi.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return p1.create(this,this._def)}nullable(){return sC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xg.create(this)}promise(){return ete.create(this,this._def)}or(e){return Qee.create([this,e],this._def)}and(e){return Jee.create(this,e,this._def)}transform(e){return new nC({...ga(this._def),schema:this,typeName:Hi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new the({...ga(this._def),innerType:this,defaultValue:n,typeName:Hi.ZodDefault})}brand(){return new fit({typeName:Hi.ZodBranded,type:this,...ga(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new rhe({...ga(this._def),innerType:this,catchValue:n,typeName:Hi.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return gge.create(this,e)}readonly(){return nhe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hst=/^c[^\s-]{8,}$/i,Wst=/^[0-9a-z]+$/,Gst=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kst=/^[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,Zst=/^[a-z0-9_-]{21}$/i,Yst=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xst=/^[-+]?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)?)??$/,Qst=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jst="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ple;const eit=/^(?:(?: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])$/,tit=/^(?:(?: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])$/,rit=/^(([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]))$/,nit=/^(([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])$/,sit=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,iit=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,XPe="((\\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])))",ait=new RegExp(`^${XPe}$`);function QPe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function oit(t){return new RegExp(`^${QPe(t)}$`)}function lit(t){let e=`${XPe}T${QPe(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function cit(t,e){return!!((e==="v4"||!e)&&eit.test(t)||(e==="v6"||!e)&&rit.test(t))}function dit(t,e){if(!Yst.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function uit(t,e){return!!((e==="v4"||!e)&&tit.test(t)||(e==="v6"||!e)&&nit.test(t))}class L0 extends Za{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ns.string){const o=this._getOrReturnCtx(e);return ds(o,{code:Ln.invalid_type,expected:Ns.string,received:o.parsedType}),Vi}const s=new Yh;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),ds(i,{code:Ln.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){const c=e.data.length>o.value,a=e.data.lengthe.test(i),{validation:n,code:Ln.invalid_string,...Ls.errToObj(s)})}_addCheck(e){return new L0({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ls.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ls.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ls.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ls.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ls.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ls.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ls.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ls.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ls.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ls.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ls.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ls.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ls.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ls.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ls.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ls.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ls.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ls.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ls.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ls.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ls.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ls.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ls.errToObj(n)})}nonempty(e){return this.min(1,Ls.errToObj(e))}trim(){return new L0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new L0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new L0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew L0({checks:[],typeName:Hi.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...ga(t)});function hit(t,e){const n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=n>s?n:s,o=Number.parseInt(t.toFixed(i).replace(".","")),c=Number.parseInt(e.toFixed(i).replace(".",""));return o%c/10**i}class tC extends Za{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ns.number){const o=this._getOrReturnCtx(e);return ds(o,{code:Ln.invalid_type,expected:Ns.number,received:o.parsedType}),Vi}let s;const i=new Yh;for(const o of this._def.checks)o.kind==="int"?Qa.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),ds(s,{code:Ln.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),ds(s,{code:Ln.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?hit(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),ds(s,{code:Ln.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),ds(s,{code:Ln.not_finite,message:o.message}),i.dirty()):Qa.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ls.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ls.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ls.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ls.toString(n))}setLimit(e,n,s,i){return new tC({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Ls.toString(i)}]})}_addCheck(e){return new tC({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ls.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ls.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ls.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ls.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ls.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ls.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ls.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ls.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ls.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&Qa.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.valuenew tC({checks:[],typeName:Hi.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...ga(t)});class HA extends Za{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ns.bigint)return this._getInvalidInput(e);let s;const i=new Yh;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),ds(s,{code:Ln.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),ds(s,{code:Ln.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Qa.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ds(n,{code:Ln.invalid_type,expected:Ns.bigint,received:n.parsedType}),Vi}gte(e,n){return this.setLimit("min",e,!0,Ls.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ls.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ls.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ls.toString(n))}setLimit(e,n,s,i){return new HA({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Ls.toString(i)}]})}_addCheck(e){return new HA({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ls.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ls.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ls.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ls.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ls.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew HA({checks:[],typeName:Hi.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...ga(t)});class Que extends Za{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ns.boolean){const s=this._getOrReturnCtx(e);return ds(s,{code:Ln.invalid_type,expected:Ns.boolean,received:s.parsedType}),Vi}return Qf(e.data)}}Que.create=t=>new Que({typeName:Hi.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...ga(t)});class Xee extends Za{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ns.date){const o=this._getOrReturnCtx(e);return ds(o,{code:Ln.invalid_type,expected:Ns.date,received:o.parsedType}),Vi}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return ds(o,{code:Ln.invalid_date}),Vi}const s=new Yh;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),ds(i,{code:Ln.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):Qa.assertNever(o);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Xee({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ls.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ls.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew Xee({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Hi.ZodDate,...ga(t)});class dje extends Za{_parse(e){if(this._getType(e)!==Ns.symbol){const s=this._getOrReturnCtx(e);return ds(s,{code:Ln.invalid_type,expected:Ns.symbol,received:s.parsedType}),Vi}return Qf(e.data)}}dje.create=t=>new dje({typeName:Hi.ZodSymbol,...ga(t)});class uje extends Za{_parse(e){if(this._getType(e)!==Ns.undefined){const s=this._getOrReturnCtx(e);return ds(s,{code:Ln.invalid_type,expected:Ns.undefined,received:s.parsedType}),Vi}return Qf(e.data)}}uje.create=t=>new uje({typeName:Hi.ZodUndefined,...ga(t)});class hje extends Za{_parse(e){if(this._getType(e)!==Ns.null){const s=this._getOrReturnCtx(e);return ds(s,{code:Ln.invalid_type,expected:Ns.null,received:s.parsedType}),Vi}return Qf(e.data)}}hje.create=t=>new hje({typeName:Hi.ZodNull,...ga(t)});class fje extends Za{constructor(){super(...arguments),this._any=!0}_parse(e){return Qf(e.data)}}fje.create=t=>new fje({typeName:Hi.ZodAny,...ga(t)});class pje extends Za{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qf(e.data)}}pje.create=t=>new pje({typeName:Hi.ZodUnknown,...ga(t)});class T1 extends Za{_parse(e){const n=this._getOrReturnCtx(e);return ds(n,{code:Ln.invalid_type,expected:Ns.never,received:n.parsedType}),Vi}}T1.create=t=>new T1({typeName:Hi.ZodNever,...ga(t)});class mje extends Za{_parse(e){if(this._getType(e)!==Ns.undefined){const s=this._getOrReturnCtx(e);return ds(s,{code:Ln.invalid_type,expected:Ns.void,received:s.parsedType}),Vi}return Qf(e.data)}}mje.create=t=>new mje({typeName:Hi.ZodVoid,...ga(t)});class xg extends Za{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),i=this._def;if(n.parsedType!==Ns.array)return ds(n,{code:Ln.invalid_type,expected:Ns.array,received:n.parsedType}),Vi;if(i.exactLength!==null){const c=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(ds(n,{code:Ln.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((c,a)=>i.type._parseAsync(new M1(n,c,n.path,a)))).then(c=>Yh.mergeArray(s,c));const o=[...n.data].map((c,a)=>i.type._parseSync(new M1(n,c,n.path,a)));return Yh.mergeArray(s,o)}get element(){return this._def.type}min(e,n){return new xg({...this._def,minLength:{value:e,message:Ls.toString(n)}})}max(e,n){return new xg({...this._def,maxLength:{value:e,message:Ls.toString(n)}})}length(e,n){return new xg({...this._def,exactLength:{value:e,message:Ls.toString(n)}})}nonempty(e){return this.min(1,e)}}xg.create=(t,e)=>new xg({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Hi.ZodArray,...ga(e)});function cS(t){if(t instanceof xc){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=p1.create(cS(s))}return new xc({...t._def,shape:()=>e})}else return t instanceof xg?new xg({...t._def,type:cS(t.element)}):t instanceof p1?p1.create(cS(t.unwrap())):t instanceof sC?sC.create(cS(t.unwrap())):t instanceof Sj?Sj.create(t.items.map(e=>cS(e))):t}class xc extends Za{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Qa.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ns.object){const m=this._getOrReturnCtx(e);return ds(m,{code:Ln.invalid_type,expected:Ns.object,received:m.parsedType}),Vi}const{status:s,ctx:i}=this._processInputParams(e),{shape:o,keys:c}=this._getCached(),a=[];if(!(this._def.catchall instanceof T1&&this._def.unknownKeys==="strip"))for(const m in i.data)c.includes(m)||a.push(m);const h=[];for(const m of c){const x=o[m],v=i.data[m];h.push({key:{status:"valid",value:m},value:x._parse(new M1(i,v,i.path,m)),alwaysSet:m in i.data})}if(this._def.catchall instanceof T1){const m=this._def.unknownKeys;if(m==="passthrough")for(const x of a)h.push({key:{status:"valid",value:x},value:{status:"valid",value:i.data[x]}});else if(m==="strict")a.length>0&&(ds(i,{code:Ln.unrecognized_keys,keys:a}),s.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const x of a){const v=i.data[x];h.push({key:{status:"valid",value:x},value:m._parse(new M1(i,v,i.path,x)),alwaysSet:x in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const m=[];for(const x of h){const v=await x.key,w=await x.value;m.push({key:v,value:w,alwaysSet:x.alwaysSet})}return m}).then(m=>Yh.mergeObjectSync(s,m)):Yh.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return Ls.errToObj,new xc({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,s)=>{var o,c;const i=((c=(o=this._def).errorMap)==null?void 0:c.call(o,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:Ls.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new xc({...this._def,unknownKeys:"strip"})}passthrough(){return new xc({...this._def,unknownKeys:"passthrough"})}extend(e){return new xc({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new xc({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Hi.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new xc({...this._def,catchall:e})}pick(e){const n={};for(const s of Qa.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new xc({...this._def,shape:()=>n})}omit(e){const n={};for(const s of Qa.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new xc({...this._def,shape:()=>n})}deepPartial(){return cS(this)}partial(e){const n={};for(const s of Qa.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?n[s]=i:n[s]=i.optional()}return new xc({...this._def,shape:()=>n})}required(e){const n={};for(const s of Qa.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof p1;)o=o._def.innerType;n[s]=o}return new xc({...this._def,shape:()=>n})}keyof(){return JPe(Qa.objectKeys(this.shape))}}xc.create=(t,e)=>new xc({shape:()=>t,unknownKeys:"strip",catchall:T1.create(),typeName:Hi.ZodObject,...ga(e)});xc.strictCreate=(t,e)=>new xc({shape:()=>t,unknownKeys:"strict",catchall:T1.create(),typeName:Hi.ZodObject,...ga(e)});xc.lazycreate=(t,e)=>new xc({shape:t,unknownKeys:"strip",catchall:T1.create(),typeName:Hi.ZodObject,...ga(e)});class Qee extends Za{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const c=o.map(a=>new bg(a.ctx.common.issues));return ds(n,{code:Ln.invalid_union,unionErrors:c}),Vi}if(n.common.async)return Promise.all(s.map(async o=>{const c={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:c}),ctx:c}})).then(i);{let o;const c=[];for(const h of s){const m={...n,common:{...n.common,issues:[]},parent:null},x=h._parseSync({data:n.data,path:n.path,parent:m});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:m}),m.common.issues.length&&c.push(m.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=c.map(h=>new bg(h));return ds(n,{code:Ln.invalid_union,unionErrors:a}),Vi}}get options(){return this._def.options}}Qee.create=(t,e)=>new Qee({options:t,typeName:Hi.ZodUnion,...ga(e)});function Jue(t,e){const n=a0(t),s=a0(e);if(t===e)return{valid:!0,data:t};if(n===Ns.object&&s===Ns.object){const i=Qa.objectKeys(e),o=Qa.objectKeys(t).filter(a=>i.indexOf(a)!==-1),c={...t,...e};for(const a of o){const h=Jue(t[a],e[a]);if(!h.valid)return{valid:!1};c[a]=h.data}return{valid:!0,data:c}}else if(n===Ns.array&&s===Ns.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(oje(o)||oje(c))return Vi;const a=Jue(o.value,c.value);return a.valid?((lje(o)||lje(c))&&n.dirty(),{status:n.value,value:a.data}):(ds(s,{code:Ln.invalid_intersection_types}),Vi)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,c])=>i(o,c)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Jee.create=(t,e,n)=>new Jee({left:t,right:e,typeName:Hi.ZodIntersection,...ga(n)});class Sj extends Za{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ns.array)return ds(s,{code:Ln.invalid_type,expected:Ns.array,received:s.parsedType}),Vi;if(s.data.lengththis._def.items.length&&(ds(s,{code:Ln.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((c,a)=>{const h=this._def.items[a]||this._def.rest;return h?h._parse(new M1(s,c,s.path,a)):null}).filter(c=>!!c);return s.common.async?Promise.all(o).then(c=>Yh.mergeArray(n,c)):Yh.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Sj({...this._def,rest:e})}}Sj.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Sj({items:t,typeName:Hi.ZodTuple,rest:null,...ga(e)})};class gje extends Za{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ns.map)return ds(s,{code:Ln.invalid_type,expected:Ns.map,received:s.parsedType}),Vi;const i=this._def.keyType,o=this._def.valueType,c=[...s.data.entries()].map(([a,h],m)=>({key:i._parse(new M1(s,a,s.path,[m,"key"])),value:o._parse(new M1(s,h,s.path,[m,"value"]))}));if(s.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const h of c){const m=await h.key,x=await h.value;if(m.status==="aborted"||x.status==="aborted")return Vi;(m.status==="dirty"||x.status==="dirty")&&n.dirty(),a.set(m.value,x.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const h of c){const m=h.key,x=h.value;if(m.status==="aborted"||x.status==="aborted")return Vi;(m.status==="dirty"||x.status==="dirty")&&n.dirty(),a.set(m.value,x.value)}return{status:n.value,value:a}}}}gje.create=(t,e,n)=>new gje({valueType:e,keyType:t,typeName:Hi.ZodMap,...ga(n)});class WA extends Za{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Ns.set)return ds(s,{code:Ln.invalid_type,expected:Ns.set,received:s.parsedType}),Vi;const i=this._def;i.minSize!==null&&s.data.sizei.maxSize.value&&(ds(s,{code:Ln.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function c(h){const m=new Set;for(const x of h){if(x.status==="aborted")return Vi;x.status==="dirty"&&n.dirty(),m.add(x.value)}return{status:n.value,value:m}}const a=[...s.data.values()].map((h,m)=>o._parse(new M1(s,h,s.path,m)));return s.common.async?Promise.all(a).then(h=>c(h)):c(a)}min(e,n){return new WA({...this._def,minSize:{value:e,message:Ls.toString(n)}})}max(e,n){return new WA({...this._def,maxSize:{value:e,message:Ls.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}WA.create=(t,e)=>new WA({valueType:t,minSize:null,maxSize:null,typeName:Hi.ZodSet,...ga(e)});class xje extends Za{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}xje.create=(t,e)=>new xje({getter:t,typeName:Hi.ZodLazy,...ga(e)});class ehe extends Za{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ds(n,{received:n.data,code:Ln.invalid_literal,expected:this._def.value}),Vi}return{status:"valid",value:e.data}}get value(){return this._def.value}}ehe.create=(t,e)=>new ehe({value:t,typeName:Hi.ZodLiteral,...ga(e)});function JPe(t,e){return new rC({values:t,typeName:Hi.ZodEnum,...ga(e)})}class rC extends Za{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return ds(n,{expected:Qa.joinValues(s),received:n.parsedType,code:Ln.invalid_type}),Vi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),s=this._def.values;return ds(n,{received:n.data,code:Ln.invalid_enum_value,options:s}),Vi}return Qf(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return rC.create(e,{...this._def,...n})}exclude(e,n=this._def){return rC.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}}rC.create=JPe;class yje extends Za{_parse(e){const n=Qa.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Ns.string&&s.parsedType!==Ns.number){const i=Qa.objectValues(n);return ds(s,{expected:Qa.joinValues(i),received:s.parsedType,code:Ln.invalid_type}),Vi}if(this._cache||(this._cache=new Set(Qa.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Qa.objectValues(n);return ds(s,{received:s.data,code:Ln.invalid_enum_value,options:i}),Vi}return Qf(e.data)}get enum(){return this._def.values}}yje.create=(t,e)=>new yje({values:t,typeName:Hi.ZodNativeEnum,...ga(e)});class ete extends Za{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ns.promise&&n.common.async===!1)return ds(n,{code:Ln.invalid_type,expected:Ns.promise,received:n.parsedType}),Vi;const s=n.parsedType===Ns.promise?n.data:Promise.resolve(n.data);return Qf(s.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ete.create=(t,e)=>new ete({type:t,typeName:Hi.ZodPromise,...ga(e)});class nC extends Za{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Hi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:c=>{ds(s,c),c.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const c=i.transform(s.data,o);if(s.common.async)return Promise.resolve(c).then(async a=>{if(n.value==="aborted")return Vi;const h=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return h.status==="aborted"?Vi:h.status==="dirty"||n.value==="dirty"?nT(h.value):h});{if(n.value==="aborted")return Vi;const a=this._def.schema._parseSync({data:c,path:s.path,parent:s});return a.status==="aborted"?Vi:a.status==="dirty"||n.value==="dirty"?nT(a.value):a}}if(i.type==="refinement"){const c=a=>{const h=i.refinement(a,o);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Vi:(a.status==="dirty"&&n.dirty(),c(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?Vi:(a.status==="dirty"&&n.dirty(),c(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(s.common.async===!1){const c=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!eC(c))return Vi;const a=i.transform(c.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(c=>eC(c)?Promise.resolve(i.transform(c.value,o)).then(a=>({status:n.value,value:a})):Vi);Qa.assertNever(i)}}nC.create=(t,e,n)=>new nC({schema:t,typeName:Hi.ZodEffects,effect:e,...ga(n)});nC.createWithPreprocess=(t,e,n)=>new nC({schema:e,effect:{type:"preprocess",transform:t},typeName:Hi.ZodEffects,...ga(n)});class p1 extends Za{_parse(e){return this._getType(e)===Ns.undefined?Qf(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}p1.create=(t,e)=>new p1({innerType:t,typeName:Hi.ZodOptional,...ga(e)});class sC extends Za{_parse(e){return this._getType(e)===Ns.null?Qf(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}sC.create=(t,e)=>new sC({innerType:t,typeName:Hi.ZodNullable,...ga(e)});class the extends Za{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===Ns.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}the.create=(t,e)=>new the({innerType:t,typeName:Hi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ga(e)});class rhe extends Za{_parse(e){const{ctx:n}=this._processInputParams(e),s={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Yee(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new bg(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}rhe.create=(t,e)=>new rhe({innerType:t,typeName:Hi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ga(e)});class vje extends Za{_parse(e){if(this._getType(e)!==Ns.nan){const s=this._getOrReturnCtx(e);return ds(s,{code:Ln.invalid_type,expected:Ns.nan,received:s.parsedType}),Vi}return{status:"valid",value:e.data}}}vje.create=t=>new vje({typeName:Hi.ZodNaN,...ga(t)});class fit extends Za{_parse(e){const{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class gge extends Za{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Vi:o.status==="dirty"?(n.dirty(),nT(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Vi:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,n){return new gge({in:e,out:n,typeName:Hi.ZodPipeline})}}class nhe extends Za{_parse(e){const n=this._def.innerType._parse(e),s=i=>(eC(i)&&(i.value=Object.freeze(i.value)),i);return Yee(n)?n.then(i=>s(i)):s(n)}unwrap(){return this._def.innerType}}nhe.create=(t,e)=>new nhe({innerType:t,typeName:Hi.ZodReadonly,...ga(e)});var Hi;(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"})(Hi||(Hi={}));const ec=L0.create,YT=tC.create,pit=Que.create;T1.create;xg.create;const s5=xc.create;Qee.create;Jee.create;Sj.create;const _je=ehe.create,e6e=rC.create;ete.create;p1.create;sC.create;const mit="/assets/levelup-logo-horizontal-DEFNc0ms.png",git=s5({email:ec().email("Invalid email address"),password:ec().min(6,"Password must be at least 6 characters")}),xit=()=>{const{signIn:t,user:e}=zr(),n=ts(),[s,i]=P.useState(!1),[o,c]=P.useState({}),[a,h]=P.useState(""),[m,x]=P.useState(!1),[v,w]=P.useState(!1);P.useEffect(()=>{e&&n("/dashboard")},[e,n]);const k=async S=>{S.preventDefault(),c({}),i(!0);const T=new FormData(S.currentTarget),I=T.get("email"),A=T.get("password");try{git.parse({email:I,password:A}),await t(I,A)}catch(D){if(D instanceof bg){const $={};D.errors.forEach(F=>{F.path[0]&&($[F.path[0]]=F.message)}),c($)}}finally{i(!1)}},C=async()=>{if(!a){He.error("Please enter your email address");return}x(!0);try{const{error:S}=await ee.functions.invoke("send-password-reset",{body:{email:a,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(S)throw S;He.success("Password reset email sent! Check your inbox."),w(!1),h("")}catch(S){He.error(S.message||"Failed to send reset email")}finally{x(!1)}};return r.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#4a6b6d] via-[#3d5a5c] to-[#2a4347]",children:r.jsxs("div",{className:"absolute inset-0 opacity-30",children:[r.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"2s"}})]})}),r.jsxs("div",{className:"relative z-10 flex flex-col min-h-screen",children:[r.jsx("header",{className:"p-6",children:r.jsxs(io,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Home"]})}),r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("div",{className:"bg-white rounded-xl p-4 shadow-2xl",children:r.jsx("img",{src:mit,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ze,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Wt,{className:"space-y-1 text-center pb-4",children:[r.jsx(Xt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(In,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:k,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(xt,{id:"signin-email",name:"email",type:"email",placeholder:"your@email.com",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.email&&r.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(xt,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&r.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),r.jsx(te,{type:"submit",className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white font-semibold py-6 text-lg transition-all duration-200 shadow-lg hover:shadow-xl",disabled:s,children:s?"Signing in...":"Sign In"}),r.jsxs(Ur,{open:v,onOpenChange:w,children:[r.jsx(Oo,{asChild:!0,children:r.jsx(te,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Br,{className:"bg-white",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(us,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(xt,{id:"reset-email",type:"email",placeholder:"your@email.com",value:a,onChange:S=>h(S.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(te,{onClick:C,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:m,children:m?"Sending...":"Send Reset Link"})]})]})]})]})})]}),r.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",r.jsx(io,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},yit=()=>{const[t]=Pd(),e=t.get("tier"),n=e==null?void 0:e.includes("brokerage");return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ze,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:r.jsx(Ba,{className:"w-10 h-10 text-green-500"})}),r.jsx(Xt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(In,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(oi,{className:"w-5 h-5"}),r.jsx("span",{className:"font-semibold",children:"Check your email to sign in"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"We've sent you an email with a secure link to access your account. Click the link in your email to get started."})]}),n?r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Create and name your brokerage"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"4."}),"Start inviting agents to join your team"]})]})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Start exploring templates, training videos, and more!"]})]}),r.jsx("p",{className:"text-sm text-green-600 font-medium mt-4",children:"🎉 Your 7-day free trial has started!"})]}),r.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Didn't receive the email? Check your spam folder or contact support."})})]})]})})},xge=t=>{const[e,n]=P.useState(null),[s,i]=P.useState(!0);return P.useEffect(()=>{if(!t){i(!1);return}(async()=>{try{const{data:a}=await ee.storage.from("avatars").list(`${t}`);if(a&&a.length>0){const{data:h}=ee.storage.from("avatars").getPublicUrl(`${t}/${a[0].name}`);n(`${h.publicUrl}?t=${Date.now()}`)}else n(null)}catch(a){console.error("Error fetching avatar:",a),n(null)}finally{i(!1)}})()},[t]),{avatarUrl:e,loading:s,refreshAvatar:async()=>{if(t)try{const{data:c}=await ee.storage.from("avatars").list(`${t}`);if(c&&c.length>0){const{data:a}=ee.storage.from("avatars").getPublicUrl(`${t}/${c[0].name}`);n(`${a.publicUrl}?t=${Date.now()}`)}}catch(c){console.error("Error refreshing avatar:",c)}}}},t6e=async t=>{const e=new Map;return await Promise.all(t.map(async n=>{try{const{data:s}=await ee.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:i}=ee.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);e.set(n,i.publicUrl)}}catch{}})),e},vit=t=>{const[e,n]=P.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return P.useEffect(()=>{if(!t){n(i=>({...i,loading:!1}));return}(async()=>{try{const{data:i,error:o}=await ee.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",t).single();if(o){console.error("Error fetching trial status:",o),n(h=>({...h,loading:!1}));return}const c=(i==null?void 0:i.subscription_status)==="trialing"&&(i==null?void 0:i.subscription_end_date),a=(i==null?void 0:i.is_trial)&&(i==null?void 0:i.trial_expires_at);if(c){const h=new Date().getTime(),m=new Date(i.subscription_end_date).getTime(),x=Math.ceil((m-h)/(1e3*60*60*24)),v=x<=0;n({isTrial:!0,isExpired:v,expiresAt:i.subscription_end_date,daysLeft:v?0:x,loading:!1})}else if(a){const h=new Date().getTime(),m=new Date(i.trial_expires_at).getTime(),x=Math.ceil((m-h)/(1e3*60*60*24)),v=x<=0;n({isTrial:!0,isExpired:v,expiresAt:i.trial_expires_at,daysLeft:v?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(i){console.error("Error in useTrialStatus:",i),n(o=>({...o,loading:!1}))}})()},[t]),e},r6e=()=>{const{data:t,isLoading:e}=rr({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:i}=await ee.from("feature_flags").select("*");if(i)throw i;return s}}),n=s=>{if(!t)return!1;const i=t.find(o=>o.key===s);return(i==null?void 0:i.enabled)??!1};return{flags:t,isLoading:e,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},bje="community_last_seen_post_at";function _it(){const{user:t}=zr(),e=Tg(),[n,s]=P.useState(0),[i,o]=P.useState(null);P.useEffect(()=>{if(!t)return;const a=localStorage.getItem(`${bje}_${t.id}`);o(a)},[t]),P.useEffect(()=>{if(!t)return;(async()=>{let h=ee.from("community_posts").select("id",{count:"exact",head:!0});i&&(h=h.gt("created_at",i));const{data:m}=await ee.from("profiles").select("brokerage_id").eq("id",t.id).single(),{count:x,error:v}=await h;!v&&x!==null&&s(x)})()},[t,i]),P.useEffect(()=>{if(!t)return;const a=ee.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async h=>{const m=h.new;if(m.user_id===t.id)return;const x=e.pathname==="/community";x||s(C=>C+1);const{data:v}=await ee.from("profiles").select("name").eq("id",m.user_id).single(),w=(v==null?void 0:v.name)||"Someone",k=m.content.length>50?m.content.substring(0,50)+"...":m.content;x||He("New Community Post",{description:`${w}: ${k}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{ee.removeChannel(a)}},[t,e.pathname]);const c=P.useCallback(()=>{if(!t)return;const a=new Date().toISOString();localStorage.setItem(`${bje}_${t.id}`,a),o(a),s(0)},[t]);return P.useEffect(()=>{e.pathname==="/community"&&n>0&&c()},[e.pathname,n,c]),{unreadCount:n,markAsRead:c}}function bit(){const{isAdmin:t}=zr(),{data:e=0}=rr({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await ee.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(s)throw s;return n||0},enabled:t,staleTime:6e4});return{openCount:t?e:0}}var n6e={exports:{}},s6e={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var iC=P;function wit(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var jit=typeof Object.is=="function"?Object.is:wit,kit=iC.useState,Nit=iC.useEffect,Sit=iC.useLayoutEffect,Cit=iC.useDebugValue;function Mit(t,e){var n=e(),s=kit({inst:{value:n,getSnapshot:e}}),i=s[0].inst,o=s[1];return Sit(function(){i.value=n,i.getSnapshot=e,Lle(i)&&o({inst:i})},[t,n,e]),Nit(function(){return Lle(i)&&o({inst:i}),t(function(){Lle(i)&&o({inst:i})})},[t]),Cit(n),n}function Lle(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!jit(t,n)}catch{return!0}}function Tit(t,e){return e()}var Ait=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Tit:Mit;s6e.useSyncExternalStore=iC.useSyncExternalStore!==void 0?iC.useSyncExternalStore:Ait;n6e.exports=s6e;var Eit=n6e.exports;function Iit(){return Eit.useSyncExternalStore(Pit,()=>!0,()=>!1)}function Pit(){return()=>{}}var yge="Avatar",[Lit]=Zl(yge),[Oit,i6e]=Lit(yge),a6e=P.forwardRef((t,e)=>{const{__scopeAvatar:n,...s}=t,[i,o]=P.useState("idle");return r.jsx(Oit,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:r.jsx(Dn.span,{...s,ref:e})})});a6e.displayName=yge;var o6e="AvatarImage",l6e=P.forwardRef((t,e)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:i=()=>{},...o}=t,c=i6e(o6e,n),a=Dit(s,o),h=ql(m=>{i(m),c.onImageLoadingStatusChange(m)});return Gl(()=>{a!=="idle"&&h(a)},[a,h]),a==="loaded"?r.jsx(Dn.img,{...o,ref:e,src:s}):null});l6e.displayName=o6e;var c6e="AvatarFallback",d6e=P.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:s,...i}=t,o=i6e(c6e,n),[c,a]=P.useState(s===void 0);return P.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>a(!0),s);return()=>window.clearTimeout(h)}},[s]),c&&o.imageLoadingStatus!=="loaded"?r.jsx(Dn.span,{...i,ref:e}):null});d6e.displayName=c6e;function wje(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Dit(t,{referrerPolicy:e,crossOrigin:n}){const s=Iit(),i=P.useRef(null),o=s?(i.current||(i.current=new window.Image),i.current):null,[c,a]=P.useState(()=>wje(o,t));return Gl(()=>{a(wje(o,t))},[o,t]),Gl(()=>{const h=v=>()=>{a(v)};if(!o)return;const m=h("loaded"),x=h("error");return o.addEventListener("load",m),o.addEventListener("error",x),e&&(o.referrerPolicy=e),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",m),o.removeEventListener("error",x)}},[o,n,e]),c}var u6e=a6e,h6e=l6e,f6e=d6e;const Di=P.forwardRef(({className:t,...e},n)=>r.jsx(u6e,{ref:n,className:$t("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Di.displayName=u6e.displayName;const Po=P.forwardRef(({className:t,...e},n)=>r.jsx(h6e,{ref:n,className:$t("aspect-square h-full w-full",t),...e}));Po.displayName=h6e.displayName;const Ri=P.forwardRef(({className:t,...e},n)=>r.jsx(f6e,{ref:n,className:$t("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Ri.displayName=f6e.displayName;const qne=Rne,vge=fge,Rit=Fne,p6e=P.forwardRef(({className:t,...e},n)=>r.jsx(t5,{className:$t("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));p6e.displayName=t5.displayName;const Fit=VC("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"}}),uI=P.forwardRef(({side:t="right",className:e,children:n,...s},i)=>r.jsxs(Rit,{children:[r.jsx(p6e,{}),r.jsxs(r5,{ref:i,className:$t(Fit({side:t}),e),...s,children:[n,r.jsxs(zne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(Es,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uI.displayName=r5.displayName;const Vne=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",t),...e});Vne.displayName="SheetHeader";const Hne=P.forwardRef(({className:t,...e},n)=>r.jsx(lI,{ref:n,className:$t("text-lg font-semibold text-foreground",t),...e}));Hne.displayName=lI.displayName;const zit=P.forwardRef(({className:t,...e},n)=>r.jsx(cI,{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));zit.displayName=cI.displayName;function Bit(t,e){return P.useReducer((n,s)=>e[n][s]??n,t)}var _ge="ScrollArea",[m6e]=Zl(_ge),[$it,Jf]=m6e(_ge),g6e=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:i,scrollHideDelay:o=600,...c}=t,[a,h]=P.useState(null),[m,x]=P.useState(null),[v,w]=P.useState(null),[k,C]=P.useState(null),[S,T]=P.useState(null),[I,A]=P.useState(0),[D,$]=P.useState(0),[F,q]=P.useState(!1),[W,K]=P.useState(!1),Z=Xs(e,he=>h(he)),re=Zj(i);return r.jsx($it,{scope:n,type:s,dir:re,scrollHideDelay:o,scrollArea:a,viewport:m,onViewportChange:x,content:v,onContentChange:w,scrollbarX:k,onScrollbarXChange:C,scrollbarXEnabled:F,onScrollbarXEnabledChange:q,scrollbarY:S,onScrollbarYChange:T,scrollbarYEnabled:W,onScrollbarYEnabledChange:K,onCornerWidthChange:A,onCornerHeightChange:$,children:r.jsx(Dn.div,{dir:re,...c,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":D+"px",...t.style}})})});g6e.displayName=_ge;var x6e="ScrollAreaViewport",y6e=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:i,...o}=t,c=Jf(x6e,n),a=P.useRef(null),h=Xs(e,a,c.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),r.jsx(Dn.div,{"data-radix-scroll-area-viewport":"",...o,ref:h,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:r.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});y6e.displayName=x6e;var Eg="ScrollAreaScrollbar",bge=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Jf(Eg,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:c}=i,a=t.orientation==="horizontal";return P.useEffect(()=>(a?o(!0):c(!0),()=>{a?o(!1):c(!1)}),[a,o,c]),i.type==="hover"?r.jsx(Uit,{...s,ref:e,forceMount:n}):i.type==="scroll"?r.jsx(qit,{...s,ref:e,forceMount:n}):i.type==="auto"?r.jsx(v6e,{...s,ref:e,forceMount:n}):i.type==="always"?r.jsx(wge,{...s,ref:e}):null});bge.displayName=Eg;var Uit=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Jf(Eg,t.__scopeScrollArea),[o,c]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let h=0;if(a){const m=()=>{window.clearTimeout(h),c(!0)},x=()=>{h=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",m),a.addEventListener("pointerleave",x),()=>{window.clearTimeout(h),a.removeEventListener("pointerenter",m),a.removeEventListener("pointerleave",x)}}},[i.scrollArea,i.scrollHideDelay]),r.jsx(lc,{present:n||o,children:r.jsx(v6e,{"data-state":o?"visible":"hidden",...s,ref:e})})}),qit=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Jf(Eg,t.__scopeScrollArea),o=t.orientation==="horizontal",c=Gne(()=>h("SCROLL_END"),100),[a,h]=Bit("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 P.useEffect(()=>{if(a==="idle"){const m=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(m)}},[a,i.scrollHideDelay,h]),P.useEffect(()=>{const m=i.viewport,x=o?"scrollLeft":"scrollTop";if(m){let v=m[x];const w=()=>{const k=m[x];v!==k&&(h("SCROLL"),c()),v=k};return m.addEventListener("scroll",w),()=>m.removeEventListener("scroll",w)}},[i.viewport,o,h,c]),r.jsx(lc,{present:n||a!=="hidden",children:r.jsx(wge,{"data-state":a==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:an(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:an(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),v6e=P.forwardRef((t,e)=>{const n=Jf(Eg,t.__scopeScrollArea),{forceMount:s,...i}=t,[o,c]=P.useState(!1),a=t.orientation==="horizontal",h=Gne(()=>{if(n.viewport){const m=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=t,i=Jf(Eg,t.__scopeScrollArea),o=P.useRef(null),c=P.useRef(0),[a,h]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=k6e(a.viewport,a.content),x={...s,sizes:a,onSizesChange:h,hasThumb:m>0&&m<1,onThumbChange:w=>o.current=w,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:w=>c.current=w};function v(w,k){return Zit(w,c.current,a,k)}return n==="horizontal"?r.jsx(Vit,{...x,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const w=i.viewport.scrollLeft,k=jje(w,a,i.dir);o.current.style.transform=`translate3d(${k}px, 0, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollLeft=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollLeft=v(w,i.dir))}}):n==="vertical"?r.jsx(Hit,{...x,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const w=i.viewport.scrollTop,k=jje(w,a);o.current.style.transform=`translate3d(0, ${k}px, 0)`}},onWheelScroll:w=>{i.viewport&&(i.viewport.scrollTop=w)},onDragScroll:w=>{i.viewport&&(i.viewport.scrollTop=v(w))}}):null}),Vit=P.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...i}=t,o=Jf(Eg,t.__scopeScrollArea),[c,a]=P.useState(),h=P.useRef(null),m=Xs(e,h,o.onScrollbarXChange);return P.useEffect(()=>{h.current&&a(getComputedStyle(h.current))},[h]),r.jsx(b6e,{"data-orientation":"horizontal",...i,ref:m,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Wne(n)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.x),onDragScroll:x=>t.onDragScroll(x.x),onWheelScroll:(x,v)=>{if(o.viewport){const w=o.viewport.scrollLeft+x.deltaX;t.onWheelScroll(w),S6e(w,v)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&c&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:rte(c.paddingLeft),paddingEnd:rte(c.paddingRight)}})}})}),Hit=P.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...i}=t,o=Jf(Eg,t.__scopeScrollArea),[c,a]=P.useState(),h=P.useRef(null),m=Xs(e,h,o.onScrollbarYChange);return P.useEffect(()=>{h.current&&a(getComputedStyle(h.current))},[h]),r.jsx(b6e,{"data-orientation":"vertical",...i,ref:m,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Wne(n)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.y),onDragScroll:x=>t.onDragScroll(x.y),onWheelScroll:(x,v)=>{if(o.viewport){const w=o.viewport.scrollTop+x.deltaY;t.onWheelScroll(w),S6e(w,v)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&c&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:rte(c.paddingTop),paddingEnd:rte(c.paddingBottom)}})}})}),[Wit,_6e]=m6e(Eg),b6e=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:i,onThumbChange:o,onThumbPointerUp:c,onThumbPointerDown:a,onThumbPositionChange:h,onDragScroll:m,onWheelScroll:x,onResize:v,...w}=t,k=Jf(Eg,n),[C,S]=P.useState(null),T=Xs(e,Z=>S(Z)),I=P.useRef(null),A=P.useRef(""),D=k.viewport,$=s.content-s.viewport,F=ql(x),q=ql(h),W=Gne(v,10);function K(Z){if(I.current){const re=Z.clientX-I.current.left,he=Z.clientY-I.current.top;m({x:re,y:he})}}return P.useEffect(()=>{const Z=re=>{const he=re.target;(C==null?void 0:C.contains(he))&&F(re,$)};return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[D,C,$,F]),P.useEffect(q,[s,q]),aC(C,W),aC(k.content,W),r.jsx(Wit,{scope:n,scrollbar:C,hasThumb:i,onThumbChange:ql(o),onThumbPointerUp:ql(c),onThumbPositionChange:q,onThumbPointerDown:ql(a),children:r.jsx(Dn.div,{...w,ref:T,style:{position:"absolute",...w.style},onPointerDown:an(t.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),I.current=C.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",k.viewport&&(k.viewport.style.scrollBehavior="auto"),K(Z))}),onPointerMove:an(t.onPointerMove,K),onPointerUp:an(t.onPointerUp,Z=>{const re=Z.target;re.hasPointerCapture(Z.pointerId)&&re.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=A.current,k.viewport&&(k.viewport.style.scrollBehavior=""),I.current=null})})})}),tte="ScrollAreaThumb",w6e=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=_6e(tte,t.__scopeScrollArea);return r.jsx(lc,{present:n||i.hasThumb,children:r.jsx(Git,{ref:e,...s})})}),Git=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...i}=t,o=Jf(tte,n),c=_6e(tte,n),{onThumbPositionChange:a}=c,h=Xs(e,v=>c.onThumbChange(v)),m=P.useRef(void 0),x=Gne(()=>{m.current&&(m.current(),m.current=void 0)},100);return P.useEffect(()=>{const v=o.viewport;if(v){const w=()=>{if(x(),!m.current){const k=Yit(v,a);m.current=k,a()}};return a(),v.addEventListener("scroll",w),()=>v.removeEventListener("scroll",w)}},[o.viewport,x,a]),r.jsx(Dn.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:an(t.onPointerDownCapture,v=>{const k=v.target.getBoundingClientRect(),C=v.clientX-k.left,S=v.clientY-k.top;c.onThumbPointerDown({x:C,y:S})}),onPointerUp:an(t.onPointerUp,c.onThumbPointerUp)})});w6e.displayName=tte;var jge="ScrollAreaCorner",j6e=P.forwardRef((t,e)=>{const n=Jf(jge,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(Kit,{...t,ref:e}):null});j6e.displayName=jge;var Kit=P.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,i=Jf(jge,n),[o,c]=P.useState(0),[a,h]=P.useState(0),m=!!(o&&a);return aC(i.scrollbarX,()=>{var v;const x=((v=i.scrollbarX)==null?void 0:v.offsetHeight)||0;i.onCornerHeightChange(x),h(x)}),aC(i.scrollbarY,()=>{var v;const x=((v=i.scrollbarY)==null?void 0:v.offsetWidth)||0;i.onCornerWidthChange(x),c(x)}),m?r.jsx(Dn.div,{...s,ref:e,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function rte(t){return t?parseInt(t,10):0}function k6e(t,e){const n=t/e;return isNaN(n)?0:n}function Wne(t){const e=k6e(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function Zit(t,e,n,s="ltr"){const i=Wne(n),o=i/2,c=e||o,a=i-c,h=n.scrollbar.paddingStart+c,m=n.scrollbar.size-n.scrollbar.paddingEnd-a,x=n.content-n.viewport,v=s==="ltr"?[0,x]:[x*-1,0];return N6e([h,m],v)(t)}function jje(t,e,n="ltr"){const s=Wne(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,c=e.content-e.viewport,a=o-s,h=n==="ltr"?[0,c]:[c*-1,0],m=VA(t,h);return N6e([0,c],[0,a])(m)}function N6e(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function S6e(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},s=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},c=n.left!==o.left,a=n.top!==o.top;(c||a)&&e(),n=o,s=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(s)};function Gne(t,e){const n=ql(t),s=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(s.current),[]),P.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,e)},[n,e])}function aC(t,e){const n=ql(e);Gl(()=>{let s=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(s),i.unobserve(t)}}},[t,n])}var C6e=g6e,Xit=y6e,Qit=j6e;const _l=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(C6e,{ref:s,className:$t("relative overflow-hidden",t),...n,children:[r.jsx(Xit,{className:"h-full w-full rounded-[inherit]",children:e}),r.jsx(kge,{}),r.jsx(Qit,{})]}));_l.displayName=C6e.displayName;const kge=P.forwardRef(({className:t,orientation:e="vertical",...n},s)=>r.jsx(bge,{ref:s,orientation:e,className:$t("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:r.jsx(w6e,{className:"relative flex-1 rounded-full bg-border"})}));kge.displayName=bge.displayName;var Ole="rovingFocusGroup.onEntryFocus",Jit={bubbles:!1,cancelable:!0},hI="RovingFocusGroup",[she,M6e,eat]=XE(hI),[tat,i5]=Zl(hI,[eat]),[rat,nat]=tat(hI),T6e=P.forwardRef((t,e)=>r.jsx(she.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(she.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(sat,{...t,ref:e})})}));T6e.displayName=hI;var sat=P.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:o,currentTabStopId:c,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:x=!1,...v}=t,w=P.useRef(null),k=Xs(e,w),C=Zj(o),[S,T]=Eu({prop:c,defaultProp:a??null,onChange:h,caller:hI}),[I,A]=P.useState(!1),D=ql(m),$=M6e(n),F=P.useRef(!1),[q,W]=P.useState(0);return P.useEffect(()=>{const K=w.current;if(K)return K.addEventListener(Ole,D),()=>K.removeEventListener(Ole,D)},[D]),r.jsx(rat,{scope:n,orientation:s,dir:C,loop:i,currentTabStopId:S,onItemFocus:P.useCallback(K=>T(K),[T]),onItemShiftTab:P.useCallback(()=>A(!0),[]),onFocusableItemAdd:P.useCallback(()=>W(K=>K+1),[]),onFocusableItemRemove:P.useCallback(()=>W(K=>K-1),[]),children:r.jsx(Dn.div,{tabIndex:I||q===0?-1:0,"data-orientation":s,...v,ref:k,style:{outline:"none",...t.style},onMouseDown:an(t.onMouseDown,()=>{F.current=!0}),onFocus:an(t.onFocus,K=>{const Z=!F.current;if(K.target===K.currentTarget&&Z&&!I){const re=new CustomEvent(Ole,Jit);if(K.currentTarget.dispatchEvent(re),!re.defaultPrevented){const he=$().filter(ie=>ie.focusable),ue=he.find(ie=>ie.active),je=he.find(ie=>ie.id===S),ye=[ue,je,...he].filter(Boolean).map(ie=>ie.ref.current);I6e(ye,x)}}F.current=!1}),onBlur:an(t.onBlur,()=>A(!1))})})}),A6e="RovingFocusGroupItem",E6e=P.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:o,children:c,...a}=t,h=zc(),m=o||h,x=nat(A6e,n),v=x.currentTabStopId===m,w=M6e(n),{onFocusableItemAdd:k,onFocusableItemRemove:C,currentTabStopId:S}=x;return P.useEffect(()=>{if(s)return k(),()=>C()},[s,k,C]),r.jsx(she.ItemSlot,{scope:n,id:m,focusable:s,active:i,children:r.jsx(Dn.span,{tabIndex:v?0:-1,"data-orientation":x.orientation,...a,ref:e,onMouseDown:an(t.onMouseDown,T=>{s?x.onItemFocus(m):T.preventDefault()}),onFocus:an(t.onFocus,()=>x.onItemFocus(m)),onKeyDown:an(t.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){x.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const I=oat(T,x.orientation,x.dir);if(I!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let D=w().filter($=>$.focusable).map($=>$.ref.current);if(I==="last")D.reverse();else if(I==="prev"||I==="next"){I==="prev"&&D.reverse();const $=D.indexOf(T.currentTarget);D=x.loop?lat(D,$+1):D.slice($+1)}setTimeout(()=>I6e(D))}}),children:typeof c=="function"?c({isCurrentTabStop:v,hasTabStop:S!=null}):c})})});E6e.displayName=A6e;var iat={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aat(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function oat(t,e,n){const s=aat(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return iat[s]}function I6e(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function lat(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var Nge=T6e,Sge=E6e,ihe=["Enter"," "],cat=["ArrowDown","PageUp","Home"],P6e=["ArrowUp","PageDown","End"],dat=[...cat,...P6e],uat={ltr:[...ihe,"ArrowRight"],rtl:[...ihe,"ArrowLeft"]},hat={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fI="Menu",[GA,fat,pat]=XE(fI),[Yj,L6e]=Zl(fI,[pat,Cg,i5]),Kne=Cg(),O6e=i5(),[mat,Xj]=Yj(fI),[gat,pI]=Yj(fI),D6e=t=>{const{__scopeMenu:e,open:n=!1,children:s,dir:i,onOpenChange:o,modal:c=!0}=t,a=Kne(e),[h,m]=P.useState(null),x=P.useRef(!1),v=ql(o),w=Zj(i);return P.useEffect(()=>{const k=()=>{x.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>x.current=!1;return document.addEventListener("keydown",k,{capture:!0}),()=>{document.removeEventListener("keydown",k,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),r.jsx(tI,{...a,children:r.jsx(mat,{scope:e,open:n,onOpenChange:v,content:h,onContentChange:m,children:r.jsx(gat,{scope:e,onClose:P.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:x,dir:w,modal:c,children:s})})})};D6e.displayName=fI;var xat="MenuAnchor",Cge=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,i=Kne(n);return r.jsx(KC,{...i,...s,ref:e})});Cge.displayName=xat;var Mge="MenuPortal",[yat,R6e]=Yj(Mge,{forceMount:void 0}),F6e=t=>{const{__scopeMenu:e,forceMount:n,children:s,container:i}=t,o=Xj(Mge,e);return r.jsx(yat,{scope:e,forceMount:n,children:r.jsx(lc,{present:n||o.open,children:r.jsx(qC,{asChild:!0,container:i,children:s})})})};F6e.displayName=Mge;var Vf="MenuContent",[vat,Tge]=Yj(Vf),z6e=P.forwardRef((t,e)=>{const n=R6e(Vf,t.__scopeMenu),{forceMount:s=n.forceMount,...i}=t,o=Xj(Vf,t.__scopeMenu),c=pI(Vf,t.__scopeMenu);return r.jsx(GA.Provider,{scope:t.__scopeMenu,children:r.jsx(lc,{present:s||o.open,children:r.jsx(GA.Slot,{scope:t.__scopeMenu,children:c.modal?r.jsx(_at,{...i,ref:e}):r.jsx(bat,{...i,ref:e})})})})}),_at=P.forwardRef((t,e)=>{const n=Xj(Vf,t.__scopeMenu),s=P.useRef(null),i=Xs(e,s);return P.useEffect(()=>{const o=s.current;if(o)return One(o)},[]),r.jsx(Age,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:an(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bat=P.forwardRef((t,e)=>{const n=Xj(Vf,t.__scopeMenu);return r.jsx(Age,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wat=N1("MenuContent.ScrollLock"),Age=P.forwardRef((t,e)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:a,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:k,disableOutsideScroll:C,...S}=t,T=Xj(Vf,n),I=pI(Vf,n),A=Kne(n),D=O6e(n),$=fat(n),[F,q]=P.useState(null),W=P.useRef(null),K=Xs(e,W,T.onContentChange),Z=P.useRef(0),re=P.useRef(""),he=P.useRef(0),ue=P.useRef(null),je=P.useRef("right"),ne=P.useRef(0),ye=C?oI:P.Fragment,ie=C?{as:wat,allowPinchZoom:!0}:void 0,me=ve=>{var Le,Qe;const Ie=re.current+ve,Se=$().filter(Fe=>!Fe.disabled),oe=document.activeElement,ae=(Le=Se.find(Fe=>Fe.ref.current===oe))==null?void 0:Le.textValue,Ne=Se.map(Fe=>Fe.textValue),Te=Lat(Ne,Ie,ae),Be=(Qe=Se.find(Fe=>Fe.textValue===Te))==null?void 0:Qe.ref.current;(function Fe(Ce){re.current=Ce,window.clearTimeout(Z.current),Ce!==""&&(Z.current=window.setTimeout(()=>Fe(""),1e3))})(Ie),Be&&setTimeout(()=>Be.focus())};P.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Pne();const fe=P.useCallback(ve=>{var Se,oe;return je.current===((Se=ue.current)==null?void 0:Se.side)&&Dat(ve,(oe=ue.current)==null?void 0:oe.area)},[]);return r.jsx(vat,{scope:n,searchRef:re,onItemEnter:P.useCallback(ve=>{fe(ve)&&ve.preventDefault()},[fe]),onItemLeave:P.useCallback(ve=>{var Ie;fe(ve)||((Ie=W.current)==null||Ie.focus(),q(null))},[fe]),onTriggerLeave:P.useCallback(ve=>{fe(ve)&&ve.preventDefault()},[fe]),pointerGraceTimerRef:he,onPointerGraceIntentChange:P.useCallback(ve=>{ue.current=ve},[]),children:r.jsx(ye,{...ie,children:r.jsx(aI,{asChild:!0,trapped:i,onMountAutoFocus:an(o,ve=>{var Ie;ve.preventDefault(),(Ie=W.current)==null||Ie.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:r.jsx(D1,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:m,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:k,children:r.jsx(Nge,{asChild:!0,...D,dir:I.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:q,onEntryFocus:an(h,ve=>{I.isUsingKeyboardRef.current||ve.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(rI,{role:"menu","aria-orientation":"vertical","data-state":tLe(T.open),"data-radix-menu-content":"",dir:I.dir,...A,...S,ref:K,style:{outline:"none",...S.style},onKeyDown:an(S.onKeyDown,ve=>{const Se=ve.target.closest("[data-radix-menu-content]")===ve.currentTarget,oe=ve.ctrlKey||ve.altKey||ve.metaKey,ae=ve.key.length===1;Se&&(ve.key==="Tab"&&ve.preventDefault(),!oe&&ae&&me(ve.key));const Ne=W.current;if(ve.target!==Ne||!dat.includes(ve.key))return;ve.preventDefault();const Be=$().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);P6e.includes(ve.key)&&Be.reverse(),Iat(Be)}),onBlur:an(t.onBlur,ve=>{ve.currentTarget.contains(ve.target)||(window.clearTimeout(Z.current),re.current="")}),onPointerMove:an(t.onPointerMove,KA(ve=>{const Ie=ve.target,Se=ne.current!==ve.clientX;if(ve.currentTarget.contains(Ie)&&Se){const oe=ve.clientX>ne.current?"right":"left";je.current=oe,ne.current=ve.clientX}}))})})})})})})});z6e.displayName=Vf;var jat="MenuGroup",Ege=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Dn.div,{role:"group",...s,ref:e})});Ege.displayName=jat;var kat="MenuLabel",B6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Dn.div,{...s,ref:e})});B6e.displayName=kat;var nte="MenuItem",kje="menu.itemSelect",Zne=P.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:s,...i}=t,o=P.useRef(null),c=pI(nte,t.__scopeMenu),a=Tge(nte,t.__scopeMenu),h=Xs(e,o),m=P.useRef(!1),x=()=>{const v=o.current;if(!n&&v){const w=new CustomEvent(kje,{bubbles:!0,cancelable:!0});v.addEventListener(kje,k=>s==null?void 0:s(k),{once:!0}),Tme(v,w),w.defaultPrevented?m.current=!1:c.onClose()}};return r.jsx($6e,{...i,ref:h,disabled:n,onClick:an(t.onClick,x),onPointerDown:v=>{var w;(w=t.onPointerDown)==null||w.call(t,v),m.current=!0},onPointerUp:an(t.onPointerUp,v=>{var w;m.current||(w=v.currentTarget)==null||w.click()}),onKeyDown:an(t.onKeyDown,v=>{const w=a.searchRef.current!=="";n||w&&v.key===" "||ihe.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Zne.displayName=nte;var $6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:s=!1,textValue:i,...o}=t,c=Tge(nte,n),a=O6e(n),h=P.useRef(null),m=Xs(e,h),[x,v]=P.useState(!1),[w,k]=P.useState("");return P.useEffect(()=>{const C=h.current;C&&k((C.textContent??"").trim())},[o.children]),r.jsx(GA.ItemSlot,{scope:n,disabled:s,textValue:i??w,children:r.jsx(Sge,{asChild:!0,...a,focusable:!s,children:r.jsx(Dn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:m,onPointerMove:an(t.onPointerMove,KA(C=>{s?c.onItemLeave(C):(c.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:an(t.onPointerLeave,KA(C=>c.onItemLeave(C))),onFocus:an(t.onFocus,()=>v(!0)),onBlur:an(t.onBlur,()=>v(!1))})})})}),Nat="MenuCheckboxItem",U6e=P.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:s,...i}=t;return r.jsx(G6e,{scope:t.__scopeMenu,checked:n,children:r.jsx(Zne,{role:"menuitemcheckbox","aria-checked":ste(n)?"mixed":n,...i,ref:e,"data-state":Pge(n),onSelect:an(i.onSelect,()=>s==null?void 0:s(ste(n)?!0:!n),{checkForDefaultPrevented:!1})})})});U6e.displayName=Nat;var q6e="MenuRadioGroup",[Sat,Cat]=Yj(q6e,{value:void 0,onValueChange:()=>{}}),V6e=P.forwardRef((t,e)=>{const{value:n,onValueChange:s,...i}=t,o=ql(s);return r.jsx(Sat,{scope:t.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Ege,{...i,ref:e})})});V6e.displayName=q6e;var H6e="MenuRadioItem",W6e=P.forwardRef((t,e)=>{const{value:n,...s}=t,i=Cat(H6e,t.__scopeMenu),o=n===i.value;return r.jsx(G6e,{scope:t.__scopeMenu,checked:o,children:r.jsx(Zne,{role:"menuitemradio","aria-checked":o,...s,ref:e,"data-state":Pge(o),onSelect:an(s.onSelect,()=>{var c;return(c=i.onValueChange)==null?void 0:c.call(i,n)},{checkForDefaultPrevented:!1})})})});W6e.displayName=H6e;var Ige="MenuItemIndicator",[G6e,Mat]=Yj(Ige,{checked:!1}),K6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:s,...i}=t,o=Mat(Ige,n);return r.jsx(lc,{present:s||ste(o.checked)||o.checked===!0,children:r.jsx(Dn.span,{...i,ref:e,"data-state":Pge(o.checked)})})});K6e.displayName=Ige;var Tat="MenuSeparator",Z6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Dn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:e})});Z6e.displayName=Tat;var Aat="MenuArrow",Y6e=P.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,i=Kne(n);return r.jsx(nI,{...i,...s,ref:e})});Y6e.displayName=Aat;var Eat="MenuSub",[sKt,X6e]=Yj(Eat),sT="MenuSubTrigger",Q6e=P.forwardRef((t,e)=>{const n=Xj(sT,t.__scopeMenu),s=pI(sT,t.__scopeMenu),i=X6e(sT,t.__scopeMenu),o=Tge(sT,t.__scopeMenu),c=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:h}=o,m={__scopeMenu:t.__scopeMenu},x=P.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return P.useEffect(()=>x,[x]),P.useEffect(()=>{const v=a.current;return()=>{window.clearTimeout(v),h(null)}},[a,h]),r.jsx(Cge,{asChild:!0,...m,children:r.jsx($6e,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tLe(n.open),...t,ref:Kx(e,i.onTriggerChange),onClick:v=>{var w;(w=t.onClick)==null||w.call(t,v),!(t.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:an(t.onPointerMove,KA(v=>{o.onItemEnter(v),!v.defaultPrevented&&!t.disabled&&!n.open&&!c.current&&(o.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),x()},100))})),onPointerLeave:an(t.onPointerLeave,KA(v=>{var k,C;x();const w=(k=n.content)==null?void 0:k.getBoundingClientRect();if(w){const S=(C=n.content)==null?void 0:C.dataset.side,T=S==="right",I=T?-5:5,A=w[T?"left":"right"],D=w[T?"right":"left"];o.onPointerGraceIntentChange({area:[{x:v.clientX+I,y:v.clientY},{x:A,y:w.top},{x:D,y:w.top},{x:D,y:w.bottom},{x:A,y:w.bottom}],side:S}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(v),v.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:an(t.onKeyDown,v=>{var k;const w=o.searchRef.current!=="";t.disabled||w&&v.key===" "||uat[s.dir].includes(v.key)&&(n.onOpenChange(!0),(k=n.content)==null||k.focus(),v.preventDefault())})})})});Q6e.displayName=sT;var J6e="MenuSubContent",eLe=P.forwardRef((t,e)=>{const n=R6e(Vf,t.__scopeMenu),{forceMount:s=n.forceMount,...i}=t,o=Xj(Vf,t.__scopeMenu),c=pI(Vf,t.__scopeMenu),a=X6e(J6e,t.__scopeMenu),h=P.useRef(null),m=Xs(e,h);return r.jsx(GA.Provider,{scope:t.__scopeMenu,children:r.jsx(lc,{present:s||o.open,children:r.jsx(GA.Slot,{scope:t.__scopeMenu,children:r.jsx(Age,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:m,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var v;c.isUsingKeyboardRef.current&&((v=h.current)==null||v.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:an(t.onFocusOutside,x=>{x.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:an(t.onEscapeKeyDown,x=>{c.onClose(),x.preventDefault()}),onKeyDown:an(t.onKeyDown,x=>{var k;const v=x.currentTarget.contains(x.target),w=hat[c.dir].includes(x.key);v&&w&&(o.onOpenChange(!1),(k=a.trigger)==null||k.focus(),x.preventDefault())})})})})})});eLe.displayName=J6e;function tLe(t){return t?"open":"closed"}function ste(t){return t==="indeterminate"}function Pge(t){return ste(t)?"indeterminate":t?"checked":"unchecked"}function Iat(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Pat(t,e){return t.map((n,s)=>t[(e+s)%t.length])}function Lat(t,e,n){const i=e.length>1&&Array.from(e).every(m=>m===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let c=Pat(t,Math.max(o,0));i.length===1&&(c=c.filter(m=>m!==n));const h=c.find(m=>m.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function Oat(t,e){const{x:n,y:s}=t;let i=!1;for(let o=0,c=e.length-1;os!=w>s&&n<(v-m)*(s-x)/(w-x)+m&&(i=!i)}return i}function Dat(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Oat(n,e)}function KA(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Rat=D6e,Fat=Cge,zat=F6e,Bat=z6e,$at=Ege,Uat=B6e,qat=Zne,Vat=U6e,Hat=V6e,Wat=W6e,Gat=K6e,Kat=Z6e,Zat=Y6e,Yat=Q6e,Xat=eLe,Yne="DropdownMenu",[Qat]=Zl(Yne,[L6e]),Du=L6e(),[Jat,rLe]=Qat(Yne),nLe=t=>{const{__scopeDropdownMenu:e,children:n,dir:s,open:i,defaultOpen:o,onOpenChange:c,modal:a=!0}=t,h=Du(e),m=P.useRef(null),[x,v]=Eu({prop:i,defaultProp:o??!1,onChange:c,caller:Yne});return r.jsx(Jat,{scope:e,triggerId:zc(),triggerRef:m,contentId:zc(),open:x,onOpenChange:v,onOpenToggle:P.useCallback(()=>v(w=>!w),[v]),modal:a,children:r.jsx(Rat,{...h,open:x,onOpenChange:v,dir:s,modal:a,children:n})})};nLe.displayName=Yne;var sLe="DropdownMenuTrigger",iLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...i}=t,o=rLe(sLe,n),c=Du(n);return r.jsx(Fat,{asChild:!0,...c,children:r.jsx(Dn.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...i,ref:Kx(e,o.triggerRef),onPointerDown:an(t.onPointerDown,a=>{!s&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:an(t.onKeyDown,a=>{s||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});iLe.displayName=sLe;var eot="DropdownMenuPortal",aLe=t=>{const{__scopeDropdownMenu:e,...n}=t,s=Du(e);return r.jsx(zat,{...s,...n})};aLe.displayName=eot;var oLe="DropdownMenuContent",lLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=rLe(oLe,n),o=Du(n),c=P.useRef(!1);return r.jsx(Bat,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...s,ref:e,onCloseAutoFocus:an(t.onCloseAutoFocus,a=>{var h;c.current||(h=i.triggerRef.current)==null||h.focus(),c.current=!1,a.preventDefault()}),onInteractOutside:an(t.onInteractOutside,a=>{const h=a.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,x=h.button===2||m;(!i.modal||x)&&(c.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)"}})});lLe.displayName=oLe;var tot="DropdownMenuGroup",rot=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx($at,{...i,...s,ref:e})});rot.displayName=tot;var not="DropdownMenuLabel",cLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Uat,{...i,...s,ref:e})});cLe.displayName=not;var sot="DropdownMenuItem",dLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(qat,{...i,...s,ref:e})});dLe.displayName=sot;var iot="DropdownMenuCheckboxItem",uLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Vat,{...i,...s,ref:e})});uLe.displayName=iot;var aot="DropdownMenuRadioGroup",oot=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Hat,{...i,...s,ref:e})});oot.displayName=aot;var lot="DropdownMenuRadioItem",hLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Wat,{...i,...s,ref:e})});hLe.displayName=lot;var cot="DropdownMenuItemIndicator",fLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Gat,{...i,...s,ref:e})});fLe.displayName=cot;var dot="DropdownMenuSeparator",pLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Kat,{...i,...s,ref:e})});pLe.displayName=dot;var uot="DropdownMenuArrow",hot=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Zat,{...i,...s,ref:e})});hot.displayName=uot;var fot="DropdownMenuSubTrigger",mLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Yat,{...i,...s,ref:e})});mLe.displayName=fot;var pot="DropdownMenuSubContent",gLe=P.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,i=Du(n);return r.jsx(Xat,{...i,...s,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gLe.displayName=pot;var mot=nLe,got=iLe,xot=aLe,xLe=lLe,yLe=cLe,vLe=dLe,_Le=uLe,bLe=hLe,wLe=fLe,jLe=pLe,kLe=mLe,NLe=gLe;const xm=mot,ym=got,yot=P.forwardRef(({className:t,inset:e,children:n,...s},i)=>r.jsxs(kLe,{ref:i,className:$t("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",t),...s,children:[n,r.jsx(Ka,{className:"ml-auto h-4 w-4"})]}));yot.displayName=kLe.displayName;const vot=P.forwardRef(({className:t,...e},n)=>r.jsx(NLe,{ref:n,className:$t("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));vot.displayName=NLe.displayName;const ep=P.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(xot,{children:r.jsx(xLe,{ref:s,sideOffset:e,className:$t("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));ep.displayName=xLe.displayName;const co=P.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(vLe,{ref:s,className:$t("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...n}));co.displayName=vLe.displayName;const _ot=P.forwardRef(({className:t,children:e,checked:n,...s},i)=>r.jsxs(_Le,{ref:i,className:$t("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(wLe,{children:r.jsx($a,{className:"h-4 w-4"})})}),e]}));_ot.displayName=_Le.displayName;const bot=P.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(bLe,{ref:s,className:$t("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(wLe,{children:r.jsx(Au,{className:"h-2 w-2 fill-current"})})}),e]}));bot.displayName=bLe.displayName;const ahe=P.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(yLe,{ref:s,className:$t("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));ahe.displayName=yLe.displayName;const oC=P.forwardRef(({className:t,...e},n)=>r.jsx(jLe,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",t),...e}));oC.displayName=jLe.displayName;var Xne="Collapsible",[wot]=Zl(Xne),[jot,Lge]=wot(Xne),SLe=P.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:i,disabled:o,onOpenChange:c,...a}=t,[h,m]=Eu({prop:s,defaultProp:i??!1,onChange:c,caller:Xne});return r.jsx(jot,{scope:n,disabled:o,contentId:zc(),open:h,onOpenToggle:P.useCallback(()=>m(x=>!x),[m]),children:r.jsx(Dn.div,{"data-state":Dge(h),"data-disabled":o?"":void 0,...a,ref:e})})});SLe.displayName=Xne;var CLe="CollapsibleTrigger",MLe=P.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,i=Lge(CLe,n);return r.jsx(Dn.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Dge(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:e,onClick:an(t.onClick,i.onOpenToggle)})});MLe.displayName=CLe;var Oge="CollapsibleContent",TLe=P.forwardRef((t,e)=>{const{forceMount:n,...s}=t,i=Lge(Oge,t.__scopeCollapsible);return r.jsx(lc,{present:n||i.open,children:({present:o})=>r.jsx(kot,{...s,ref:e,present:o})})});TLe.displayName=Oge;var kot=P.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:i,...o}=t,c=Lge(Oge,n),[a,h]=P.useState(s),m=P.useRef(null),x=Xs(e,m),v=P.useRef(0),w=v.current,k=P.useRef(0),C=k.current,S=c.open||a,T=P.useRef(S),I=P.useRef(void 0);return P.useEffect(()=>{const A=requestAnimationFrame(()=>T.current=!1);return()=>cancelAnimationFrame(A)},[]),Gl(()=>{const A=m.current;if(A){I.current=I.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const D=A.getBoundingClientRect();v.current=D.height,k.current=D.width,T.current||(A.style.transitionDuration=I.current.transitionDuration,A.style.animationName=I.current.animationName),h(s)}},[c.open,s]),r.jsx(Dn.div,{"data-state":Dge(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!S,...o,ref:x,style:{"--radix-collapsible-content-height":w?`${w}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...t.style},children:S&&i})});function Dge(t){return t?"open":"closed"}var Not=SLe;const y4=Not,v4=MLe,_4=TLe,Nje="/assets/levelup-logo-Eif24dqY.png",Sot="/assets/levelup-logo-icon-C-7iromj.png";var mI=t=>t.type==="checkbox",jw=t=>t instanceof Date,xu=t=>t==null;const ALe=t=>typeof t=="object";var oc=t=>!xu(t)&&!Array.isArray(t)&&ALe(t)&&!jw(t),ELe=t=>oc(t)&&t.target?mI(t.target)?t.target.checked:t.target.value:t,Cot=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ILe=(t,e)=>t.has(Cot(e)),Mot=t=>{const e=t.constructor&&t.constructor.prototype;return oc(e)&&e.hasOwnProperty("isPrototypeOf")},Rge=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ic(t){let e;const n=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(Rge&&(t instanceof Blob||s))&&(n||oc(t)))if(e=n?[]:{},!n&&!Mot(t))e=t;else for(const i in t)t.hasOwnProperty(i)&&(e[i]=Ic(t[i]));else return t;return e}var Qne=t=>/^\w*$/.test(t),tc=t=>t===void 0,Fge=t=>Array.isArray(t)?t.filter(Boolean):[],zge=t=>Fge(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Gn=(t,e,n)=>{if(!e||!oc(t))return n;const s=(Qne(e)?[e]:zge(e)).reduce((i,o)=>xu(i)?i:i[o],t);return tc(s)||s===t?tc(t[e])?n:t[e]:s},Ph=t=>typeof t=="boolean",go=(t,e,n)=>{let s=-1;const i=Qne(e)?[e]:zge(e),o=i.length,c=o-1;for(;++slt.useContext(Bge),Tot=t=>{const{children:e,...n}=t;return lt.createElement(Bge.Provider,{value:n},e)};var PLe=(t,e,n,s=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const c=o;return e._proxyFormState[c]!==Kp.all&&(e._proxyFormState[c]=!s||Kp.all),n&&(n[c]=!0),t[c]}});return i};const $ge=typeof window<"u"?lt.useLayoutEffect:lt.useEffect;function Aot(t){const e=Jne(),{control:n=e.control,disabled:s,name:i,exact:o}=t||{},[c,a]=lt.useState(n._formState),h=lt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return $ge(()=>n._subscribe({name:i,formState:h.current,exact:o,callback:m=>{!s&&a({...n._formState,...m})}}),[i,s,o]),lt.useEffect(()=>{h.current.isValid&&n._setValid(!0)},[n]),lt.useMemo(()=>PLe(c,n,h.current,!1),[c,n])}var sg=t=>typeof t=="string",LLe=(t,e,n,s,i)=>sg(t)?(s&&e.watch.add(t),Gn(n,t,i)):Array.isArray(t)?t.map(o=>(s&&e.watch.add(o),Gn(n,o))):(s&&(e.watchAll=!0),n),ohe=t=>xu(t)||!ALe(t);function bx(t,e,n=new WeakSet){if(ohe(t)||ohe(e))return t===e;if(jw(t)&&jw(e))return t.getTime()===e.getTime();const s=Object.keys(t),i=Object.keys(e);if(s.length!==i.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const o of s){const c=t[o];if(!i.includes(o))return!1;if(o!=="ref"){const a=e[o];if(jw(c)&&jw(a)||oc(c)&&oc(a)||Array.isArray(c)&&Array.isArray(a)?!bx(c,a,n):c!==a)return!1}}return!0}function Eot(t){const e=Jne(),{control:n=e.control,name:s,defaultValue:i,disabled:o,exact:c,compute:a}=t||{},h=lt.useRef(i),m=lt.useRef(a),x=lt.useRef(void 0);m.current=a;const v=lt.useMemo(()=>n._getWatch(s,h.current),[n,s]),[w,k]=lt.useState(m.current?m.current(v):v);return $ge(()=>n._subscribe({name:s,formState:{values:!0},exact:c,callback:C=>{if(!o){const S=LLe(s,n._names,C.values||n._formValues,!1,h.current);if(m.current){const T=m.current(S);bx(T,x.current)||(k(T),x.current=T)}else k(S)}}}),[n,o,s,c]),lt.useEffect(()=>n._removeUnmounted()),w}function Iot(t){const e=Jne(),{name:n,disabled:s,control:i=e.control,shouldUnregister:o,defaultValue:c}=t,a=ILe(i._names.array,n),h=lt.useMemo(()=>Gn(i._formValues,n,Gn(i._defaultValues,n,c)),[i,n,c]),m=Eot({control:i,name:n,defaultValue:h,exact:!0}),x=Aot({control:i,name:n,exact:!0}),v=lt.useRef(t),w=lt.useRef(i.register(n,{...t.rules,value:m,...Ph(t.disabled)?{disabled:t.disabled}:{}}));v.current=t;const k=lt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Gn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Gn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Gn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Gn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Gn(x.errors,n)}}),[x,n]),C=lt.useCallback(A=>w.current.onChange({target:{value:ELe(A),name:n},type:ite.CHANGE}),[n]),S=lt.useCallback(()=>w.current.onBlur({target:{value:Gn(i._formValues,n),name:n},type:ite.BLUR}),[n,i._formValues]),T=lt.useCallback(A=>{const D=Gn(i._fields,n);D&&A&&(D._f.ref={focus:()=>A.focus&&A.focus(),select:()=>A.select&&A.select(),setCustomValidity:$=>A.setCustomValidity($),reportValidity:()=>A.reportValidity()})},[i._fields,n]),I=lt.useMemo(()=>({name:n,value:m,...Ph(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:C,onBlur:S,ref:T}),[n,s,x.disabled,C,S,T,m]);return lt.useEffect(()=>{const A=i._options.shouldUnregister||o;i.register(n,{...v.current.rules,...Ph(v.current.disabled)?{disabled:v.current.disabled}:{}});const D=($,F)=>{const q=Gn(i._fields,$);q&&q._f&&(q._f.mount=F)};if(D(n,!0),A){const $=Ic(Gn(i._options.defaultValues,n));go(i._defaultValues,n,$),tc(Gn(i._formValues,n))&&go(i._formValues,n,$)}return!a&&i.register(n),()=>{(a?A&&!i._state.action:A)?i.unregister(n):D(n,!1)}},[n,i,a,o]),lt.useEffect(()=>{i._setDisabledField({disabled:s,name:n})},[s,n,i]),lt.useMemo(()=>({field:I,formState:x,fieldState:k}),[I,x,k])}const Pot=t=>t.render(Iot(t));var OLe=(t,e,n,s,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[s]:i||!0}}:{},XT=t=>Array.isArray(t)?t:[t],Sje=()=>{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},eh=t=>oc(t)&&!Object.keys(t).length,Uge=t=>t.type==="file",Zp=t=>typeof t=="function",ate=t=>{if(!Rge)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},DLe=t=>t.type==="select-multiple",qge=t=>t.type==="radio",Lot=t=>qge(t)||mI(t),Dle=t=>ate(t)&&t.isConnected;function Oot(t,e){const n=e.slice(0,-1).length;let s=0;for(;s{for(const e in t)if(Zp(t[e]))return!0;return!1};function ote(t,e={}){const n=Array.isArray(t);if(oc(t)||n)for(const s in t)Array.isArray(t[s])||oc(t[s])&&!RLe(t[s])?(e[s]=Array.isArray(t[s])?[]:{},ote(t[s],e[s])):xu(t[s])||(e[s]=!0);return e}function FLe(t,e,n){const s=Array.isArray(t);if(oc(t)||s)for(const i in t)Array.isArray(t[i])||oc(t[i])&&!RLe(t[i])?tc(e)||ohe(n[i])?n[i]=Array.isArray(t[i])?ote(t[i],[]):{...ote(t[i])}:FLe(t[i],xu(e)?{}:e[i],n[i]):n[i]=!bx(t[i],e[i]);return n}var MM=(t,e)=>FLe(t,e,ote(e));const Cje={value:!1,isValid:!1},Mje={value:!0,isValid:!0};var zLe=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!tc(t[0].attributes.value)?tc(t[0].value)||t[0].value===""?Mje:{value:t[0].value,isValid:!0}:Mje:Cje}return Cje},BLe=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:s})=>tc(t)?t:e?t===""?NaN:t&&+t:n&&sg(t)?new Date(t):s?s(t):t;const Tje={isValid:!1,value:null};var $Le=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,Tje):Tje;function Aje(t){const e=t.ref;return Uge(e)?e.files:qge(e)?$Le(t.refs).value:DLe(e)?[...e.selectedOptions].map(({value:n})=>n):mI(e)?zLe(t.refs).value:BLe(tc(e.value)?t.ref.value:e.value,t)}var Rot=(t,e,n,s)=>{const i={};for(const o of t){const c=Gn(e,o);c&&go(i,o,c._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:s}},lte=t=>t instanceof RegExp,TM=t=>tc(t)?t:lte(t)?t.source:oc(t)?lte(t.value)?t.value.source:t.value:t,Eje=t=>({isOnSubmit:!t||t===Kp.onSubmit,isOnBlur:t===Kp.onBlur,isOnChange:t===Kp.onChange,isOnAll:t===Kp.all,isOnTouch:t===Kp.onTouched});const Ije="AsyncFunction";var Fot=t=>!!t&&!!t.validate&&!!(Zp(t.validate)&&t.validate.constructor.name===Ije||oc(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Ije)),zot=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Pje=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const QT=(t,e,n,s)=>{for(const i of n||Object.keys(t)){const o=Gn(t,i);if(o){const{_f:c,...a}=o;if(c){if(c.refs&&c.refs[0]&&e(c.refs[0],i)&&!s)return!0;if(c.ref&&e(c.ref,c.name)&&!s)return!0;if(QT(a,e))break}else if(oc(a)&&QT(a,e))break}}};function Lje(t,e,n){const s=Gn(t,n);if(s||Qne(n))return{error:s,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),c=Gn(e,o),a=Gn(t,o);if(c&&!Array.isArray(c)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};i.pop()}return{name:n}}var Bot=(t,e,n,s)=>{n(t);const{name:i,...o}=t;return eh(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(c=>e[c]===(!s||Kp.all))},$ot=(t,e,n)=>!t||!e||t===e||XT(t).some(s=>s&&(n?s===e:s.startsWith(e)||e.startsWith(s))),Uot=(t,e,n,s,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?s.isOnBlur:i.isOnBlur)?!t:(n?s.isOnChange:i.isOnChange)?t:!0,qot=(t,e)=>!Fge(Gn(t,e)).length&&pc(t,e),Vot=(t,e,n)=>{const s=XT(Gn(t,n));return go(s,"root",e[n]),go(t,n,s),t},eee=t=>sg(t);function Oje(t,e,n="validate"){if(eee(t)||Array.isArray(t)&&t.every(eee)||Ph(t)&&!t)return{type:n,message:eee(t)?t:"",ref:e}}var KN=t=>oc(t)&&!lte(t)?t:{value:t,message:""},Dje=async(t,e,n,s,i,o)=>{const{ref:c,refs:a,required:h,maxLength:m,minLength:x,min:v,max:w,pattern:k,validate:C,name:S,valueAsNumber:T,mount:I}=t._f,A=Gn(n,S);if(!I||e.has(S))return{};const D=a?a[0]:c,$=ue=>{i&&D.reportValidity&&(D.setCustomValidity(Ph(ue)?"":ue||""),D.reportValidity())},F={},q=qge(c),W=mI(c),K=q||W,Z=(T||Uge(c))&&tc(c.value)&&tc(A)||ate(c)&&c.value===""||A===""||Array.isArray(A)&&!A.length,re=OLe.bind(null,S,s,F),he=(ue,je,ne,ye=sx.maxLength,ie=sx.minLength)=>{const me=ue?je:ne;F[S]={type:ue?ye:ie,message:me,ref:c,...re(ue?ye:ie,me)}};if(o?!Array.isArray(A)||!A.length:h&&(!K&&(Z||xu(A))||Ph(A)&&!A||W&&!zLe(a).isValid||q&&!$Le(a).isValid)){const{value:ue,message:je}=eee(h)?{value:!!h,message:h}:KN(h);if(ue&&(F[S]={type:sx.required,message:je,ref:D,...re(sx.required,je)},!s))return $(je),F}if(!Z&&(!xu(v)||!xu(w))){let ue,je;const ne=KN(w),ye=KN(v);if(!xu(A)&&!isNaN(A)){const ie=c.valueAsNumber||A&&+A;xu(ne.value)||(ue=ie>ne.value),xu(ye.value)||(je=ienew Date(new Date().toDateString()+" "+Ie),fe=c.type=="time",ve=c.type=="week";sg(ne.value)&&A&&(ue=fe?me(A)>me(ne.value):ve?A>ne.value:ie>new Date(ne.value)),sg(ye.value)&&A&&(je=fe?me(A)+ue.value,ye=!xu(je.value)&&A.length<+je.value;if((ne||ye)&&(he(ne,ue.message,je.message),!s))return $(F[S].message),F}if(k&&!Z&&sg(A)){const{value:ue,message:je}=KN(k);if(lte(ue)&&!A.match(ue)&&(F[S]={type:sx.pattern,message:je,ref:c,...re(sx.pattern,je)},!s))return $(je),F}if(C){if(Zp(C)){const ue=await C(A,n),je=Oje(ue,D);if(je&&(F[S]={...je,...re(sx.validate,je.message)},!s))return $(je.message),F}else if(oc(C)){let ue={};for(const je in C){if(!eh(ue)&&!s)break;const ne=Oje(await C[je](A,n),D,je);ne&&(ue={...ne,...re(je,ne.message)},$(ne.message),s&&(F[S]=ue))}if(!eh(ue)&&(F[S]={ref:D,...ue},!s))return F}}return $(!0),F};const Hot={mode:Kp.onSubmit,reValidateMode:Kp.onChange,shouldFocusError:!0};function Wot(t={}){let e={...Hot,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Zp(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},i=oc(e.defaultValues)||oc(e.values)?Ic(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:Ic(i),c={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,m=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let v={...x};const w={array:Sje(),state:Sje()},k=e.criteriaMode===Kp.all,C=Re=>Ge=>{clearTimeout(m),m=setTimeout(Re,Ge)},S=async Re=>{if(!e.disabled&&(x.isValid||v.isValid||Re)){const Ge=e.resolver?eh((await W()).errors):await Z(s,!0);Ge!==n.isValid&&w.state.next({isValid:Ge})}},T=(Re,Ge)=>{!e.disabled&&(x.isValidating||x.validatingFields||v.isValidating||v.validatingFields)&&((Re||Array.from(a.mount)).forEach(tt=>{tt&&(Ge?go(n.validatingFields,tt,Ge):pc(n.validatingFields,tt))}),w.state.next({validatingFields:n.validatingFields,isValidating:!eh(n.validatingFields)}))},I=(Re,Ge=[],tt,Et,Lt=!0,Ot=!0)=>{if(Et&&tt&&!e.disabled){if(c.action=!0,Ot&&Array.isArray(Gn(s,Re))){const Dt=tt(Gn(s,Re),Et.argA,Et.argB);Lt&&go(s,Re,Dt)}if(Ot&&Array.isArray(Gn(n.errors,Re))){const Dt=tt(Gn(n.errors,Re),Et.argA,Et.argB);Lt&&go(n.errors,Re,Dt),qot(n.errors,Re)}if((x.touchedFields||v.touchedFields)&&Ot&&Array.isArray(Gn(n.touchedFields,Re))){const Dt=tt(Gn(n.touchedFields,Re),Et.argA,Et.argB);Lt&&go(n.touchedFields,Re,Dt)}(x.dirtyFields||v.dirtyFields)&&(n.dirtyFields=MM(i,o)),w.state.next({name:Re,isDirty:he(Re,Ge),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else go(o,Re,Ge)},A=(Re,Ge)=>{go(n.errors,Re,Ge),w.state.next({errors:n.errors})},D=Re=>{n.errors=Re,w.state.next({errors:n.errors,isValid:!1})},$=(Re,Ge,tt,Et)=>{const Lt=Gn(s,Re);if(Lt){const Ot=Gn(o,Re,tc(tt)?Gn(i,Re):tt);tc(Ot)||Et&&Et.defaultChecked||Ge?go(o,Re,Ge?Ot:Aje(Lt._f)):ne(Re,Ot),c.mount&&S()}},F=(Re,Ge,tt,Et,Lt)=>{let Ot=!1,Dt=!1;const kt={name:Re};if(!e.disabled){if(!tt||Et){(x.isDirty||v.isDirty)&&(Dt=n.isDirty,n.isDirty=kt.isDirty=he(),Ot=Dt!==kt.isDirty);const sr=bx(Gn(i,Re),Ge);Dt=!!Gn(n.dirtyFields,Re),sr?pc(n.dirtyFields,Re):go(n.dirtyFields,Re,!0),kt.dirtyFields=n.dirtyFields,Ot=Ot||(x.dirtyFields||v.dirtyFields)&&Dt!==!sr}if(tt){const sr=Gn(n.touchedFields,Re);sr||(go(n.touchedFields,Re,tt),kt.touchedFields=n.touchedFields,Ot=Ot||(x.touchedFields||v.touchedFields)&&sr!==tt)}Ot&&Lt&&w.state.next(kt)}return Ot?kt:{}},q=(Re,Ge,tt,Et)=>{const Lt=Gn(n.errors,Re),Ot=(x.isValid||v.isValid)&&Ph(Ge)&&n.isValid!==Ge;if(e.delayError&&tt?(h=C(()=>A(Re,tt)),h(e.delayError)):(clearTimeout(m),h=null,tt?go(n.errors,Re,tt):pc(n.errors,Re)),(tt?!bx(Lt,tt):Lt)||!eh(Et)||Ot){const Dt={...Et,...Ot&&Ph(Ge)?{isValid:Ge}:{},errors:n.errors,name:Re};n={...n,...Dt},w.state.next(Dt)}},W=async Re=>{T(Re,!0);const Ge=await e.resolver(o,e.context,Rot(Re||a.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return T(Re),Ge},K=async Re=>{const{errors:Ge}=await W(Re);if(Re)for(const tt of Re){const Et=Gn(Ge,tt);Et?go(n.errors,tt,Et):pc(n.errors,tt)}else n.errors=Ge;return Ge},Z=async(Re,Ge,tt={valid:!0})=>{for(const Et in Re){const Lt=Re[Et];if(Lt){const{_f:Ot,...Dt}=Lt;if(Ot){const kt=a.array.has(Ot.name),sr=Lt._f&&Fot(Lt._f);sr&&x.validatingFields&&T([Et],!0);const Pr=await Dje(Lt,a.disabled,o,k,e.shouldUseNativeValidation&&!Ge,kt);if(sr&&x.validatingFields&&T([Et]),Pr[Ot.name]&&(tt.valid=!1,Ge))break;!Ge&&(Gn(Pr,Ot.name)?kt?Vot(n.errors,Pr,Ot.name):go(n.errors,Ot.name,Pr[Ot.name]):pc(n.errors,Ot.name))}!eh(Dt)&&await Z(Dt,Ge,tt)}}return tt.valid},re=()=>{for(const Re of a.unMount){const Ge=Gn(s,Re);Ge&&(Ge._f.refs?Ge._f.refs.every(tt=>!Dle(tt)):!Dle(Ge._f.ref))&&Le(Re)}a.unMount=new Set},he=(Re,Ge)=>!e.disabled&&(Re&&Ge&&go(o,Re,Ge),!bx(Ie(),i)),ue=(Re,Ge,tt)=>LLe(Re,a,{...c.mount?o:tc(Ge)?i:sg(Re)?{[Re]:Ge}:Ge},tt,Ge),je=Re=>Fge(Gn(c.mount?o:i,Re,e.shouldUnregister?Gn(i,Re,[]):[])),ne=(Re,Ge,tt={})=>{const Et=Gn(s,Re);let Lt=Ge;if(Et){const Ot=Et._f;Ot&&(!Ot.disabled&&go(o,Re,BLe(Ge,Ot)),Lt=ate(Ot.ref)&&xu(Ge)?"":Ge,DLe(Ot.ref)?[...Ot.ref.options].forEach(Dt=>Dt.selected=Lt.includes(Dt.value)):Ot.refs?mI(Ot.ref)?Ot.refs.forEach(Dt=>{(!Dt.defaultChecked||!Dt.disabled)&&(Array.isArray(Lt)?Dt.checked=!!Lt.find(kt=>kt===Dt.value):Dt.checked=Lt===Dt.value||!!Lt)}):Ot.refs.forEach(Dt=>Dt.checked=Dt.value===Lt):Uge(Ot.ref)?Ot.ref.value="":(Ot.ref.value=Lt,Ot.ref.type||w.state.next({name:Re,values:Ic(o)})))}(tt.shouldDirty||tt.shouldTouch)&&F(Re,Lt,tt.shouldTouch,tt.shouldDirty,!0),tt.shouldValidate&&ve(Re)},ye=(Re,Ge,tt)=>{for(const Et in Ge){if(!Ge.hasOwnProperty(Et))return;const Lt=Ge[Et],Ot=Re+"."+Et,Dt=Gn(s,Ot);(a.array.has(Re)||oc(Lt)||Dt&&!Dt._f)&&!jw(Lt)?ye(Ot,Lt,tt):ne(Ot,Lt,tt)}},ie=(Re,Ge,tt={})=>{const Et=Gn(s,Re),Lt=a.array.has(Re),Ot=Ic(Ge);go(o,Re,Ot),Lt?(w.array.next({name:Re,values:Ic(o)}),(x.isDirty||x.dirtyFields||v.isDirty||v.dirtyFields)&&tt.shouldDirty&&w.state.next({name:Re,dirtyFields:MM(i,o),isDirty:he(Re,Ot)})):Et&&!Et._f&&!xu(Ot)?ye(Re,Ot,tt):ne(Re,Ot,tt),Pje(Re,a)&&w.state.next({...n,name:Re}),w.state.next({name:c.mount?Re:void 0,values:Ic(o)})},me=async Re=>{c.mount=!0;const Ge=Re.target;let tt=Ge.name,Et=!0;const Lt=Gn(s,tt),Ot=sr=>{Et=Number.isNaN(sr)||jw(sr)&&isNaN(sr.getTime())||bx(sr,Gn(o,tt,sr))},Dt=Eje(e.mode),kt=Eje(e.reValidateMode);if(Lt){let sr,Pr;const wn=Ge.type?Aje(Lt._f):ELe(Re),kn=Re.type===ite.BLUR||Re.type===ite.FOCUS_OUT,pn=!zot(Lt._f)&&!e.resolver&&!Gn(n.errors,tt)&&!Lt._f.deps||Uot(kn,Gn(n.touchedFields,tt),n.isSubmitted,kt,Dt),qn=Pje(tt,a,kn);go(o,tt,wn),kn?(Lt._f.onBlur&&Lt._f.onBlur(Re),h&&h(0)):Lt._f.onChange&&Lt._f.onChange(Re);const Fs=F(tt,wn,kn),_r=!eh(Fs)||qn;if(!kn&&w.state.next({name:tt,type:Re.type,values:Ic(o)}),pn)return(x.isValid||v.isValid)&&(e.mode==="onBlur"?kn&&S():kn||S()),_r&&w.state.next({name:tt,...qn?{}:Fs});if(!kn&&qn&&w.state.next({...n}),e.resolver){const{errors:js}=await W([tt]);if(Ot(wn),Et){const Ii=Lje(n.errors,s,tt),fi=Lje(js,s,Ii.name||tt);sr=fi.error,tt=fi.name,Pr=eh(js)}}else T([tt],!0),sr=(await Dje(Lt,a.disabled,o,k,e.shouldUseNativeValidation))[tt],T([tt]),Ot(wn),Et&&(sr?Pr=!1:(x.isValid||v.isValid)&&(Pr=await Z(s,!0)));Et&&(Lt._f.deps&&ve(Lt._f.deps),q(tt,Pr,sr,Fs))}},fe=(Re,Ge)=>{if(Gn(n.errors,Ge)&&Re.focus)return Re.focus(),1},ve=async(Re,Ge={})=>{let tt,Et;const Lt=XT(Re);if(e.resolver){const Ot=await K(tc(Re)?Re:Lt);tt=eh(Ot),Et=Re?!Lt.some(Dt=>Gn(Ot,Dt)):tt}else Re?(Et=(await Promise.all(Lt.map(async Ot=>{const Dt=Gn(s,Ot);return await Z(Dt&&Dt._f?{[Ot]:Dt}:Dt)}))).every(Boolean),!(!Et&&!n.isValid)&&S()):Et=tt=await Z(s);return w.state.next({...!sg(Re)||(x.isValid||v.isValid)&&tt!==n.isValid?{}:{name:Re},...e.resolver||!Re?{isValid:tt}:{},errors:n.errors}),Ge.shouldFocus&&!Et&&QT(s,fe,Re?Lt:a.mount),Et},Ie=Re=>{const Ge={...c.mount?o:i};return tc(Re)?Ge:sg(Re)?Gn(Ge,Re):Re.map(tt=>Gn(Ge,tt))},Se=(Re,Ge)=>({invalid:!!Gn((Ge||n).errors,Re),isDirty:!!Gn((Ge||n).dirtyFields,Re),error:Gn((Ge||n).errors,Re),isValidating:!!Gn(n.validatingFields,Re),isTouched:!!Gn((Ge||n).touchedFields,Re)}),oe=Re=>{Re&&XT(Re).forEach(Ge=>pc(n.errors,Ge)),w.state.next({errors:Re?n.errors:{}})},ae=(Re,Ge,tt)=>{const Et=(Gn(s,Re,{_f:{}})._f||{}).ref,Lt=Gn(n.errors,Re)||{},{ref:Ot,message:Dt,type:kt,...sr}=Lt;go(n.errors,Re,{...sr,...Ge,ref:Et}),w.state.next({name:Re,errors:n.errors,isValid:!1}),tt&&tt.shouldFocus&&Et&&Et.focus&&Et.focus()},Ne=(Re,Ge)=>Zp(Re)?w.state.subscribe({next:tt=>"values"in tt&&Re(ue(void 0,Ge),tt)}):ue(Re,Ge,!0),Te=Re=>w.state.subscribe({next:Ge=>{$ot(Re.name,Ge.name,Re.exact)&&Bot(Ge,Re.formState||x,Ve,Re.reRenderRoot)&&Re.callback({values:{...o},...n,...Ge,defaultValues:i})}}).unsubscribe,Be=Re=>(c.mount=!0,v={...v,...Re.formState},Te({...Re,formState:v})),Le=(Re,Ge={})=>{for(const tt of Re?XT(Re):a.mount)a.mount.delete(tt),a.array.delete(tt),Ge.keepValue||(pc(s,tt),pc(o,tt)),!Ge.keepError&&pc(n.errors,tt),!Ge.keepDirty&&pc(n.dirtyFields,tt),!Ge.keepTouched&&pc(n.touchedFields,tt),!Ge.keepIsValidating&&pc(n.validatingFields,tt),!e.shouldUnregister&&!Ge.keepDefaultValue&&pc(i,tt);w.state.next({values:Ic(o)}),w.state.next({...n,...Ge.keepDirty?{isDirty:he()}:{}}),!Ge.keepIsValid&&S()},Qe=({disabled:Re,name:Ge})=>{(Ph(Re)&&c.mount||Re||a.disabled.has(Ge))&&(Re?a.disabled.add(Ge):a.disabled.delete(Ge))},Fe=(Re,Ge={})=>{let tt=Gn(s,Re);const Et=Ph(Ge.disabled)||Ph(e.disabled);return go(s,Re,{...tt||{},_f:{...tt&&tt._f?tt._f:{ref:{name:Re}},name:Re,mount:!0,...Ge}}),a.mount.add(Re),tt?Qe({disabled:Ph(Ge.disabled)?Ge.disabled:e.disabled,name:Re}):$(Re,!0,Ge.value),{...Et?{disabled:Ge.disabled||e.disabled}:{},...e.progressive?{required:!!Ge.required,min:TM(Ge.min),max:TM(Ge.max),minLength:TM(Ge.minLength),maxLength:TM(Ge.maxLength),pattern:TM(Ge.pattern)}:{},name:Re,onChange:me,onBlur:me,ref:Lt=>{if(Lt){Fe(Re,Ge),tt=Gn(s,Re);const Ot=tc(Lt.value)&&Lt.querySelectorAll&&Lt.querySelectorAll("input,select,textarea")[0]||Lt,Dt=Lot(Ot),kt=tt._f.refs||[];if(Dt?kt.find(sr=>sr===Ot):Ot===tt._f.ref)return;go(s,Re,{_f:{...tt._f,...Dt?{refs:[...kt.filter(Dle),Ot,...Array.isArray(Gn(i,Re))?[{}]:[]],ref:{type:Ot.type,name:Re}}:{ref:Ot}}}),$(Re,!1,void 0,Ot)}else tt=Gn(s,Re,{}),tt._f&&(tt._f.mount=!1),(e.shouldUnregister||Ge.shouldUnregister)&&!(ILe(a.array,Re)&&c.action)&&a.unMount.add(Re)}}},Ce=()=>e.shouldFocusError&&QT(s,fe,a.mount),Je=Re=>{Ph(Re)&&(w.state.next({disabled:Re}),QT(s,(Ge,tt)=>{const Et=Gn(s,tt);Et&&(Ge.disabled=Et._f.disabled||Re,Array.isArray(Et._f.refs)&&Et._f.refs.forEach(Lt=>{Lt.disabled=Et._f.disabled||Re}))},0,!1))},Ae=(Re,Ge)=>async tt=>{let Et;tt&&(tt.preventDefault&&tt.preventDefault(),tt.persist&&tt.persist());let Lt=Ic(o);if(w.state.next({isSubmitting:!0}),e.resolver){const{errors:Ot,values:Dt}=await W();n.errors=Ot,Lt=Ic(Dt)}else await Z(s);if(a.disabled.size)for(const Ot of a.disabled)pc(Lt,Ot);if(pc(n.errors,"root"),eh(n.errors)){w.state.next({errors:{}});try{await Re(Lt,tt)}catch(Ot){Et=Ot}}else Ge&&await Ge({...n.errors},tt),Ce(),setTimeout(Ce);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:eh(n.errors)&&!Et,submitCount:n.submitCount+1,errors:n.errors}),Et)throw Et},Ye=(Re,Ge={})=>{Gn(s,Re)&&(tc(Ge.defaultValue)?ie(Re,Ic(Gn(i,Re))):(ie(Re,Ge.defaultValue),go(i,Re,Ic(Ge.defaultValue))),Ge.keepTouched||pc(n.touchedFields,Re),Ge.keepDirty||(pc(n.dirtyFields,Re),n.isDirty=Ge.defaultValue?he(Re,Ic(Gn(i,Re))):he()),Ge.keepError||(pc(n.errors,Re),x.isValid&&S()),w.state.next({...n}))},ge=(Re,Ge={})=>{const tt=Re?Ic(Re):i,Et=Ic(tt),Lt=eh(Re),Ot=Lt?i:Et;if(Ge.keepDefaultValues||(i=tt),!Ge.keepValues){if(Ge.keepDirtyValues){const Dt=new Set([...a.mount,...Object.keys(MM(i,o))]);for(const kt of Array.from(Dt))Gn(n.dirtyFields,kt)?go(Ot,kt,Gn(o,kt)):ie(kt,Gn(Ot,kt))}else{if(Rge&&tc(Re))for(const Dt of a.mount){const kt=Gn(s,Dt);if(kt&&kt._f){const sr=Array.isArray(kt._f.refs)?kt._f.refs[0]:kt._f.ref;if(ate(sr)){const Pr=sr.closest("form");if(Pr){Pr.reset();break}}}}if(Ge.keepFieldsRef)for(const Dt of a.mount)ie(Dt,Gn(Ot,Dt));else s={}}o=e.shouldUnregister?Ge.keepDefaultValues?Ic(i):{}:Ic(Ot),w.array.next({values:{...Ot}}),w.state.next({values:{...Ot}})}a={mount:Ge.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!x.isValid||!!Ge.keepIsValid||!!Ge.keepDirtyValues,c.watch=!!e.shouldUnregister,w.state.next({submitCount:Ge.keepSubmitCount?n.submitCount:0,isDirty:Lt?!1:Ge.keepDirty?n.isDirty:!!(Ge.keepDefaultValues&&!bx(Re,i)),isSubmitted:Ge.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Lt?{}:Ge.keepDirtyValues?Ge.keepDefaultValues&&o?MM(i,o):n.dirtyFields:Ge.keepDefaultValues&&Re?MM(i,Re):Ge.keepDirty?n.dirtyFields:{},touchedFields:Ge.keepTouched?n.touchedFields:{},errors:Ge.keepErrors?n.errors:{},isSubmitSuccessful:Ge.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},ft=(Re,Ge)=>ge(Zp(Re)?Re(o):Re,Ge),nt=(Re,Ge={})=>{const tt=Gn(s,Re),Et=tt&&tt._f;if(Et){const Lt=Et.refs?Et.refs[0]:Et.ref;Lt.focus&&(Lt.focus(),Ge.shouldSelect&&Zp(Lt.select)&&Lt.select())}},Ve=Re=>{n={...n,...Re}},rt={control:{register:Fe,unregister:Le,getFieldState:Se,handleSubmit:Ae,setError:ae,_subscribe:Te,_runSchema:W,_focusError:Ce,_getWatch:ue,_getDirty:he,_setValid:S,_setFieldArray:I,_setDisabledField:Qe,_setErrors:D,_getFieldArray:je,_reset:ge,_resetDefaultValues:()=>Zp(e.defaultValues)&&e.defaultValues().then(Re=>{ft(Re,e.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:Je,_subjects:w,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return c},set _state(Re){c=Re},get _defaultValues(){return i},get _names(){return a},set _names(Re){a=Re},get _formState(){return n},get _options(){return e},set _options(Re){e={...e,...Re}}},subscribe:Be,trigger:ve,register:Fe,handleSubmit:Ae,watch:Ne,setValue:ie,getValues:Ie,reset:ft,resetField:Ye,clearErrors:oe,unregister:Le,setError:ae,setFocus:nt,getFieldState:Se};return{...rt,formControl:rt}}function ese(t={}){const e=lt.useRef(void 0),n=lt.useRef(void 0),[s,i]=lt.useState({isDirty:!1,isValidating:!1,isLoading:Zp(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:Zp(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!Zp(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:c,...a}=Wot(t);e.current={...a,formState:s}}const o=e.current.control;return o._options=t,$ge(()=>{const c=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),o._formState.isReady=!0,c},[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 c=o._getDirty();c!==s.isDirty&&o._subjects.state.next({isDirty:c})}},[o,s.isDirty]),lt.useEffect(()=>{t.values&&!bx(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=t.values,i(c=>({...c}))):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()}),e.current.formState=PLe(s,o),e.current}const Rje=(t,e,n)=>{if(t&&"reportValidity"in t){const s=Gn(n,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},ULe=(t,e)=>{for(const n in e.fields){const s=e.fields[n];s&&s.ref&&"reportValidity"in s.ref?Rje(s.ref,n,t):s.refs&&s.refs.forEach(i=>Rje(i,n,t))}},Got=(t,e)=>{e.shouldUseNativeValidation&&ULe(t,e);const n={};for(const s in t){const i=Gn(e.fields,s),o=Object.assign(t[s]||{},{ref:i&&i.ref});if(Kot(e.names||Object.keys(t),s)){const c=Object.assign({},Gn(n,s));go(c,"root",o),go(n,s,c)}else go(n,s,o)}return n},Kot=(t,e)=>t.some(n=>n.startsWith(e+"."));var Zot=function(t,e){for(var n={};t.length;){var s=t[0],i=s.code,o=s.message,c=s.path.join(".");if(!n[c])if("unionErrors"in s){var a=s.unionErrors[0].errors[0];n[c]={message:a.message,type:a.code}}else n[c]={message:o,type:i};if("unionErrors"in s&&s.unionErrors.forEach(function(x){return x.errors.forEach(function(v){return t.push(v)})}),e){var h=n[c].types,m=h&&h[s.code];n[c]=OLe(c,e,n,i,m?[].concat(m,s.message):s.message)}t.shift()}return n},tse=function(t,e,n){return n===void 0&&(n={}),function(s,i,o){try{return Promise.resolve(function(c,a){try{var h=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(m){return o.shouldUseNativeValidation&&ULe({},o),{errors:{},values:n.raw?s:m}})}catch(m){return a(m)}return h&&h.then?h.then(void 0,a):h}(0,function(c){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(c))return{values:{},errors:Got(Zot(c.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw c}))}catch(c){return Promise.reject(c)}}};const rse=Tot,qLe=P.createContext({}),kl=({...t})=>r.jsx(qLe.Provider,{value:{name:t.name},children:r.jsx(Pot,{...t})}),nse=()=>{const t=P.useContext(qLe),e=P.useContext(VLe),{getFieldState:n,formState:s}=Jne(),i=n(t.name,s);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},VLe=P.createContext({}),pl=P.forwardRef(({className:t,...e},n)=>{const s=P.useId();return r.jsx(VLe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:$t("space-y-2",t),...e})})});pl.displayName="FormItem";const ml=P.forwardRef(({className:t,...e},n)=>{const{error:s,formItemId:i}=nse();return r.jsx(Xe,{ref:n,className:$t(s&&"text-destructive",t),htmlFor:i,...e})});ml.displayName="FormLabel";const gl=P.forwardRef(({...t},e)=>{const{error:n,formItemId:s,formDescriptionId:i,formMessageId:o}=nse();return r.jsx(Mme,{ref:e,id:s,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});gl.displayName="FormControl";const tee=P.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:s}=nse();return r.jsx("p",{ref:n,id:s,className:$t("text-sm text-muted-foreground",t),...e})});tee.displayName="FormDescription";const yu=P.forwardRef(({className:t,children:e,...n},s)=>{const{error:i,formMessageId:o}=nse(),c=i?String(i==null?void 0:i.message):e;return c?r.jsx("p",{ref:s,id:o,className:$t("text-sm font-medium text-destructive",t),...n,children:c}):null});yu.displayName="FormMessage";const gs=P.forwardRef(({className:t,...e},n)=>r.jsx("textarea",{className:$t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));gs.displayName="Textarea";const Yot=s5({category:e6e(["general","technology","crm","marketing"]),subject:ec().min(5,"Subject must be at least 5 characters").max(200),description:ec().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Xot={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function lhe({trigger:t}){const[e,n]=P.useState(!1),[s,i]=P.useState(!1),{user:o}=zr(),c=ese({resolver:tse(Yot),defaultValues:{category:"general",subject:"",description:""}}),a=async h=>{if(!o){He.error("You must be logged in to submit a ticket");return}i(!0);try{const{error:m}=await ee.from("support_tickets").insert({user_id:o.id,category:h.category,subject:h.subject,description:h.description});if(m)throw m;try{await ee.functions.invoke("support-ticket-notify",{body:{category:Xot[h.category],subject:h.subject}})}catch(x){console.log("Notification send attempted:",x)}He.success("Support ticket submitted successfully!"),c.reset(),n(!1)}catch(m){console.error("Error submitting ticket:",m),He.error("Failed to submit ticket. Please try again.")}finally{i(!1)}};return r.jsxs(Ur,{open:e,onOpenChange:n,children:[r.jsx(Oo,{asChild:!0,children:t||r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(AT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Br,{className:"sm:max-w-[500px]",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Need Help?"}),r.jsx(us,{children:"Submit a support ticket and we'll get back to you as soon as possible."})]}),r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg mb-4",children:[r.jsx(Ma,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["You can also text us at: ",r.jsx("span",{className:"font-medium text-foreground",children:"1-866-527-8668"})]})]}),r.jsx(rse,{...c,children:r.jsxs("form",{onSubmit:c.handleSubmit(a),className:"space-y-4",children:[r.jsx(kl,{control:c.control,name:"category",render:({field:h})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Category"}),r.jsxs(_n,{onValueChange:h.onChange,defaultValue:h.value,children:[r.jsx(gl,{children:r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select a category"})})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"general",children:"General Support"}),r.jsx(tr,{value:"technology",children:"Technology Support"}),r.jsx(tr,{value:"crm",children:"CRM Support"}),r.jsx(tr,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(yu,{})]})}),r.jsx(kl,{control:c.control,name:"subject",render:({field:h})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Subject"}),r.jsx(gl,{children:r.jsx(xt,{placeholder:"Brief description of your issue",...h})}),r.jsx(yu,{})]})}),r.jsx(kl,{control:c.control,name:"description",render:({field:h})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Description"}),r.jsx(gl,{children:r.jsx(gs,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...h})}),r.jsx(yu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function _s(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function yo(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function zl(t,e){const n=_s(t);return isNaN(e)?yo(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function Yf(t,e){const n=_s(t);if(isNaN(e))return yo(t,NaN);if(!e)return n;const s=n.getDate(),i=yo(t,n.getTime());i.setMonth(n.getMonth()+e+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}function HLe(t,e){const n=+_s(t);return yo(t,n+e)}const Vge=6048e5,Qot=864e5,WLe=6e4,GLe=36e5,Jot=1e3,uL=43200,Fje=1440;function che(t,e){return HLe(t,e*GLe)}let elt={};function U1(){return elt}function Xh(t,e){var a,h,m,x;const n=U1(),s=(e==null?void 0:e.weekStartsOn)??((h=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(m=n.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??0,i=_s(t),o=i.getDay(),c=(o=i.getTime()?n+1:e.getTime()>=c.getTime()?n:n-1}function Qh(t){const e=_s(t);return e.setHours(0,0,0,0),e}function A1(t){const e=_s(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function em(t,e){const n=Qh(t),s=Qh(e),i=+n-A1(n),o=+s-A1(s);return Math.round((i-o)/Qot)}function tlt(t){const e=KLe(t),n=yo(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Xx(n)}function rlt(t,e){return HLe(t,e*WLe)}function dhe(t,e){const n=e*7;return zl(t,n)}function nlt(t,e){return Yf(t,e*12)}function slt(t){let e;return t.forEach(function(n){const s=_s(n);(e===void 0||e{const s=_s(n);(!e||e>s||isNaN(+s))&&(e=s)}),e||new Date(NaN)}function ree(t,e){const n=_s(t),s=_s(e),i=n.getTime()-s.getTime();return i<0?-1:i>0?1:i}function alt(t){return yo(t,Date.now())}function Hl(t,e){const n=Qh(t),s=Qh(e);return+n==+s}function Hge(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function uhe(t){if(!Hge(t)&&typeof t!="number")return!1;const e=_s(t);return!isNaN(Number(e))}function lC(t,e){const n=_s(t),s=_s(e),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function olt(t,e,n){const s=Xh(t,n),i=Xh(e,n),o=+s-A1(s),c=+i-A1(i);return Math.round((o-c)/Vge)}function cC(t,e){const n=_s(t),s=_s(e),i=zje(n,s),o=Math.abs(em(n,s));n.setDate(n.getDate()-i*o);const c=+(zje(n,s)===-i),a=i*(o-c);return a===0?0:a}function zje(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function llt(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function clt(t,e){return+_s(t)-+_s(e)}function dlt(t){const e=_s(t);return e.setHours(23,59,59,999),e}function sse(t){const e=_s(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function ult(t){const e=_s(t);return+dlt(e)==+sse(e)}function hlt(t,e){const n=_s(t),s=_s(e),i=ree(n,s),o=Math.abs(lC(n,s));let c;if(o<1)c=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*o);let a=ree(n,s)===-i;ult(_s(t))&&o===1&&ree(t,s)===1&&(a=!1),c=i*(o-Number(a))}return c===0?0:c}function flt(t,e,n){const s=clt(t,e)/1e3;return llt(n==null?void 0:n.roundingMethod)(s)}function fh(t){const e=_s(t);return e.setDate(1),e.setHours(0,0,0,0),e}function ZLe(t){const e=_s(t),n=yo(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Wge(t,e){var a,h,m,x;const n=U1(),s=(e==null?void 0:e.weekStartsOn)??((h=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(m=n.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??0,i=_s(t),o=i.getDay(),c=(o{let s;const i=plt[t];return typeof i=="string"?s=i:e===1?s=i.one:s=i.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Rle(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const glt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xlt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ylt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vlt={date:Rle({formats:glt,defaultWidth:"full"}),time:Rle({formats:xlt,defaultWidth:"full"}),dateTime:Rle({formats:ylt,defaultWidth:"full"})},_lt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},blt=(t,e,n,s)=>_lt[t];function AM(t){return(e,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let i;if(s==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,a=n!=null&&n.width?String(n.width):c;i=t.formattingValues[a]||t.formattingValues[c]}else{const c=t.defaultWidth,a=n!=null&&n.width?String(n.width):t.defaultWidth;i=t.values[a]||t.values[c]}const o=t.argumentCallback?t.argumentCallback(e):e;return i[o]}}const wlt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},jlt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},klt={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"]},Nlt={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"]},Slt={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"}},Clt={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"}},Mlt=(t,e)=>{const n=Number(t),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Tlt={ordinalNumber:Mlt,era:AM({values:wlt,defaultWidth:"wide"}),quarter:AM({values:jlt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:AM({values:klt,defaultWidth:"wide"}),day:AM({values:Nlt,defaultWidth:"wide"}),dayPeriod:AM({values:Slt,defaultWidth:"wide",formattingValues:Clt,defaultFormattingWidth:"wide"})};function EM(t){return(e,n={})=>{const s=n.width,i=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;const c=o[0],a=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(a)?Elt(a,v=>v.test(c)):Alt(a,v=>v.test(c));let m;m=t.valueCallback?t.valueCallback(h):h,m=n.valueCallback?n.valueCallback(m):m;const x=e.slice(c.length);return{value:m,rest:x}}}function Alt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Elt(t,e){for(let n=0;n{const s=e.match(t.matchPattern);if(!s)return null;const i=s[0],o=e.match(t.parsePattern);if(!o)return null;let c=t.valueCallback?t.valueCallback(o[0]):o[0];c=n.valueCallback?n.valueCallback(c):c;const a=e.slice(i.length);return{value:c,rest:a}}}const Plt=/^(\d+)(th|st|nd|rd)?/i,Llt=/\d+/i,Olt={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},Dlt={any:[/^b/i,/^(a|c)/i]},Rlt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Flt={any:[/1/i,/2/i,/3/i,/4/i]},zlt={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},Blt={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]},$lt={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},Ult={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]},qlt={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},Vlt={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}},Hlt={ordinalNumber:Ilt({matchPattern:Plt,parsePattern:Llt,valueCallback:t=>parseInt(t,10)}),era:EM({matchPatterns:Olt,defaultMatchWidth:"wide",parsePatterns:Dlt,defaultParseWidth:"any"}),quarter:EM({matchPatterns:Rlt,defaultMatchWidth:"wide",parsePatterns:Flt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:EM({matchPatterns:zlt,defaultMatchWidth:"wide",parsePatterns:Blt,defaultParseWidth:"any"}),day:EM({matchPatterns:$lt,defaultMatchWidth:"wide",parsePatterns:Ult,defaultParseWidth:"any"}),dayPeriod:EM({matchPatterns:qlt,defaultMatchWidth:"any",parsePatterns:Vlt,defaultParseWidth:"any"})},ise={code:"en-US",formatDistance:mlt,formatLong:vlt,formatRelative:blt,localize:Tlt,match:Hlt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Wlt(t){const e=_s(t);return em(e,ZLe(e))+1}function Gge(t){const e=_s(t),n=+Xx(e)-+tlt(e);return Math.round(n/Vge)+1}function Kge(t,e){var x,v,w,k;const n=_s(t),s=n.getFullYear(),i=U1(),o=(e==null?void 0:e.firstWeekContainsDate)??((v=(x=e==null?void 0:e.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(w=i.locale)==null?void 0:w.options)==null?void 0:k.firstWeekContainsDate)??1,c=yo(t,0);c.setFullYear(s+1,0,o),c.setHours(0,0,0,0);const a=Xh(c,e),h=yo(t,0);h.setFullYear(s,0,o),h.setHours(0,0,0,0);const m=Xh(h,e);return n.getTime()>=a.getTime()?s+1:n.getTime()>=m.getTime()?s:s-1}function Glt(t,e){var a,h,m,x;const n=U1(),s=(e==null?void 0:e.firstWeekContainsDate)??((h=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(m=n.locale)==null?void 0:m.options)==null?void 0:x.firstWeekContainsDate)??1,i=Kge(t,e),o=yo(t,0);return o.setFullYear(i,0,s),o.setHours(0,0,0,0),Xh(o,e)}function Zge(t,e){const n=_s(t),s=+Xh(n,e)-+Glt(n,e);return Math.round(s/Vge)+1}function xo(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const Zy={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return xo(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):xo(n+1,2)},d(t,e){return xo(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return xo(t.getHours()%12||12,e.length)},H(t,e){return xo(t.getHours(),e.length)},m(t,e){return xo(t.getMinutes(),e.length)},s(t,e){return xo(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return xo(i,e.length)}},ZN={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Bje={G:function(t,e,n){const s=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const s=t.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return Zy.y(t,e)},Y:function(t,e,n,s){const i=Kge(t,s),o=i>0?i:1-i;if(e==="YY"){const c=o%100;return xo(c,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):xo(o,e.length)},R:function(t,e){const n=KLe(t);return xo(n,e.length)},u:function(t,e){const n=t.getFullYear();return xo(n,e.length)},Q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return xo(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return xo(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,e,n){const s=t.getMonth();switch(e){case"M":case"MM":return Zy.M(t,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(t,e,n){const s=t.getMonth();switch(e){case"L":return String(s+1);case"LL":return xo(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(t,e,n,s){const i=Zge(t,s);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):xo(i,e.length)},I:function(t,e,n){const s=Gge(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):xo(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Zy.d(t,e)},D:function(t,e,n){const s=Wlt(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):xo(s,e.length)},E:function(t,e,n){const s=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(t,e,n,s){const i=t.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return xo(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const i=t.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return xo(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),i=s===0?7:s;switch(e){case"i":return String(i);case"ii":return xo(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let i;switch(s===12?i=ZN.noon:s===0?i=ZN.midnight:i=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const s=t.getHours();let i;switch(s>=17?i=ZN.evening:s>=12?i=ZN.afternoon:s>=4?i=ZN.morning:i=ZN.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let s=t.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Zy.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Zy.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):xo(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):xo(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zy.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Zy.s(t,e)},S:function(t,e){return Zy.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return Uje(s);case"XXXX":case"XX":return dw(s);case"XXXXX":case"XXX":default:return dw(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return Uje(s);case"xxxx":case"xx":return dw(s);case"xxxxx":case"xxx":default:return dw(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+$je(s,":");case"OOOO":default:return"GMT"+dw(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+$je(s,":");case"zzzz":default:return"GMT"+dw(s,":")}},t:function(t,e,n){const s=Math.trunc(t.getTime()/1e3);return xo(s,e.length)},T:function(t,e,n){const s=t.getTime();return xo(s,e.length)}};function $je(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),i=Math.trunc(s/60),o=s%60;return o===0?n+String(i):n+String(i)+e+xo(o,2)}function Uje(t,e){return t%60===0?(t>0?"-":"+")+xo(Math.abs(t)/60,2):dw(t,e)}function dw(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),i=xo(Math.trunc(s/60),2),o=xo(s%60,2);return n+i+e+o}const qje=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},XLe=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Klt=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return qje(t,e);let o;switch(s){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;case"PPPP":default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",qje(s,e)).replace("{{time}}",XLe(i,e))},hhe={p:XLe,P:Klt},Zlt=/^D+$/,Ylt=/^Y+$/,Xlt=["D","DD","YY","YYYY"];function QLe(t){return Zlt.test(t)}function JLe(t){return Ylt.test(t)}function fhe(t,e,n){const s=Qlt(t,e,n);if(console.warn(s),Xlt.includes(t))throw new RangeError(s)}function Qlt(t,e,n){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Jlt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ect=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tct=/^'([^]*?)'?$/,rct=/''/g,nct=/[a-zA-Z]/;function un(t,e,n){var x,v,w,k,C,S,T,I;const s=U1(),i=(n==null?void 0:n.locale)??s.locale??ise,o=(n==null?void 0:n.firstWeekContainsDate)??((v=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:v.firstWeekContainsDate)??s.firstWeekContainsDate??((k=(w=s.locale)==null?void 0:w.options)==null?void 0:k.firstWeekContainsDate)??1,c=(n==null?void 0:n.weekStartsOn)??((S=(C=n==null?void 0:n.locale)==null?void 0:C.options)==null?void 0:S.weekStartsOn)??s.weekStartsOn??((I=(T=s.locale)==null?void 0:T.options)==null?void 0:I.weekStartsOn)??0,a=_s(t);if(!uhe(a))throw new RangeError("Invalid time value");let h=e.match(ect).map(A=>{const D=A[0];if(D==="p"||D==="P"){const $=hhe[D];return $(A,i.formatLong)}return A}).join("").match(Jlt).map(A=>{if(A==="''")return{isToken:!1,value:"'"};const D=A[0];if(D==="'")return{isToken:!1,value:sct(A)};if(Bje[D])return{isToken:!0,value:A};if(D.match(nct))throw new RangeError("Format string contains an unescaped latin alphabet character `"+D+"`");return{isToken:!1,value:A}});i.localize.preprocessor&&(h=i.localize.preprocessor(a,h));const m={firstWeekContainsDate:o,weekStartsOn:c,locale:i};return h.map(A=>{if(!A.isToken)return A.value;const D=A.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&JLe(D)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&QLe(D))&&fhe(D,e,String(t));const $=Bje[D[0]];return $(a,D,i.localize,m)}).join("")}function sct(t){const e=t.match(tct);return e?e[1].replace(rct,"'"):t}function ict(t,e,n){const s=U1(),i=(n==null?void 0:n.locale)??s.locale??ise,o=2520,c=ree(t,e);if(isNaN(c))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:c});let h,m;c>0?(h=_s(e),m=_s(t)):(h=_s(t),m=_s(e));const x=flt(m,h),v=(A1(m)-A1(h))/1e3,w=Math.round((x-v)/60);let k;if(w<2)return n!=null&&n.includeSeconds?x<5?i.formatDistance("lessThanXSeconds",5,a):x<10?i.formatDistance("lessThanXSeconds",10,a):x<20?i.formatDistance("lessThanXSeconds",20,a):x<40?i.formatDistance("halfAMinute",0,a):x<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):w===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",w,a);if(w<45)return i.formatDistance("xMinutes",w,a);if(w<90)return i.formatDistance("aboutXHours",1,a);if(ws.getTime()}function ase(t,e){const n=_s(t),s=_s(e);return+n<+s}function hct(t){return+_s(t)>Date.now()}function fct(t,e){const n=e instanceof Date?yo(e,0):new e(0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}const pct=10;class eOe{constructor(){Wn(this,"subPriority",0)}validate(e,n){return!0}}class mct extends eOe{constructor(e,n,s,i,o){super(),this.value=e,this.validateValue=n,this.setValue=s,this.priority=i,o&&(this.subPriority=o)}validate(e,n){return this.validateValue(e,this.value,n)}set(e,n,s){return this.setValue(e,n,this.value,s)}}class gct extends eOe{constructor(){super(...arguments);Wn(this,"priority",pct);Wn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:yo(n,fct(n,Date))}}class ao{run(e,n,s,i){const o=this.parse(e,n,s,i);return o?{setter:new mct(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,n,s){return!0}}class xct extends ao{constructor(){super(...arguments);Wn(this,"priority",140);Wn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,i){switch(s){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})||i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"})}}set(n,s,i){return s.era=i,n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}const sc={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}/},tg={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 ic(t,e){return t&&{value:e(t.value),rest:t.rest}}function Cl(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function rg(t,e){const n=e.match(t);if(!n)return null;if(n[0]==="Z")return{value:0,rest:e.slice(1)};const s=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,c=n[5]?parseInt(n[5],10):0;return{value:s*(i*GLe+o*WLe+c*Jot),rest:e.slice(n[0].length)}}function tOe(t){return Cl(sc.anyDigitsSigned,t)}function Kl(t,e){switch(t){case 1:return Cl(sc.singleDigit,e);case 2:return Cl(sc.twoDigits,e);case 3:return Cl(sc.threeDigits,e);case 4:return Cl(sc.fourDigits,e);default:return Cl(new RegExp("^\\d{1,"+t+"}"),e)}}function dte(t,e){switch(t){case 1:return Cl(sc.singleDigitSigned,e);case 2:return Cl(sc.twoDigitsSigned,e);case 3:return Cl(sc.threeDigitsSigned,e);case 4:return Cl(sc.fourDigitsSigned,e);default:return Cl(new RegExp("^-?\\d{1,"+t+"}"),e)}}function Yge(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 rOe(t,e){const n=e>0,s=n?e:1-e;let i;if(s<=50)i=t||100;else{const o=s+50,c=Math.trunc(o/100)*100,a=t>=o%100;i=t+c-(a?100:0)}return n?i:1-i}function nOe(t){return t%400===0||t%4===0&&t%100!==0}class yct extends ao{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,i){const o=c=>({year:c,isTwoDigitYear:s==="yy"});switch(s){case"y":return ic(Kl(4,n),o);case"yo":return ic(i.ordinalNumber(n,{unit:"year"}),o);default:return ic(Kl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i){const o=n.getFullYear();if(i.isTwoDigitYear){const a=rOe(i.year,o);return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}const c=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(c,0,1),n.setHours(0,0,0,0),n}}class vct extends ao{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,i){const o=c=>({year:c,isTwoDigitYear:s==="YY"});switch(s){case"Y":return ic(Kl(4,n),o);case"Yo":return ic(i.ordinalNumber(n,{unit:"year"}),o);default:return ic(Kl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i,o){const c=Kge(n,o);if(i.isTwoDigitYear){const h=rOe(i.year,c);return n.setFullYear(h,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Xh(n,o)}const a=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(a,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Xh(n,o)}}class _ct extends ao{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return dte(s==="R"?4:s.length,n)}set(n,s,i){const o=yo(n,0);return o.setFullYear(i,0,4),o.setHours(0,0,0,0),Xx(o)}}class bct extends ao{constructor(){super(...arguments);Wn(this,"priority",130);Wn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return dte(s==="u"?4:s.length,n)}set(n,s,i){return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class wct extends ao{constructor(){super(...arguments);Wn(this,"priority",120);Wn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"Q":case"QQ":return Kl(s.length,n);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})||i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class jct extends ao{constructor(){super(...arguments);Wn(this,"priority",120);Wn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"q":case"qq":return Kl(s.length,n);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})||i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class kct extends ao{constructor(){super(...arguments);Wn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Wn(this,"priority",110)}parse(n,s,i){const o=c=>c-1;switch(s){case"M":return ic(Cl(sc.month,n),o);case"MM":return ic(Kl(2,n),o);case"Mo":return ic(i.ordinalNumber(n,{unit:"month"}),o);case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})||i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}class Nct extends ao{constructor(){super(...arguments);Wn(this,"priority",110);Wn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,i){const o=c=>c-1;switch(s){case"L":return ic(Cl(sc.month,n),o);case"LL":return ic(Kl(2,n),o);case"Lo":return ic(i.ordinalNumber(n,{unit:"month"}),o);case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})||i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}function Sct(t,e,n){const s=_s(t),i=Zge(s,n)-e;return s.setDate(s.getDate()-i*7),s}class Cct extends ao{constructor(){super(...arguments);Wn(this,"priority",100);Wn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,i){switch(s){case"w":return Cl(sc.week,n);case"wo":return i.ordinalNumber(n,{unit:"week"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i,o){return Xh(Sct(n,i,o),o)}}function Mct(t,e){const n=_s(t),s=Gge(n)-e;return n.setDate(n.getDate()-s*7),n}class Tct extends ao{constructor(){super(...arguments);Wn(this,"priority",100);Wn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,i){switch(s){case"I":return Cl(sc.week,n);case"Io":return i.ordinalNumber(n,{unit:"week"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i){return Xx(Mct(n,i))}}const Act=[31,28,31,30,31,30,31,31,30,31,30,31],Ect=[31,29,31,30,31,30,31,31,30,31,30,31];class Ict extends ao{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"subPriority",1);Wn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"d":return Cl(sc.date,n);case"do":return i.ordinalNumber(n,{unit:"date"});default:return Kl(s.length,n)}}validate(n,s){const i=n.getFullYear(),o=nOe(i),c=n.getMonth();return o?s>=1&&s<=Ect[c]:s>=1&&s<=Act[c]}set(n,s,i){return n.setDate(i),n.setHours(0,0,0,0),n}}class Pct extends ao{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"subpriority",1);Wn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,i){switch(s){case"D":case"DD":return Cl(sc.dayOfYear,n);case"Do":return i.ordinalNumber(n,{unit:"date"});default:return Kl(s.length,n)}}validate(n,s){const i=n.getFullYear();return nOe(i)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,i){return n.setMonth(0,i),n.setHours(0,0,0,0),n}}function Xge(t,e,n){var v,w,k,C;const s=U1(),i=(n==null?void 0:n.weekStartsOn)??((w=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:w.weekStartsOn)??s.weekStartsOn??((C=(k=s.locale)==null?void 0:k.options)==null?void 0:C.weekStartsOn)??0,o=_s(t),c=o.getDay(),h=(e%7+7)%7,m=7-i,x=e<0||e>6?e-(c+m)%7:(h+m)%7-(c+m)%7;return zl(o,x)}class Lct extends ao{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Xge(n,i,o),n.setHours(0,0,0,0),n}}class Oct extends ao{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,i,o){const c=a=>{const h=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+h};switch(s){case"e":case"ee":return ic(Kl(s.length,n),c);case"eo":return ic(i.ordinalNumber(n,{unit:"day"}),c);case"eee":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Xge(n,i,o),n.setHours(0,0,0,0),n}}class Dct extends ao{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,i,o){const c=a=>{const h=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+h};switch(s){case"c":case"cc":return ic(Kl(s.length,n),c);case"co":return ic(i.ordinalNumber(n,{unit:"day"}),c);case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(n,{width:"wide",context:"standalone"})||i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=Xge(n,i,o),n.setHours(0,0,0,0),n}}function Rct(t,e){const n=_s(t),s=lct(n),i=e-s;return zl(n,i)}class Fct extends ao{constructor(){super(...arguments);Wn(this,"priority",90);Wn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,i){const o=c=>c===0?7:c;switch(s){case"i":case"ii":return Kl(s.length,n);case"io":return i.ordinalNumber(n,{unit:"day"});case"iii":return ic(i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return ic(i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return ic(i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return ic(i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,i){return n=Rct(n,i),n.setHours(0,0,0,0),n}}class zct extends ao{constructor(){super(...arguments);Wn(this,"priority",80);Wn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,i){switch(s){case"a":case"aa":case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Yge(i),0,0,0),n}}class Bct extends ao{constructor(){super(...arguments);Wn(this,"priority",80);Wn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,i){switch(s){case"b":case"bb":case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Yge(i),0,0,0),n}}class $ct extends ao{constructor(){super(...arguments);Wn(this,"priority",80);Wn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,i){switch(s){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(Yge(i),0,0,0),n}}class Uct extends ao{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,i){switch(s){case"h":return Cl(sc.hour12h,n);case"ho":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,i){const o=n.getHours()>=12;return o&&i<12?n.setHours(i+12,0,0,0):!o&&i===12?n.setHours(0,0,0,0):n.setHours(i,0,0,0),n}}class qct extends ao{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,i){switch(s){case"H":return Cl(sc.hour23h,n);case"Ho":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,i){return n.setHours(i,0,0,0),n}}class Vct extends ao{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,i){switch(s){case"K":return Cl(sc.hour11h,n);case"Ko":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.getHours()>=12&&i<12?n.setHours(i+12,0,0,0):n.setHours(i,0,0,0),n}}class Hct extends ao{constructor(){super(...arguments);Wn(this,"priority",70);Wn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,i){switch(s){case"k":return Cl(sc.hour24h,n);case"ko":return i.ordinalNumber(n,{unit:"hour"});default:return Kl(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,i){const o=i<=24?i%24:i;return n.setHours(o,0,0,0),n}}class Wct extends ao{constructor(){super(...arguments);Wn(this,"priority",60);Wn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"m":return Cl(sc.minute,n);case"mo":return i.ordinalNumber(n,{unit:"minute"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setMinutes(i,0,0),n}}class Gct extends ao{constructor(){super(...arguments);Wn(this,"priority",50);Wn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"s":return Cl(sc.second,n);case"so":return i.ordinalNumber(n,{unit:"second"});default:return Kl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setSeconds(i,0),n}}class Kct extends ao{constructor(){super(...arguments);Wn(this,"priority",30);Wn(this,"incompatibleTokens",["t","T"])}parse(n,s){const i=o=>Math.trunc(o*Math.pow(10,-s.length+3));return ic(Kl(s.length,n),i)}set(n,s,i){return n.setMilliseconds(i),n}}class Zct extends ao{constructor(){super(...arguments);Wn(this,"priority",10);Wn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return rg(tg.basicOptionalMinutes,n);case"XX":return rg(tg.basic,n);case"XXXX":return rg(tg.basicOptionalSeconds,n);case"XXXXX":return rg(tg.extendedOptionalSeconds,n);case"XXX":default:return rg(tg.extended,n)}}set(n,s,i){return s.timestampIsSet?n:yo(n,n.getTime()-A1(n)-i)}}class Yct extends ao{constructor(){super(...arguments);Wn(this,"priority",10);Wn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return rg(tg.basicOptionalMinutes,n);case"xx":return rg(tg.basic,n);case"xxxx":return rg(tg.basicOptionalSeconds,n);case"xxxxx":return rg(tg.extendedOptionalSeconds,n);case"xxx":default:return rg(tg.extended,n)}}set(n,s,i){return s.timestampIsSet?n:yo(n,n.getTime()-A1(n)-i)}}class Xct extends ao{constructor(){super(...arguments);Wn(this,"priority",40);Wn(this,"incompatibleTokens","*")}parse(n){return tOe(n)}set(n,s,i){return[yo(n,i*1e3),{timestampIsSet:!0}]}}class Qct extends ao{constructor(){super(...arguments);Wn(this,"priority",20);Wn(this,"incompatibleTokens","*")}parse(n){return tOe(n)}set(n,s,i){return[yo(n,i),{timestampIsSet:!0}]}}const Jct={G:new xct,y:new yct,Y:new vct,R:new _ct,u:new bct,Q:new wct,q:new jct,M:new kct,L:new Nct,w:new Cct,I:new Tct,d:new Ict,D:new Pct,E:new Lct,e:new Oct,c:new Dct,i:new Fct,a:new zct,b:new Bct,B:new $ct,h:new Uct,H:new qct,K:new Vct,k:new Hct,m:new Wct,s:new Gct,S:new Kct,X:new Zct,x:new Yct,t:new Xct,T:new Qct},edt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tdt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rdt=/^'([^]*?)'?$/,ndt=/''/g,sdt=/\S/,idt=/[a-zA-Z]/;function Qge(t,e,n,s){var S,T,I,A;const i=oct(),o=i.locale??ise,c=i.firstWeekContainsDate??((T=(S=i.locale)==null?void 0:S.options)==null?void 0:T.firstWeekContainsDate)??1,a=i.weekStartsOn??((A=(I=i.locale)==null?void 0:I.options)==null?void 0:A.weekStartsOn)??0;if(e==="")return t===""?_s(n):yo(n,NaN);const h={firstWeekContainsDate:c,weekStartsOn:a,locale:o},m=[new gct],x=e.match(tdt).map(D=>{const $=D[0];if($ in hhe){const F=hhe[$];return F(D,o.formatLong)}return D}).join("").match(edt),v=[];for(let D of x){JLe(D)&&fhe(D,e,t),QLe(D)&&fhe(D,e,t);const $=D[0],F=Jct[$];if(F){const{incompatibleTokens:q}=F;if(Array.isArray(q)){const K=v.find(Z=>q.includes(Z.token)||Z.token===$);if(K)throw new RangeError(`The format string mustn't contain \`${K.fullToken}\` and \`${D}\` at the same time`)}else if(F.incompatibleTokens==="*"&&v.length>0)throw new RangeError(`The format string mustn't contain \`${D}\` and any other token at the same time`);v.push({token:$,fullToken:D});const W=F.run(t,D,o.match,h);if(!W)return yo(n,NaN);m.push(W.setter),t=W.rest}else{if($.match(idt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");if(D==="''"?D="'":$==="'"&&(D=adt(D)),t.indexOf(D)===0)t=t.slice(D.length);else return yo(n,NaN)}}if(t.length>0&&sdt.test(t))return yo(n,NaN);const w=m.map(D=>D.priority).sort((D,$)=>$-D).filter((D,$,F)=>F.indexOf(D)===$).map(D=>m.filter($=>$.priority===D).sort(($,F)=>F.subPriority-$.subPriority)).map(D=>D[0]);let k=_s(n);if(isNaN(k.getTime()))return yo(n,NaN);const C={};for(const D of w){if(!D.validate(k,h))return yo(n,NaN);const $=D.set(k,C,h);Array.isArray($)?(k=$[0],Object.assign(C,$[1])):k=$}return yo(n,k)}function adt(t){return t.match(rdt)[1].replace(ndt,"'")}function odt(t){return+_s(t)o-c);return n>=s&&n<=i}function Fle(t,e){return zl(t,-e)}function zle(t,e){const n=_s(t),s=n.getFullYear(),i=n.getDate(),o=yo(t,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const c=act(o);return n.setMonth(e,Math.min(i,c)),n}function sOe(t,e){const n=_s(t);return n.setHours(e),n}function iOe(t,e){const n=_s(t);return n.setMinutes(e),n}function Wje(t,e){const n=_s(t);return isNaN(+n)?yo(t,NaN):(n.setFullYear(e),n)}function cdt(t,e){return Yf(t,-12)}const ddt=()=>{const{user:t}=zr(),e=ts(),[n,s]=P.useState([]),[i,o]=P.useState(0),[c,a]=P.useState(!1),[h,m]=P.useState(null);P.useEffect(()=>{if(!t)return;const C=`notification_last_read_${t.id}`;let S=h;if(!S){const A=localStorage.getItem(C);A&&(S=A,m(A))}(async()=>{const{data:A,error:D}=await ee.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!D&&A){s(A);const $=S?new Date(S):null,F=A.filter(q=>$?new Date(q.created_at)>$:!0);o(F.length)}})();const I=ee.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},A=>{const D=A.new;s(F=>[D,...F].slice(0,20));const $=S?new Date(S):null;(!$||new Date(D.created_at)>$)&&o(F=>F+1),Notification.permission==="granted"&&new Notification(D.title,{body:D.body,icon:"/favicon.ico"})}).subscribe();return()=>{ee.removeChannel(I)}},[t,h]);const x=C=>{const S=C.toLowerCase();return S.includes("community")||S.includes("post")?vl:S.includes("academy")||S.includes("video")?Wi:S.includes("template")?Yd:S.includes("event")?li:S.includes("newsletter")?Dx:S.includes("brokerage")?hh:S.includes("swag")||S.includes("social")?Ua:S.includes("toolbox")||S.includes("tool")?Fx:S.includes("brief")?As:vl},v=C=>{a(!1),C.url&&C.url!=="/"&&e(C.url)},w=()=>{if(!t)return;const C=new Date().toISOString(),S=`notification_last_read_${t.id}`;localStorage.setItem(S,C),m(C),o(0)},k=C=>{a(C),C&&i>0&&w()};return r.jsxs(xm,{open:c,onOpenChange:k,children:[r.jsx(ym,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(dg,{className:"h-5 w-5"}),i>0&&r.jsx(Ft,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:i>9?"9+":i})]})}),r.jsxs(ep,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(te,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:w,children:"Mark all read"})]}),r.jsx(_l,{className:"h-[300px]",children:n.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):n.map(C=>{const S=x(C.title);return r.jsxs(co,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>v(C),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(S,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm",children:C.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:C.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:Qd(new Date(C.created_at),{addSuffix:!0})})]})]},C.id)})})]})]})};var Gje=1,udt=.9,hdt=.8,fdt=.17,Ble=.1,$le=.999,pdt=.9999,mdt=.99,gdt=/[\\\/_+.#"@\[\(\{&]/,xdt=/[\\\/_+.#"@\[\(\{&]/g,ydt=/[\s-]/,aOe=/[\s-]/g;function phe(t,e,n,s,i,o,c){if(o===e.length)return i===t.length?Gje:mdt;var a=`${i},${o}`;if(c[a]!==void 0)return c[a];for(var h=s.charAt(o),m=n.indexOf(h,i),x=0,v,w,k,C;m>=0;)v=phe(t,e,n,s,m+1,o+1,c),v>x&&(m===i?v*=Gje:gdt.test(t.charAt(m-1))?(v*=hdt,k=t.slice(i,m-1).match(xdt),k&&i>0&&(v*=Math.pow($le,k.length))):ydt.test(t.charAt(m-1))?(v*=udt,C=t.slice(i,m-1).match(aOe),C&&i>0&&(v*=Math.pow($le,C.length))):(v*=fdt,i>0&&(v*=Math.pow($le,m-i))),t.charAt(m)!==e.charAt(o)&&(v*=pdt)),(vv&&(v=w*Ble)),v>x&&(x=v),m=n.indexOf(h,m+1);return c[a]=x,x}function Kje(t){return t.toLowerCase().replace(aOe," ")}function vdt(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,phe(t,e,Kje(t),Kje(e),0,0,{})}var IM='[cmdk-group=""]',Ule='[cmdk-group-items=""]',_dt='[cmdk-group-heading=""]',oOe='[cmdk-item=""]',Zje=`${oOe}:not([aria-disabled="true"])`,mhe="cmdk-item-select",dS="data-value",bdt=(t,e,n)=>vdt(t,e,n),lOe=P.createContext(void 0),gI=()=>P.useContext(lOe),cOe=P.createContext(void 0),exe=()=>P.useContext(cOe),dOe=P.createContext(void 0),uOe=P.forwardRef((t,e)=>{let n=uS(()=>{var oe,ae;return{search:"",value:(ae=(oe=t.value)!=null?oe:t.defaultValue)!=null?ae:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=uS(()=>new Set),i=uS(()=>new Map),o=uS(()=>new Map),c=uS(()=>new Set),a=hOe(t),{label:h,children:m,value:x,onValueChange:v,filter:w,shouldFilter:k,loop:C,disablePointerSelection:S=!1,vimBindings:T=!0,...I}=t,A=zc(),D=zc(),$=zc(),F=P.useRef(null),q=Idt();Cj(()=>{if(x!==void 0){let oe=x.trim();n.current.value=oe,W.emit()}},[x]),Cj(()=>{q(6,je)},[]);let W=P.useMemo(()=>({subscribe:oe=>(c.current.add(oe),()=>c.current.delete(oe)),snapshot:()=>n.current,setState:(oe,ae,Ne)=>{var Te,Be,Le,Qe;if(!Object.is(n.current[oe],ae)){if(n.current[oe]=ae,oe==="search")ue(),re(),q(1,he);else if(oe==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Fe=document.getElementById($);Fe?Fe.focus():(Te=document.getElementById(A))==null||Te.focus()}if(q(7,()=>{var Fe;n.current.selectedItemId=(Fe=ne())==null?void 0:Fe.id,W.emit()}),Ne||q(5,je),((Be=a.current)==null?void 0:Be.value)!==void 0){let Fe=ae??"";(Qe=(Le=a.current).onValueChange)==null||Qe.call(Le,Fe);return}}W.emit()}},emit:()=>{c.current.forEach(oe=>oe())}}),[]),K=P.useMemo(()=>({value:(oe,ae,Ne)=>{var Te;ae!==((Te=o.current.get(oe))==null?void 0:Te.value)&&(o.current.set(oe,{value:ae,keywords:Ne}),n.current.filtered.items.set(oe,Z(ae,Ne)),q(2,()=>{re(),W.emit()}))},item:(oe,ae)=>(s.current.add(oe),ae&&(i.current.has(ae)?i.current.get(ae).add(oe):i.current.set(ae,new Set([oe]))),q(3,()=>{ue(),re(),n.current.value||he(),W.emit()}),()=>{o.current.delete(oe),s.current.delete(oe),n.current.filtered.items.delete(oe);let Ne=ne();q(4,()=>{ue(),(Ne==null?void 0:Ne.getAttribute("id"))===oe&&he(),W.emit()})}),group:oe=>(i.current.has(oe)||i.current.set(oe,new Set),()=>{o.current.delete(oe),i.current.delete(oe)}),filter:()=>a.current.shouldFilter,label:h||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:A,inputId:$,labelId:D,listInnerRef:F}),[]);function Z(oe,ae){var Ne,Te;let Be=(Te=(Ne=a.current)==null?void 0:Ne.filter)!=null?Te:bdt;return oe?Be(oe,n.current.search,ae):0}function re(){if(!n.current.search||a.current.shouldFilter===!1)return;let oe=n.current.filtered.items,ae=[];n.current.filtered.groups.forEach(Te=>{let Be=i.current.get(Te),Le=0;Be.forEach(Qe=>{let Fe=oe.get(Qe);Le=Math.max(Fe,Le)}),ae.push([Te,Le])});let Ne=F.current;ye().sort((Te,Be)=>{var Le,Qe;let Fe=Te.getAttribute("id"),Ce=Be.getAttribute("id");return((Le=oe.get(Ce))!=null?Le:0)-((Qe=oe.get(Fe))!=null?Qe:0)}).forEach(Te=>{let Be=Te.closest(Ule);Be?Be.appendChild(Te.parentElement===Be?Te:Te.closest(`${Ule} > *`)):Ne.appendChild(Te.parentElement===Ne?Te:Te.closest(`${Ule} > *`))}),ae.sort((Te,Be)=>Be[1]-Te[1]).forEach(Te=>{var Be;let Le=(Be=F.current)==null?void 0:Be.querySelector(`${IM}[${dS}="${encodeURIComponent(Te[0])}"]`);Le==null||Le.parentElement.appendChild(Le)})}function he(){let oe=ye().find(Ne=>Ne.getAttribute("aria-disabled")!=="true"),ae=oe==null?void 0:oe.getAttribute(dS);W.setState("value",ae||void 0)}function ue(){var oe,ae,Ne,Te;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Be=0;for(let Le of s.current){let Qe=(ae=(oe=o.current.get(Le))==null?void 0:oe.value)!=null?ae:"",Fe=(Te=(Ne=o.current.get(Le))==null?void 0:Ne.keywords)!=null?Te:[],Ce=Z(Qe,Fe);n.current.filtered.items.set(Le,Ce),Ce>0&&Be++}for(let[Le,Qe]of i.current)for(let Fe of Qe)if(n.current.filtered.items.get(Fe)>0){n.current.filtered.groups.add(Le);break}n.current.filtered.count=Be}function je(){var oe,ae,Ne;let Te=ne();Te&&(((oe=Te.parentElement)==null?void 0:oe.firstChild)===Te&&((Ne=(ae=Te.closest(IM))==null?void 0:ae.querySelector(_dt))==null||Ne.scrollIntoView({block:"nearest"})),Te.scrollIntoView({block:"nearest"}))}function ne(){var oe;return(oe=F.current)==null?void 0:oe.querySelector(`${oOe}[aria-selected="true"]`)}function ye(){var oe;return Array.from(((oe=F.current)==null?void 0:oe.querySelectorAll(Zje))||[])}function ie(oe){let ae=ye()[oe];ae&&W.setState("value",ae.getAttribute(dS))}function me(oe){var ae;let Ne=ne(),Te=ye(),Be=Te.findIndex(Qe=>Qe===Ne),Le=Te[Be+oe];(ae=a.current)!=null&&ae.loop&&(Le=Be+oe<0?Te[Te.length-1]:Be+oe===Te.length?Te[0]:Te[Be+oe]),Le&&W.setState("value",Le.getAttribute(dS))}function fe(oe){let ae=ne(),Ne=ae==null?void 0:ae.closest(IM),Te;for(;Ne&&!Te;)Ne=oe>0?Adt(Ne,IM):Edt(Ne,IM),Te=Ne==null?void 0:Ne.querySelector(Zje);Te?W.setState("value",Te.getAttribute(dS)):me(oe)}let ve=()=>ie(ye().length-1),Ie=oe=>{oe.preventDefault(),oe.metaKey?ve():oe.altKey?fe(1):me(1)},Se=oe=>{oe.preventDefault(),oe.metaKey?ie(0):oe.altKey?fe(-1):me(-1)};return P.createElement(Dn.div,{ref:e,tabIndex:-1,...I,"cmdk-root":"",onKeyDown:oe=>{var ae;(ae=I.onKeyDown)==null||ae.call(I,oe);let Ne=oe.nativeEvent.isComposing||oe.keyCode===229;if(!(oe.defaultPrevented||Ne))switch(oe.key){case"n":case"j":{T&&oe.ctrlKey&&Ie(oe);break}case"ArrowDown":{Ie(oe);break}case"p":case"k":{T&&oe.ctrlKey&&Se(oe);break}case"ArrowUp":{Se(oe);break}case"Home":{oe.preventDefault(),ie(0);break}case"End":{oe.preventDefault(),ve();break}case"Enter":{oe.preventDefault();let Te=ne();if(Te){let Be=new Event(mhe);Te.dispatchEvent(Be)}}}}},P.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:Ldt},h),ose(t,oe=>P.createElement(cOe.Provider,{value:W},P.createElement(lOe.Provider,{value:K},oe))))}),wdt=P.forwardRef((t,e)=>{var n,s;let i=zc(),o=P.useRef(null),c=P.useContext(dOe),a=gI(),h=hOe(t),m=(s=(n=h.current)==null?void 0:n.forceMount)!=null?s:c==null?void 0:c.forceMount;Cj(()=>{if(!m)return a.item(i,c==null?void 0:c.id)},[m]);let x=fOe(i,o,[t.value,t.children,o],t.keywords),v=exe(),w=E1(q=>q.value&&q.value===x.current),k=E1(q=>m||a.filter()===!1?!0:q.search?q.filtered.items.get(i)>0:!0);P.useEffect(()=>{let q=o.current;if(!(!q||t.disabled))return q.addEventListener(mhe,C),()=>q.removeEventListener(mhe,C)},[k,t.onSelect,t.disabled]);function C(){var q,W;S(),(W=(q=h.current).onSelect)==null||W.call(q,x.current)}function S(){v.setState("value",x.current,!0)}if(!k)return null;let{disabled:T,value:I,onSelect:A,forceMount:D,keywords:$,...F}=t;return P.createElement(Dn.div,{ref:Kx(o,e),...F,id:i,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!w,"data-disabled":!!T,"data-selected":!!w,onPointerMove:T||a.getDisablePointerSelection()?void 0:S,onClick:T?void 0:C},t.children)}),jdt=P.forwardRef((t,e)=>{let{heading:n,children:s,forceMount:i,...o}=t,c=zc(),a=P.useRef(null),h=P.useRef(null),m=zc(),x=gI(),v=E1(k=>i||x.filter()===!1?!0:k.search?k.filtered.groups.has(c):!0);Cj(()=>x.group(c),[]),fOe(c,a,[t.value,t.heading,h]);let w=P.useMemo(()=>({id:c,forceMount:i}),[i]);return P.createElement(Dn.div,{ref:Kx(a,e),...o,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},n&&P.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:m},n),ose(t,k=>P.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},P.createElement(dOe.Provider,{value:w},k))))}),kdt=P.forwardRef((t,e)=>{let{alwaysRender:n,...s}=t,i=P.useRef(null),o=E1(c=>!c.search);return!n&&!o?null:P.createElement(Dn.div,{ref:Kx(i,e),...s,"cmdk-separator":"",role:"separator"})}),Ndt=P.forwardRef((t,e)=>{let{onValueChange:n,...s}=t,i=t.value!=null,o=exe(),c=E1(m=>m.search),a=E1(m=>m.selectedItemId),h=gI();return P.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),P.createElement(Dn.input,{ref:e,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":a,id:h.inputId,type:"text",value:i?t.value:c,onChange:m=>{i||o.setState("search",m.target.value),n==null||n(m.target.value)}})}),Sdt=P.forwardRef((t,e)=>{let{children:n,label:s="Suggestions",...i}=t,o=P.useRef(null),c=P.useRef(null),a=E1(m=>m.selectedItemId),h=gI();return P.useEffect(()=>{if(c.current&&o.current){let m=c.current,x=o.current,v,w=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let k=m.offsetHeight;x.style.setProperty("--cmdk-list-height",k.toFixed(1)+"px")})});return w.observe(m),()=>{cancelAnimationFrame(v),w.unobserve(m)}}},[]),P.createElement(Dn.div,{ref:Kx(o,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":s,id:h.listId},ose(t,m=>P.createElement("div",{ref:Kx(c,h.listInnerRef),"cmdk-list-sizer":""},m)))}),Cdt=P.forwardRef((t,e)=>{let{open:n,onOpenChange:s,overlayClassName:i,contentClassName:o,container:c,...a}=t;return P.createElement(Rne,{open:n,onOpenChange:s},P.createElement(Fne,{container:c},P.createElement(t5,{"cmdk-overlay":"",className:i}),P.createElement(r5,{"aria-label":t.label,"cmdk-dialog":"",className:o},P.createElement(uOe,{ref:e,...a}))))}),Mdt=P.forwardRef((t,e)=>E1(n=>n.filtered.count===0)?P.createElement(Dn.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Tdt=P.forwardRef((t,e)=>{let{progress:n,children:s,label:i="Loading...",...o}=t;return P.createElement(Dn.div,{ref:e,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ose(t,c=>P.createElement("div",{"aria-hidden":!0},c)))}),xh=Object.assign(uOe,{List:Sdt,Item:wdt,Input:Ndt,Group:jdt,Separator:kdt,Dialog:Cdt,Empty:Mdt,Loading:Tdt});function Adt(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Edt(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function hOe(t){let e=P.useRef(t);return Cj(()=>{e.current=t}),e}var Cj=typeof window>"u"?P.useEffect:P.useLayoutEffect;function uS(t){let e=P.useRef();return e.current===void 0&&(e.current=t()),e}function E1(t){let e=exe(),n=()=>t(e.snapshot());return P.useSyncExternalStore(e.subscribe,n,n)}function fOe(t,e,n,s=[]){let i=P.useRef(),o=gI();return Cj(()=>{var c;let a=(()=>{var m;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(m=x.current.textContent)==null?void 0:m.trim():i.current}})(),h=s.map(m=>m.trim());o.value(t,a,h),(c=e.current)==null||c.setAttribute(dS,a),i.current=a}),i}var Idt=()=>{let[t,e]=P.useState(),n=uS(()=>new Map);return Cj(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,i)=>{n.current.set(s,i),e({})}};function Pdt(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function ose({asChild:t,children:e},n){return t&&P.isValidElement(e)?P.cloneElement(Pdt(e),{ref:e.ref},n(e.props.children)):n(e)}var Ldt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Mj=P.forwardRef(({className:t,...e},n)=>r.jsx(xh,{ref:n,className:$t("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Mj.displayName=xh.displayName;const Odt=({children:t,...e})=>r.jsx(Ur,{...e,children:r.jsx(Br,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(Mj,{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})})}),Tj=P.forwardRef(({className:t,...e},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Ei,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(xh.Input,{ref:n,className:$t("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));Tj.displayName=xh.Input.displayName;const Aj=P.forwardRef(({className:t,...e},n)=>r.jsx(xh.List,{ref:n,className:$t("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));Aj.displayName=xh.List.displayName;const Ej=P.forwardRef((t,e)=>r.jsx(xh.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));Ej.displayName=xh.Empty.displayName;const Ij=P.forwardRef(({className:t,...e},n)=>r.jsx(xh.Group,{ref:n,className:$t("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));Ij.displayName=xh.Group.displayName;const Ddt=P.forwardRef(({className:t,...e},n)=>r.jsx(xh.Separator,{ref:n,className:$t("-mx-1 h-px bg-border",t),...e}));Ddt.displayName=xh.Separator.displayName;const Pj=P.forwardRef(({className:t,...e},n)=>r.jsx(xh.Item,{ref:n,className:$t("group relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-primary/80 data-[selected=true]:text-primary-foreground data-[disabled=true]:opacity-50",t),...e}));Pj.displayName=xh.Item.displayName;const Rdt={event:{label:"Events",icon:sm,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Yd,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:e1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:Fx,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:As,color:"bg-fuchsia-500/10 text-fuchsia-600"}},Yje=()=>{const[t,e]=P.useState(!1),[n,s]=P.useState(""),[i,o]=P.useState([]),[c,a]=P.useState(!1),h=ts();P.useEffect(()=>{const w=k=>{k.key==="k"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),e(C=>!C))};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[]);const m=P.useCallback(async w=>{if(!w.trim()){o([]);return}a(!0);const k=`%${w}%`;try{const[C,S,T,I,A]=await Promise.all([ee.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${k},description.ilike.${k}`).limit(5),ee.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${k},description.ilike.${k}`).limit(5),ee.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${k},description.ilike.${k}`).limit(5),ee.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${k},description.ilike.${k}`).limit(5),ee.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${k},description.ilike.${k}`).limit(5)]),D=[];C.data&&C.data.forEach($=>{D.push({id:$.id,title:$.title,description:$.description,type:"event",date:$.event_date,path:`/event/${$.id}`})}),S.data&&S.data.forEach($=>{D.push({id:$.id,title:$.name,description:$.description,type:"template",date:$.publish_date,path:`/templates/${$.id}`})}),T.data&&T.data.forEach($=>{D.push({id:$.id,title:$.title,description:$.description,type:"academy",date:$.publish_date,path:`/academy/${$.id}`})}),I.data&&I.data.forEach($=>{D.push({id:$.id,title:$.name,description:$.description,type:"toolbox",date:$.publish_date,path:`/toolbox/${$.id}`})}),A.data&&A.data.forEach($=>{D.push({id:$.id,title:$.title,description:$.description,type:"social-swag",date:$.publish_date,path:`/social-swag/${$.id}`})}),o(D)}catch(C){console.error("Search error:",C)}finally{a(!1)}},[]);P.useEffect(()=>{const w=setTimeout(()=>{m(n)},300);return()=>clearTimeout(w)},[n,m]);const x=w=>{e(!1),s(""),h(w)},v=i.reduce((w,k)=>(w[k.type]||(w[k.type]=[]),w[k.type].push(k),w),{});return r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-9 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>e(!0),children:[r.jsx(Ei,{className:"h-4 w-4 xl:mr-2"}),r.jsx("span",{className:"hidden xl:inline-flex text-muted-foreground text-sm",children:"Search..."}),r.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-1.5 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsxs(Odt,{open:t,onOpenChange:e,children:[r.jsx(Tj,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(Aj,{children:[c&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!c&&n&&i.length===0&&r.jsxs(Ej,{children:['No results found for "',n,'"']}),!c&&!n&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search across all content..."}),Object.entries(v).map(([w,k])=>{const C=Rdt[w],S=C.icon;return r.jsx(Ij,{heading:C.label,children:k.map(T=>r.jsxs(Pj,{value:`${T.type}-${T.id}-${T.title}`,onSelect:()=>x(T.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${C.color}`,children:r.jsx(S,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:T.title}),T.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:T.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Ft,{variant:"secondary",className:"text-xs",children:C.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Qd(new Date(T.date),{addSuffix:!0})})]})]},`${T.type}-${T.id}`))},w)})]})]})]})},Fdt=({expiresAt:t,className:e,showUpgradeButton:n=!0})=>{const[s,i]=P.useState(null),o=ts();if(P.useEffect(()=>{const m=()=>{const v=new Date().getTime(),k=new Date(t).getTime()-v;if(k<=0){i({days:0,hours:0,minutes:0});return}const C=Math.floor(k/(1e3*60*60*24)),S=Math.floor(k%(1e3*60*60*24)/(1e3*60*60)),T=Math.floor(k%(1e3*60*60)/(1e3*60));i({days:C,hours:S,minutes:T})};m();const x=setInterval(m,6e4);return()=>clearInterval(x)},[t]),!s)return null;const c=s.days===0&&s.hours===0&&s.minutes===0,a=s.days<=1,h=s.days<=3&&!a;return c?r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20",e),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Lh,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),n&&r.jsxs(te,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",a?"bg-destructive/10 border-destructive/20":h?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",e),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Gi,{className:$t("h-4 w-4",a?"text-destructive":h?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:$t("text-sm font-medium",a?"text-destructive":h?"text-amber-600":"text-primary"),children:"Free Trial:"}),r.jsxs("div",{className:"flex items-center gap-1",children:[s.days>0&&r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:$t("text-xs",a?"text-destructive/70":h?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(te,{size:"sm",onClick:()=>o("/subscription"),variant:a?"destructive":h?"default":"outline",className:$t("text-xs h-7 px-3",h&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},zdt=()=>{const t=ts();return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:r.jsxs(Ze,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:r.jsx(Lh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Xt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(In,{className:"text-base",children:"Your 7-day free trial has expired. Upgrade now to continue accessing all the powerful tools and resources LevelUp has to offer!"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(Ze,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(et,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(fs,{className:"h-6 w-6 text-primary"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Individual Agent"}),r.jsxs("p",{className:"text-2xl font-bold text-primary mb-2",children:["$39",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Perfect for solo agents ready to level up"}),r.jsxs(te,{className:"w-full",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(Ze,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(et,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-6 w-6 text-amber-600"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),r.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),r.jsxs(te,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(na,{className:"h-4 w-4 mr-2"}),"Choose Brokerage"]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"With a full membership, you'll get:"}),r.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground grid sm:grid-cols-2 gap-x-4",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Unlimited access to all marketing templates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Complete Academy training library"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," AI-powered tools and resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Community forums and support"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Exclusive member events and workshops"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Deal pipeline & scorecard tracking"]})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[r.jsx("p",{className:"text-sm font-medium text-center",children:"Questions? Contact us:"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Ma,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(oi,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Bdt=({hasUnseenBrief:t,onClick:e,className:n})=>r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"icon",onClick:e,className:$t("relative transition-colors",t&&"text-primary hover:text-primary",n),children:[r.jsx(om,{className:"h-5 w-5"}),t&&r.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-primary animate-pulse"})]})}),r.jsx(dm,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var lse="Checkbox",[$dt]=Zl(lse),[Udt,txe]=$dt(lse);function qdt(t){const{__scopeCheckbox:e,checked:n,children:s,defaultChecked:i,disabled:o,form:c,name:a,onCheckedChange:h,required:m,value:x="on",internal_do_not_use_render:v}=t,[w,k]=Eu({prop:n,defaultProp:i??!1,onChange:h,caller:lse}),[C,S]=P.useState(null),[T,I]=P.useState(null),A=P.useRef(!1),D=C?!!c||!!C.closest("form"):!0,$={checked:w,disabled:o,setChecked:k,control:C,setControl:S,name:a,form:c,value:x,hasConsumerStoppedPropagationRef:A,required:m,defaultChecked:m1(i)?!1:i,isFormControl:D,bubbleInput:T,setBubbleInput:I};return r.jsx(Udt,{scope:e,...$,children:Vdt(v)?v($):s})}var pOe="CheckboxTrigger",mOe=P.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...s},i)=>{const{control:o,value:c,disabled:a,checked:h,required:m,setControl:x,setChecked:v,hasConsumerStoppedPropagationRef:w,isFormControl:k,bubbleInput:C}=txe(pOe,t),S=Xs(i,x),T=P.useRef(h);return P.useEffect(()=>{const I=o==null?void 0:o.form;if(I){const A=()=>v(T.current);return I.addEventListener("reset",A),()=>I.removeEventListener("reset",A)}},[o,v]),r.jsx(Dn.button,{type:"button",role:"checkbox","aria-checked":m1(h)?"mixed":h,"aria-required":m,"data-state":_Oe(h),"data-disabled":a?"":void 0,disabled:a,value:c,...s,ref:S,onKeyDown:an(e,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:an(n,I=>{v(A=>m1(A)?!0:!A),C&&k&&(w.current=I.isPropagationStopped(),w.current||I.stopPropagation())})})});mOe.displayName=pOe;var rxe=P.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:s,checked:i,defaultChecked:o,required:c,disabled:a,value:h,onCheckedChange:m,form:x,...v}=t;return r.jsx(qdt,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:c,onCheckedChange:m,name:s,form:x,value:h,internal_do_not_use_render:({isFormControl:w})=>r.jsxs(r.Fragment,{children:[r.jsx(mOe,{...v,ref:e,__scopeCheckbox:n}),w&&r.jsx(vOe,{__scopeCheckbox:n})]})})});rxe.displayName=lse;var gOe="CheckboxIndicator",xOe=P.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:s,...i}=t,o=txe(gOe,n);return r.jsx(lc,{present:s||m1(o.checked)||o.checked===!0,children:r.jsx(Dn.span,{"data-state":_Oe(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});xOe.displayName=gOe;var yOe="CheckboxBubbleInput",vOe=P.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:c,required:a,disabled:h,name:m,value:x,form:v,bubbleInput:w,setBubbleInput:k}=txe(yOe,t),C=Xs(n,k),S=dI(o),T=eI(s);P.useEffect(()=>{const A=w;if(!A)return;const D=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(D,"checked").set,q=!i.current;if(S!==o&&F){const W=new Event("click",{bubbles:q});A.indeterminate=m1(o),F.call(A,m1(o)?!1:o),A.dispatchEvent(W)}},[w,S,o,i]);const I=P.useRef(m1(o)?!1:o);return r.jsx(Dn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??I.current,required:a,disabled:h,name:m,value:x,form:v,...e,tabIndex:-1,ref:C,style:{...e.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});vOe.displayName=yOe;function Vdt(t){return typeof t=="function"}function m1(t){return t==="indeterminate"}function _Oe(t){return m1(t)?"indeterminate":t?"checked":"unchecked"}const vc=P.forwardRef(({className:t,...e},n)=>r.jsx(rxe,{ref:n,className:$t("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:r.jsx(xOe,{className:$t("flex items-center justify-center text-current"),children:r.jsx($a,{className:"h-4 w-4"})})}));vc.displayName=rxe.displayName;var nxe="Radio",[Hdt,bOe]=Zl(nxe),[Wdt,Gdt]=Hdt(nxe),wOe=P.forwardRef((t,e)=>{const{__scopeRadio:n,name:s,checked:i=!1,required:o,disabled:c,value:a="on",onCheck:h,form:m,...x}=t,[v,w]=P.useState(null),k=Xs(e,T=>w(T)),C=P.useRef(!1),S=v?m||!!v.closest("form"):!0;return r.jsxs(Wdt,{scope:n,checked:i,disabled:c,children:[r.jsx(Dn.button,{type:"button",role:"radio","aria-checked":i,"data-state":SOe(i),"data-disabled":c?"":void 0,disabled:c,value:a,...x,ref:k,onClick:an(t.onClick,T=>{i||h==null||h(),S&&(C.current=T.isPropagationStopped(),C.current||T.stopPropagation())})}),S&&r.jsx(NOe,{control:v,bubbles:!C.current,name:s,value:a,checked:i,required:o,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});wOe.displayName=nxe;var jOe="RadioIndicator",kOe=P.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:s,...i}=t,o=Gdt(jOe,n);return r.jsx(lc,{present:s||o.checked,children:r.jsx(Dn.span,{"data-state":SOe(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});kOe.displayName=jOe;var Kdt="RadioBubbleInput",NOe=P.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:s=!0,...i},o)=>{const c=P.useRef(null),a=Xs(c,o),h=dI(n),m=eI(e);return P.useEffect(()=>{const x=c.current;if(!x)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set;if(h!==n&&k){const C=new Event("click",{bubbles:s});k.call(x,n),x.dispatchEvent(C)}},[h,n,s]),r.jsx(Dn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});NOe.displayName=Kdt;function SOe(t){return t?"checked":"unchecked"}var Zdt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],cse="RadioGroup",[Ydt]=Zl(cse,[i5,bOe]),COe=i5(),MOe=bOe(),[Xdt,Qdt]=Ydt(cse),TOe=P.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:s,defaultValue:i,value:o,required:c=!1,disabled:a=!1,orientation:h,dir:m,loop:x=!0,onValueChange:v,...w}=t,k=COe(n),C=Zj(m),[S,T]=Eu({prop:o,defaultProp:i??null,onChange:v,caller:cse});return r.jsx(Xdt,{scope:n,name:s,required:c,disabled:a,value:S,onValueChange:T,children:r.jsx(Nge,{asChild:!0,...k,orientation:h,dir:C,loop:x,children:r.jsx(Dn.div,{role:"radiogroup","aria-required":c,"aria-orientation":h,"data-disabled":a?"":void 0,dir:C,...w,ref:e})})})});TOe.displayName=cse;var AOe="RadioGroupItem",EOe=P.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:s,...i}=t,o=Qdt(AOe,n),c=o.disabled||s,a=COe(n),h=MOe(n),m=P.useRef(null),x=Xs(e,m),v=o.value===i.value,w=P.useRef(!1);return P.useEffect(()=>{const k=S=>{Zdt.includes(S.key)&&(w.current=!0)},C=()=>w.current=!1;return document.addEventListener("keydown",k),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",k),document.removeEventListener("keyup",C)}},[]),r.jsx(Sge,{asChild:!0,...a,focusable:!c,active:v,children:r.jsx(wOe,{disabled:c,required:o.required,checked:v,...h,...i,name:o.name,ref:x,onCheck:()=>o.onValueChange(i.value),onKeyDown:an(k=>{k.key==="Enter"&&k.preventDefault()}),onFocus:an(i.onFocus,()=>{var k;w.current&&((k=m.current)==null||k.click())})})})});EOe.displayName=AOe;var Jdt="RadioGroupIndicator",IOe=P.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...s}=t,i=MOe(n);return r.jsx(kOe,{...i,...s,ref:e})});IOe.displayName=Jdt;var POe=TOe,LOe=EOe,eut=IOe;const OOe=P.forwardRef(({className:t,...e},n)=>r.jsx(POe,{className:$t("grid gap-2",t),...e,ref:n}));OOe.displayName=POe.displayName;const DOe=P.forwardRef(({className:t,...e},n)=>r.jsx(LOe,{ref:n,className:$t("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:r.jsx(eut,{className:"flex items-center justify-center",children:r.jsx(Au,{className:"h-2.5 w-2.5 fill-current text-current"})})}));DOe.displayName=LOe.displayName;const tut=({brief:t,open:e,onClose:n,onDismiss:s})=>{const{user:i}=zr(),[o,c]=P.useState({}),[a,h]=P.useState({}),[m,x]=P.useState([]);P.useEffect(()=>{e&&i&&t.polls.length>0&&v()},[e,i,t.polls]);const v=async()=>{if(!i)return;const T=t.polls.map(A=>A.id),{data:I}=await ee.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",i.id).in("poll_id",T);if(I){const A={};I.forEach(D=>{A[D.poll_id]||(A[D.poll_id]=[]),A[D.poll_id].push(D.option_id)}),h(A)}},w=(T,I)=>{c(A=>({...A,[T]:I}))},k=(T,I,A)=>{c(D=>{const $=D[T]||[];return A?{...D,[T]:[...$,I]}:{...D,[T]:$.filter(F=>F!==I)}})},C=async T=>{if(!i)return;const I=o[T];if(!I||Array.isArray(I)&&I.length===0){He.error("Please select an option");return}x(A=>[...A,T]);try{await ee.from("levelup_brief_poll_responses").delete().eq("poll_id",T).eq("user_id",i.id);const A=Array.isArray(I)?I:[I],D=A.map(F=>({poll_id:T,option_id:F,user_id:i.id})),{error:$}=await ee.from("levelup_brief_poll_responses").insert(D);if($)throw $;h(F=>({...F,[T]:A})),He.success("Response submitted!")}catch(A){console.error("Error submitting poll response:",A),He.error("Failed to submit response")}finally{x(A=>A.filter(D=>D!==T))}},S=T=>(T.includes("mediadelivery.net")||T.includes("bunny"),T);return r.jsx(Ur,{open:e,onOpenChange:T=>!T&&n(),children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 text-primary-foreground",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:r.jsx(om,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Ft,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(Zr,{className:"text-xl font-bold text-white",children:t.brief.title})]})]})}),r.jsx(_l,{className:"max-h-[calc(90vh-180px)]",children:r.jsxs("div",{className:"p-6 space-y-6",children:[t.brief.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.brief.description}}),t.brief.video_url&&r.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:S(t.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),t.links.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:"Quick Links"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:t.links.map(T=>r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>window.open(T.url,"_blank"),className:"gap-2",children:[r.jsx($s,{className:"h-4 w-4"}),T.title]},T.id))})]}),t.polls.map(T=>{var D,$;const I=((D=a[T.id])==null?void 0:D.length)>0,A=m.includes(T.id);return r.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:T.question}),I&&r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Ha,{className:"h-3 w-3"}),"Responded"]})]}),T.poll_type==="single"?r.jsx(OOe,{value:o[T.id]||(($=a[T.id])==null?void 0:$[0])||"",onValueChange:F=>w(T.id,F),className:"space-y-2",children:T.options.map(F=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(DOe,{value:F.id,id:F.id}),r.jsx(Xe,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id))}):r.jsx("div",{className:"space-y-2",children:T.options.map(F=>{const W=(o[T.id]||a[T.id]||[]).includes(F.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vc,{id:F.id,checked:W,onCheckedChange:K=>k(T.id,F.id,K)}),r.jsx(Xe,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id)})}),r.jsx(te,{size:"sm",onClick:()=>C(T.id),disabled:A,children:A?"Submitting...":I?"Update Response":"Submit"})]},T.id)})]})}),r.jsxs("div",{className:"p-4 border-t bg-muted/30 flex justify-between items-center",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"}),r.jsx(te,{onClick:n,children:"Got it!"})]})]})})},rut=()=>{const{user:t}=zr(),[e,n]=P.useState(null),[s,i]=P.useState(!1),[o,c]=P.useState(!0),[a,h]=P.useState(!1),m=P.useCallback(async()=>{if(!t){c(!1);return}try{const{data:C,error:S}=await ee.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(S||!C){c(!1);return}const{data:T}=await ee.from("levelup_brief_views").select("*").eq("brief_id",C.id).eq("user_id",t.id).maybeSingle(),[I,A]=await Promise.all([ee.from("levelup_brief_links").select("*").eq("brief_id",C.id).order("sort_order"),ee.from("levelup_brief_polls").select("*").eq("brief_id",C.id).order("sort_order")]),D=[];if(A.data)for(const W of A.data){const{data:K}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",W.id).order("sort_order");D.push({...W,options:K||[]})}const $={brief:C,links:I.data||[],polls:D};n($);const F=!!T,q=(T==null?void 0:T.dismissed_at)!==null;if(!F)i(!0),h(!0);else if(C.show_frequency==="every_login"&&!q)i(!0),h(!0);else if(C.show_frequency==="daily"){const W=new Date(T.viewed_at);(new Date().getTime()-W.getTime())/(1e3*60*60)>=24&&!q&&(i(!0),h(!0))}else h(!q)}catch(C){console.error("Error fetching brief:",C)}finally{c(!1)}},[t]);P.useEffect(()=>{m()},[m]);const x=async()=>{if(!(!t||!e))try{const{data:C}=await ee.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await ee.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",C.id):await ee.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id})}catch(C){console.error("Error marking brief as viewed:",C)}};return{currentBrief:e,shouldShowPopup:s,hasUnseenBrief:a,loading:o,openBrief:()=>{i(!0)},closeBrief:()=>{i(!1),x()},dismissBrief:async()=>{if(!(!t||!e))try{const{data:C}=await ee.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await ee.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",C.id):await ee.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id,dismissed_at:new Date().toISOString()}),i(!1),h(!1)}catch(C){console.error("Error dismissing brief:",C)}},refetch:m}};function nut(){const[t,e]=P.useState(!1),[n,s]=P.useState(!1),[i,o]=P.useState(null);P.useEffect(()=>{if(localStorage.getItem("install-banner-dismissed")||window.matchMedia("(display-mode: standalone)").matches||!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent))return;const v=/iPhone|iPad|iPod/i.test(navigator.userAgent);s(v),e(!0);const w=k=>{k.preventDefault(),o(k)};return window.addEventListener("beforeinstallprompt",w),()=>{window.removeEventListener("beforeinstallprompt",w)}},[]);const c=()=>{localStorage.setItem("install-banner-dismissed","true"),e(!1)},a=async()=>{if(i){await i.prompt();const{outcome:h}=await i.userChoice;h==="accepted"&&c(),o(null)}};return t?r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 p-4 bg-primary text-primary-foreground shadow-lg animate-in slide-in-from-bottom duration-300",children:r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"flex-shrink-0 p-2 bg-primary-foreground/10 rounded-full",children:r.jsx(Mo,{className:"h-5 w-5"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Add LevelUp to your home screen"}),n?r.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",r.jsx(DT,{className:"h-3 w-3 inline"}),' then "Add to Home Screen"']}):r.jsx("p",{className:"text-xs opacity-80",children:"Quick access anytime"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!n&&i&&r.jsx(te,{size:"sm",variant:"secondary",onClick:a,className:"text-xs",children:"Install"}),r.jsx("button",{onClick:c,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(Es,{className:"h-4 w-4"})})]})]})}):null}const sut=({children:t,onRefresh:e})=>{const[n,s]=P.useState(!1),[i,o]=P.useState(0),[c,a]=P.useState(!1),h=P.useRef(null),m=P.useRef(0),x=Qr(),v=80,w=120,k=P.useCallback(A=>{const D=h.current;D&&D.scrollTop<=0&&(m.current=A.touches[0].clientY,s(!0))},[]),C=P.useCallback(A=>{if(!n||c)return;const D=h.current;if(!D||D.scrollTop>0){s(!1),o(0);return}const F=A.touches[0].clientY-m.current;if(F>0){const W=Math.min(F*.5,w);o(W),W>10&&A.preventDefault()}},[n,c]),S=P.useCallback(async()=>{if(n)if(s(!1),i>=v&&!c){a(!0),o(v);try{e?await e():await x.invalidateQueries()}catch(A){console.error("Refresh failed:",A)}finally{a(!1),o(0)}}else o(0)},[n,i,c,e,x]),T=Math.min(i/v,1),I=T*180;return r.jsxs("div",{ref:h,className:"h-full overflow-auto",onTouchStart:k,onTouchMove:C,onTouchEnd:S,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:i>0?i:0,opacity:T},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${c?"animate-spin":""}`,style:{transform:c?void 0:`rotate(${I}deg)`,transition:c?void 0:"transform 0.1s ease-out"},children:r.jsx(Fl,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:i>0?`translateY(${Math.max(0,i-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:t})]})},ROe=()=>{const{user:t}=zr(),[e,n]=P.useState(!1),[s,i]=P.useState(!1),[o,c]=P.useState(0),[a,h]=P.useState(!0);P.useEffect(()=>{(async()=>{if(!t){h(!1);return}try{const{data:k}=await ee.from("membership_reviews").select("id").eq("user_id",t.id).maybeSingle();if(k){i(!0),n(!1),h(!1);return}const{data:C}=await ee.from("profiles").select("login_count").eq("id",t.id).single(),S=(C==null?void 0:C.login_count)||0;c(S);const T=sessionStorage.getItem("review-prompt-dismissed");n(S>=4&&!T)}catch(k){console.error("Error checking review eligibility:",k)}finally{h(!1)}})()},[t]);const m=P.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=P.useCallback(async(w,k)=>{if(!t)return{success:!1,error:"Not authenticated"};try{const{error:C}=await ee.from("membership_reviews").insert({user_id:t.id,rating:w,review_text:k});if(C)throw C;const{data:S,error:T}=await ee.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",t.id).maybeSingle();T&&console.error("Error fetching current stats:",T);const I=(S==null?void 0:S.spendable_points)||0,A=(S==null?void 0:S.total_points)||0,D=I+25,$=A+25,{error:F}=await ee.from("agent_attendance_stats").upsert({user_id:t.id,total_points:$,spendable_points:D,updated_at:new Date().toISOString()},{onConflict:"user_id"});F&&console.error("Error upserting attendance stats:",F);const{error:q}=await ee.from("agent_points").insert({user_id:t.id,points:25,reason:"Left a membership review"});return q&&console.error("Error logging points:",q),i(!0),n(!1),{success:!0,pointsAwarded:25}}catch(C){return console.error("Error submitting review:",C),{success:!1,error:C.message}}},[t]),v=P.useCallback(async()=>{if(t)try{await ee.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",t.id)}catch(w){console.error("Error updating Google review status:",w)}},[t]);return{shouldShowPrompt:e,hasSubmittedReview:s,loginCount:o,isLoading:a,dismissPrompt:m,submitReview:x,markPostedToGoogle:v}},iut="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",aut=()=>{const{shouldShowPrompt:t,isLoading:e,dismissPrompt:n,submitReview:s,markPostedToGoogle:i}=ROe(),[o,c]=P.useState(!1),[a,h]=P.useState("review"),[m,x]=P.useState(0),[v,w]=P.useState(0),[k,C]=P.useState(""),[S,T]=P.useState(!1),[I,A]=P.useState(!1);if(e||!t&&!I)return null;const D=async()=>{if(m===0){Yi({title:"Please select a rating",variant:"destructive"});return}T(!0);const q=await s(m,k);T(!1),q.success?(A(!0),Yi({title:"Thank you for your feedback!",description:"Your review helps us improve."}),h("google")):Yi({title:"Error submitting review",description:q.error,variant:"destructive"})},$=async q=>{q&&(await navigator.clipboard.writeText(k||`${m} star rating for LevelUp!`),Yi({title:"Review copied!",description:"Paste it on Google Reviews."}),await i(),window.open(iut,"_blank")),c(!1),n()},F=()=>{c(!1),n()};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>c(!0),className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-40 flex items-center gap-2 rounded-full bg-primary/90 px-3 py-2 text-xs text-primary-foreground shadow-lg backdrop-blur-sm transition-all hover:bg-primary hover:scale-105 md:bottom-6",children:[r.jsx(Bs,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Ur,{open:o,onOpenChange:F,children:r.jsx(Br,{className:"sm:max-w-md",children:a==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(us,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(q=>r.jsx("button",{type:"button",onClick:()=>x(q),onMouseEnter:()=>w(q),onMouseLeave:()=>w(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(Bs,{className:$t("h-8 w-8 transition-colors",(v||m)>=q?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},q))}),r.jsx(gs,{placeholder:"Tell us about your experience (optional)",value:k,onChange:q=>C(q.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",onClick:F,className:"flex-1",children:"Maybe Later"}),r.jsx(te,{onClick:D,disabled:S||m===0,className:"flex-1",children:S?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(us,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>$(!1),className:"flex-1",children:"No Thanks"}),r.jsx(te,{onClick:()=>$(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function out(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),i=new Uint8Array(s.length);for(let o=0;o{if(!v){c(!1);return}(async()=>{try{const{data:S,error:T}=await ee.functions.invoke("get-vapid-public-key",{body:{}});if(T)throw T;const I=S==null?void 0:S.vapidPublicKey;if(!I)throw new Error("Missing VAPID public key");x(I);const A=await navigator.serviceWorker.register("/push-sw.js");h(A),n(Notification.permission);const D=await A.pushManager.getSubscription();i(!!D)}catch(S){console.error("Error initializing push notifications:",S)}finally{c(!1)}})()},[v]);const w=P.useCallback(async()=>{if(!v||!a||!t)return console.error("Push notifications not supported or user not logged in"),!1;if(!m)return He.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{c(!0);const C=await a.pushManager.getSubscription();if(C){try{await C.unsubscribe()}catch($){console.warn("Failed to unsubscribe existing push subscription:",$)}const{error:D}=await ee.from("push_subscriptions").delete().eq("user_id",t.id);D&&console.warn("Failed to cleanup push_subscriptions rows:",D)}if(Notification.permission!=="granted"){const D=await Notification.requestPermission();if(n(D),D!=="granted")return D==="denied"?He.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):He.error("Notification permission was dismissed. Please try again."),!1}const S=out(m);let T;try{T=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:S})}catch(D){console.error("PushManager.subscribe() failed:",D);const $=(D==null?void 0:D.message)||String(D);return $.includes("permission")?He.error("Push permission denied. Check your browser notification settings."):$.includes("key")||$.includes("VAPID")?He.error("Push configuration error. Please contact support."):$.includes("AbortError")?He.error("Push subscription was cancelled. Please try again."):He.error(`Failed to subscribe: ${$}`),!1}const I=T.toJSON(),{error:A}=await ee.from("push_subscriptions").upsert({user_id:t.id,endpoint:I.endpoint,p256dh_key:I.keys.p256dh,auth_key:I.keys.auth},{onConflict:"user_id,endpoint"});if(A)throw console.error("Error saving subscription:",A),He.error("Failed to save notification preferences. Please try again."),A;return i(!0),He.success("Push notifications enabled!"),!0}catch(C){if(console.error("Error subscribing to push notifications:",C),!(C instanceof Error&&C.message.includes("toast"))){const S=C instanceof Error?C.message:"Unknown error";He.error("Failed to enable push notifications: "+S)}return!1}finally{c(!1)}},[v,a,t,m]),k=P.useCallback(async()=>{if(!a||!t)return!1;try{c(!0);const C=await a.pushManager.getSubscription();return C&&await C.unsubscribe(),await ee.from("push_subscriptions").delete().eq("user_id",t.id),i(!1),He.success("Push notifications disabled"),!0}catch(C){console.error("Error unsubscribing:",C);const S=C instanceof Error?C.message:"Unknown error";return He.error("Failed to disable push notifications: "+S),!1}finally{c(!1)}},[a,t]);return{isSupported:v,permission:e,isSubscribed:s,isLoading:o,vapidPublicKey:m,subscribe:w,unsubscribe:k}}const Xje="push_notification_prompt_dismissed",lut=()=>{const{user:t}=zr(),{isSupported:e,isSubscribed:n,isLoading:s,subscribe:i}=FOe(),[o,c]=P.useState(!1),[a,h]=P.useState(!1);P.useEffect(()=>{if(!t||!e||n||s||localStorage.getItem(`${Xje}_${t.id}`))return;const w=setTimeout(()=>{c(!0)},2e3);return()=>clearTimeout(w)},[t,e,n,s]);const m=async()=>{h(!0);const v=await i();h(!1),v&&c(!1)},x=()=>{t&&localStorage.setItem(`${Xje}_${t.id}`,"true"),c(!1)};return!e||n?null:r.jsx(Ur,{open:o,onOpenChange:v=>!v&&x(),children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(dg,{className:"h-6 w-6 text-primary"})}),r.jsx(Zr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(us,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),r.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(te,{onClick:m,disabled:a,className:"w-full",children:a?"Enabling...":"Enable Notifications"}),r.jsx(te,{variant:"ghost",onClick:x,className:"w-full",children:"Not Now"})]}),r.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can always change this in your Profile settings."})]})})},Qje=t=>{let e;const n=new Set,s=(m,x)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const w=e;e=x??(typeof v!="object"||v===null)?v:Object.assign({},e,v),n.forEach(k=>k(e,w))}},i=()=>e,a={setState:s,getState:i,getInitialState:()=>h,subscribe:m=>(n.add(m),()=>n.delete(m))},h=e=t(s,i,a);return a},cut=t=>t?Qje(t):Qje,dut=t=>t;function uut(t,e=dut){const n=lt.useSyncExternalStore(t.subscribe,lt.useCallback(()=>e(t.getState()),[t,e]),lt.useCallback(()=>e(t.getInitialState()),[t,e]));return lt.useDebugValue(n),n}const hut=t=>{const e=cut(t),n=s=>uut(e,s);return Object.assign(n,e),n},fut=t=>hut;function put(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var o;const c=h=>h===null?null:JSON.parse(h,void 0),a=(o=n.getItem(i))!=null?o:null;return a instanceof Promise?a.then(c):c(a)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const ghe=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return ghe(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return ghe(s)(n)}}}},mut=(t,e)=>(n,s,i)=>{let o={storage:put(()=>localStorage),partialize:S=>S,version:0,merge:(S,T)=>({...T,...S}),...e},c=!1;const a=new Set,h=new Set;let m=o.storage;if(!m)return t((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...S)},s,i);const x=()=>{const S=o.partialize({...s()});return m.setItem(o.name,{state:S,version:o.version})},v=i.setState;i.setState=(S,T)=>(v(S,T),x());const w=t((...S)=>(n(...S),x()),s,i);i.getInitialState=()=>w;let k;const C=()=>{var S,T;if(!m)return;c=!1,a.forEach(A=>{var D;return A((D=s())!=null?D:w)});const I=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(S=s())!=null?S:w))||void 0;return ghe(m.getItem.bind(m))(o.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==o.version){if(o.migrate){const D=o.migrate(A.state,A.version);return D instanceof Promise?D.then($=>[!0,$]):[!0,D]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var D;const[$,F]=A;if(k=o.merge(F,(D=s())!=null?D:w),n(k,!0),$)return x()}).then(()=>{I==null||I(k,void 0),k=s(),c=!0,h.forEach(A=>A(k))}).catch(A=>{I==null||I(void 0,A)})};return i.persist={setOptions:S=>{o={...o,...S},S.storage&&(m=S.storage)},clearStorage:()=>{m==null||m.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>C(),hasHydrated:()=>c,onHydrate:S=>(a.add(S),()=>{a.delete(S)}),onFinishHydration:S=>(h.add(S),()=>{h.delete(S)})},o.skipHydration||C(),k||w},gut=mut,dse=fut()(gut((t,e)=>({cartItems:[],addToCart:(n,s,i=1,o)=>{t(c=>{const a=c.cartItems.findIndex(h=>{var m;return h.product.id===n.id&&((m=h.variant)==null?void 0:m.id)===(s==null?void 0:s.id)});if(a>=0){const h=[...c.cartItems];return h[a].quantity+=i,o&&(h[a].artworkUrl=o),{cartItems:h}}return{cartItems:[...c.cartItems,{product:n,variant:s,quantity:i,artworkUrl:o}]}})},removeFromCart:(n,s)=>{t(i=>({cartItems:i.cartItems.filter(o=>{var c;return!(o.product.id===n&&((c=o.variant)==null?void 0:c.id)===s)})}))},updateQuantity:(n,s,i)=>{t(o=>({cartItems:o.cartItems.map(c=>{var a;return c.product.id===n&&((a=c.variant)==null?void 0:a.id)===s?{...c,quantity:Math.max(1,i)}:c})}))},updateArtwork:(n,s,i)=>{t(o=>({cartItems:o.cartItems.map(c=>{var a;return c.product.id===n&&((a=c.variant)==null?void 0:a.id)===s?{...c,artworkUrl:i}:c})}))},clearCart:()=>t({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),i=n.variant?Number(n.variant.price_adjustment):0;return s+i},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=e();return n.reduce((i,o)=>i+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=e();return n.reduce((s,i)=>s+Number(i.product.shipping_fee)*i.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=e();return n()+s()}}),{name:"marketplace-cart",partialize:t=>({cartItems:t.cartItems})})),zOe=P.createContext({onlineUsers:[],totalOnline:0}),xut=async t=>{try{const{data:e}=await ee.storage.from("avatars").list(`${t}`);if(e&&e.length>0){const{data:n}=ee.storage.from("avatars").getPublicUrl(`${t}/${e[0].name}`);return n.publicUrl}}catch{}},yut=({children:t})=>{const{user:e,brokerageId:n,isAdmin:s}=zr(),[i,o]=P.useState([]),[c,a]=P.useState(null);P.useEffect(()=>{if(!e)return;const m=ee.channel("app-presence",{config:{presence:{key:e.id}}});return m.on("presence",{event:"sync"},()=>{const x=m.presenceState(),v=[];Object.entries(x).forEach(([w,k])=>{if(k&&k.length>0){const C=k[0];v.push({id:w,name:C.name||"Unknown",avatarUrl:C.avatarUrl,brokerageId:C.brokerageId,onlineSince:C.onlineSince})}}),o(v)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var v;if(x==="SUBSCRIBED"){const{data:w}=await ee.from("profiles").select("name, brokerage_id").eq("id",e.id).single(),k=await xut(e.id);await m.track({name:(w==null?void 0:w.name)||((v=e.email)==null?void 0:v.split("@")[0])||"User",avatarUrl:k,brokerageId:w==null?void 0:w.brokerage_id,onlineSince:new Date().toISOString()})}}),a(m),()=>{m.unsubscribe()}},[e]);const h=i.filter(m=>m.id===(e==null?void 0:e.id)?!1:!!(s||n&&m.brokerageId===n||!n&&!m.brokerageId));return r.jsx(zOe.Provider,{value:{onlineUsers:h,totalOnline:i.length},children:t})},BOe=()=>P.useContext(zOe),Jje="dashboard-sidebar-collapsed",Dr=({children:t,title:e})=>{var ve,Ie,Se;const{user:n,signOut:s,isAdmin:i,isBrokerageManager:o,brokerageId:c}=zr(),{avatarUrl:a}=xge(n==null?void 0:n.id),{isTrial:h,isExpired:m,expiresAt:x}=vit(n==null?void 0:n.id),{isMarketplaceEnabled:v}=r6e(),{currentBrief:w,shouldShowPopup:k,hasUnseenBrief:C,openBrief:S,closeBrief:T,dismissBrief:I}=rut(),{unreadCount:A}=_it(),{openCount:D}=bit(),F=dse(oe=>oe.cartItems).reduce((oe,ae)=>oe+ae.quantity,0),q=ts(),W=Tg(),[K,Z]=P.useState(()=>typeof window<"u"?localStorage.getItem(Jje)==="true":!1);P.useEffect(()=>{localStorage.setItem(Jje,String(K))},[K]);const[re,he]=P.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),ue=oe=>{he(ae=>({...ae,[oe]:!ae[oe]}))},je=oe=>oe.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),ne=oe=>W.pathname===oe,ye=oe=>oe.some(ae=>W.pathname===ae),ie=({path:oe,icon:ae,label:Ne,badgeCount:Te})=>{const Be=r.jsxs(te,{variant:"ghost",size:"sm",className:$t("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ne(oe)&&"bg-sidebar-accent text-sidebar-accent-foreground",K?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>q(oe),children:[r.jsxs("div",{className:"relative",children:[r.jsx(ae,{className:"h-4 w-4 shrink-0"}),K&&Te!=null&&Te>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!K&&Ne,!K&&Te!=null&&Te>0&&r.jsx("span",{className:"ml-auto flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Te>9?"9+":Te})]});return K?r.jsxs(mg,{delayDuration:0,children:[r.jsx(gg,{asChild:!0,children:Be}),r.jsxs(dm,{side:"right",className:"flex items-center gap-2",children:[Ne,Te!=null&&Te>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Te>9?"9+":Te})]})]}):Be},me=({id:oe,label:ae,icon:Ne,children:Te,activePaths:Be,showBetaBadge:Le,defaultPath:Qe,badgeCount:Fe})=>{if(K){const Ce=Qe||Be[0];return r.jsxs(mg,{delayDuration:0,children:[r.jsx(gg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"sm",className:$t("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ye(Be)&&"text-primary"),onClick:()=>q(Ce),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ne,{className:"h-4 w-4"}),Fe!=null&&Fe>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(dm,{side:"right",className:"flex items-center gap-2",children:[ae,Le&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600",children:"Beta"}),Fe!=null&&Fe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Fe>9?"9+":Fe})]})]})}return r.jsxs(y4,{open:re[oe],onOpenChange:()=>ue(oe),children:[r.jsx(v4,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye(Be)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(Ne,{className:"h-4 w-4"}),ae,Le&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("span",{className:"flex items-center gap-1",children:[Fe!=null&&Fe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Fe>9?"9+":Fe}),r.jsx(Tu,{className:$t("h-4 w-4 transition-transform duration-200",re[oe]&&"rotate-180")})]})]})}),r.jsx(_4,{className:"pl-4 space-y-1 mt-1",children:Te})]})},fe=({isMobile:oe=!1})=>{const ae=oe?!1:K;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:$t("p-3 border-b border-sidebar-border",ae?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[ae?r.jsx("img",{src:Sot,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:Nje,alt:"LevelUp",className:"h-8 w-auto"}),!oe&&r.jsxs(mg,{delayDuration:0,children:[r.jsx(gg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>Z(!ae),children:r.jsx(id,{className:$t("h-4 w-4 transition-transform duration-300",ae&&"rotate-180")})})}),r.jsx(dm,{side:"right",children:ae?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(_l,{className:"flex-1",children:r.jsxs("nav",{className:$t("p-3 space-y-1",ae&&"flex flex-col items-center"),children:[r.jsx(ie,{path:"/dashboard",icon:QS,label:"Dashboard"}),r.jsx(ie,{path:"/events",icon:sm,label:"Events"}),r.jsxs(me,{id:"agentos",label:"Agent OS",icon:VS,activePaths:["/mission-control","/mission-control/contacts","/mission-control/plans","/mission-control/popbys","/mission-control/video-library","/mission-control/scorecard","/mission-control/listings","/mission-control/pipeline"],showBetaBadge:!0,defaultPath:"/mission-control",children:[r.jsx(ie,{path:"/mission-control",icon:oa,label:"Mission Control"}),r.jsx(ie,{path:"/mission-control/contacts",icon:fs,label:"Contacts"}),r.jsx(ie,{path:"/mission-control/plans",icon:sm,label:"TouchPlans"}),r.jsx(ie,{path:"/mission-control/pipeline",icon:t1,label:"Deal Pipeline"}),r.jsx(ie,{path:"/mission-control/popbys",icon:Ua,label:"Popbys"}),r.jsx(ie,{path:"/mission-control/video-library",icon:Wi,label:"Video Library"}),r.jsx(ie,{path:"/mission-control/scorecard",icon:nc,label:"Scorecard"}),r.jsx(ie,{path:"/mission-control/listings",icon:na,label:"Listing Exchange"})]}),r.jsx(me,{id:"tools",label:"Tools",icon:Ah,activePaths:["/apps","/ai-toolkit"],defaultPath:"/apps",children:r.jsx(ie,{path:"/apps",icon:Ah,label:"Apps & Tools"})}),r.jsxs(me,{id:"marketing",label:"Marketing",icon:om,activePaths:["/templates","/social-swag-2","/newsletters","/listing-swag"],defaultPath:"/templates",children:[r.jsx(ie,{path:"/templates",icon:Yd,label:"Templates"}),!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/social-swag-2"),children:[r.jsx(a1,{className:"h-4 w-4"}),"Social Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),ae&&r.jsx(ie,{path:"/social-swag-2",icon:a1,label:"Social Swag"}),r.jsx(ie,{path:"/newsletters",icon:Dx,label:"Newsletters"}),i&&!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/listing-swag")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/listing-swag"),children:[r.jsx(Wo,{className:"h-4 w-4"}),"Listing Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-amber-500 text-white",children:"Beta"})]}),i&&ae&&r.jsx(ie,{path:"/listing-swag",icon:Wo,label:"Listing Swag"})]}),r.jsxs(me,{id:"learning",label:"Learning",icon:bT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(ie,{path:"/academy",icon:e1,label:"Academy"}),r.jsx(ie,{path:"/toolbox",icon:Fx,label:"Toolbox"})]}),r.jsxs(me,{id:"community",label:"Community",icon:vl,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:A,children:[r.jsx(ie,{path:"/community",icon:fs,label:"Community",badgeCount:A}),r.jsx(ie,{path:"/wishlist",icon:r1,label:"Wishlist",badgeCount:D}),!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>window.open("https://www.facebook.com/share/g/1CC6thti2V/","_blank"),children:[r.jsx($s,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(me,{id:"goods",label:"The Goods",icon:ah,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[v&&!ae&&r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",W.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/marketplace"),children:[r.jsx(ah,{className:"h-4 w-4"}),"Marketplace",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",children:"New"})]}),v&&ae&&r.jsx(ie,{path:"/marketplace",icon:ah,label:"Marketplace"}),r.jsx(ie,{path:"/reward-store",icon:qa,label:"Reward Store"})]}),r.jsxs(me,{id:"help",label:"Help & Services",icon:xx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(ie,{path:"/support",icon:e4,label:"Support"}),r.jsx(ie,{path:"/additional-services",icon:As,label:"Additional Services"})]}),i&&r.jsxs(r.Fragment,{children:[!ae&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Admin"})}),ae?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3",children:r.jsx(ie,{path:"/admin",icon:Uf,label:"Admin Dashboard"})}):r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",W.pathname.startsWith("/admin")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/admin"),children:[r.jsx(Uf,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(c||o)&&!i&&r.jsxs(r.Fragment,{children:[!ae&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"My Brokerage"})}),ae?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[c&&r.jsx(ie,{path:"/my-brokerage",icon:na,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{path:"/brokerage/dashboard",icon:od,label:"Manage Brokerages"}),r.jsx(ie,{path:"/brokerage-resources",icon:hh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[c&&r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/my-brokerage"),children:[r.jsx(na,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage/dashboard"),children:[r.jsx(od,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage-resources"),children:[r.jsx(hh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(te,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/profile"),children:[r.jsx(jc,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(n4,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(yut,{children:r.jsx(sI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[h&&m&&r.jsx(zdt,{}),typeof document<"u"&&ny.createPortal(r.jsx("aside",{className:$t("hidden md:flex flex-col bg-card border-r border-border fixed top-0 left-0 h-screen z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",K?"w-16":"w-52"),children:r.jsx(fe,{})}),document.body),r.jsxs("div",{className:$t("flex-1 flex flex-col h-screen overflow-hidden transition-all duration-300",K?"md:ml-16":"md:ml-52"),children:[r.jsx("header",{className:"sticky top-0 z-40 bg-card border-b border-border flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[r.jsxs(qne,{children:[r.jsx(vge,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(TT,{className:"h-5 w-5"})})}),r.jsx(uI,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(fe,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:Nje,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(Yje,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[h&&!m&&x&&r.jsx(Fdt,{expiresAt:x,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(Yje,{})}),w&&r.jsx(Bdt,{hasUnseenBrief:C,onClick:S}),v&&r.jsxs(te,{variant:"ghost",size:"icon",className:"relative",onClick:()=>q("/marketplace/cart"),children:[r.jsx(ah,{className:"h-5 w-5"}),F>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-5 w-5 rounded-full bg-primary text-primary-foreground text-xs font-medium flex items-center justify-center",children:F>99?"99+":F})]}),r.jsx(ddt,{}),r.jsx(lhe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Ie=(ve=n==null?void 0:n.user_metadata)==null?void 0:ve.name)==null?void 0:Ie.split(" ")[0])||"User","!"]}),r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsx("button",{className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-full",children:r.jsxs(Di,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Po,{src:a||void 0}),r.jsx(Ri,{className:"bg-primary text-primary-foreground font-medium text-sm",children:je(((Se=n==null?void 0:n.user_metadata)==null?void 0:Se.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(ep,{align:"end",className:"w-48",children:[r.jsxs(co,{onClick:()=>q("/profile"),className:"cursor-pointer",children:[r.jsx(jc,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsx(oC,{}),r.jsxs(co,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(n4,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(sut,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:t})}),w&&r.jsx(tut,{brief:w,open:k,onClose:T,onDismiss:I}),r.jsx(nut,{}),r.jsx(aut,{}),r.jsx(lut,{})]})]})})})},vut=()=>{const{user:t}=zr(),[e,n]=P.useState(!1),[s,i]=P.useState(null),[o,c]=P.useState(""),a=async v=>{var w;if(!(t!=null&&t.email)){He.error("Please sign in to upgrade");return}n(!0),i(v);try{const{data:k,error:C}=await ee.functions.invoke("create-checkout",{body:{tier:v,email:t.email,name:((w=t.user_metadata)==null?void 0:w.full_name)||t.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(C)throw C;if(k!=null&&k.url)window.open(k.url,"_blank","noopener,noreferrer"),He.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(k){console.error("Checkout error:",k),He.error(k.message||"Failed to start checkout. Please try again.")}finally{n(!1),i(null)}},h=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],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"],x=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return r.jsx(Dr,{children:r.jsxs("div",{className:"container max-w-6xl py-8 px-4",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Upgrade Your Membership"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:"Choose the plan that's right for you and unlock the full power of LevelUp"})]}),r.jsxs("div",{className:"max-w-md mx-auto mb-8",children:[r.jsx(Xe,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(xt,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:v=>c(v.target.value),className:"mt-1"})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[r.jsxs(Ze,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[r.jsx("div",{className:"absolute top-0 right-0 bg-primary text-primary-foreground text-xs px-3 py-1 rounded-bl-lg font-medium",children:"Popular"}),r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(fs,{className:"h-7 w-7 text-primary"})}),r.jsx(Xt,{className:"text-xl",children:"Individual Agent"}),r.jsx(In,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:h.map((v,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx($a,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:v})]},w))}),r.jsxs(te,{className:"w-full",size:"lg",onClick:()=>a("individual_agent"),disabled:e,children:[e&&s==="individual_agent"?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(As,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ze,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Xt,{className:"text-xl",children:"Brokerage"}),r.jsx(In,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:m.map((v,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx($a,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:v})]},w))}),r.jsxs(te,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>a("brokerage_under_25"),disabled:e,children:[e&&s==="brokerage_under_25"?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(na,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ze,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Xt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(In,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:x.map((v,w)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx($a,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:v})]},w))}),r.jsxs(te,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>a("brokerage_over_25"),disabled:e,children:[e&&s==="brokerage_over_25"?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(na,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(Ze,{className:"bg-muted/50",children:r.jsxs(et,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Ma,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(oi,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},_ut=()=>{const{user:t,loading:e,isBrokerageManager:n,brokerageId:s}=zr(),i=ts(),[o,c]=P.useState(""),[a,h]=P.useState(!1),[m,x]=P.useState(!1);P.useEffect(()=>{!e&&!t&&i("/auth")},[t,e,i]),P.useEffect(()=>{!e&&t&&s&&i("/profile?setup=true")},[t,e,s,i]);const v=async()=>{if(!o.trim()){He.error("Please enter a brokerage name");return}const{data:w}=await ee.auth.getSession(),k=w.session;if(!t||!k){He.error("Please sign in again to create your brokerage."),i("/auth");return}h(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!t,hasSession:!!k,userId:t==null?void 0:t.id});const{data:C,error:S}=await ee.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:C,error:S}),S)throw S;if(!(C!=null&&C.ok))throw new Error((C==null?void 0:C.error)||"Failed to create brokerage");h(!1),x(!0),He.success("Brokerage created! Setting up your account..."),setTimeout(()=>{i("/profile?setup=true")},2e3)}catch(C){console.error("Error creating brokerage:",C),He.error(C.message||"Failed to create brokerage"),h(!1)}};return e?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m?r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ze,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(sn,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Xt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(In,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(Ba,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{children:"Brokerage created"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(sn,{className:"w-5 h-5 animate-spin text-primary"}),r.jsx("span",{children:"Assigning you as manager..."})]}),r.jsx("p",{className:"text-center text-sm text-muted-foreground mt-4",children:"You'll be redirected to complete your profile setup in a moment."})]})]})}):r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ze,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(na,{className:"w-10 h-10 text-primary"})}),r.jsx(Xt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(In,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(xt,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:w=>c(w.target.value),onKeyDown:w=>w.key==="Enter"&&v()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),r.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(fs,{className:"w-4 h-4 text-primary"}),"What you can do as a Brokerage Manager:"]}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Ba,{className:"w-4 h-4 text-green-500"}),"Invite agents to join your brokerage"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Ba,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Ba,{className:"w-4 h-4 text-green-500"}),"Track your team's activity and engagement"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Ba,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(te,{onClick:v,className:"w-full",disabled:a||!o.trim(),children:[a?"Creating...":"Create Brokerage",r.jsx(Ho,{className:"w-4 h-4 ml-2"})]})]})]})})},eke=()=>{const t=ts(),[e,n]=P.useState("verifying"),[s,i]=P.useState("");P.useEffect(()=>{(async()=>{try{const{data:{session:a},error:h}=await ee.auth.getSession();if(h)throw h;if(a!=null&&a.user){const{data:m}=await ee.from("profiles").select("login_count").eq("id",a.user.id).single();if(((m==null?void 0:m.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",a.user.email),n("success");try{await ee.functions.invoke("trial-claim-hook",{body:{userId:a.user.id}})}catch(x){console.log("Trial claim hook (non-critical):",x)}setTimeout(()=>{t("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(a){console.error("Claim error:",a),n("already_claimed")}})()},[t]);const o=()=>{window.location.href="https://dashboard.relevelup.com/auth"};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"space-y-1 text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[e==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),e==="success"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e==="already_claimed"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(Xt,{className:"text-2xl",children:[e==="verifying"&&"Claiming Your Account...",e==="success"&&"Account Claimed!",e==="already_claimed"&&"Account Already Claimed",e==="error"&&"Claim Failed"]}),r.jsxs(In,{children:[e==="verifying"&&"Please wait while we verify your account...",e==="success"&&"Redirecting you to complete your profile...",e==="already_claimed"&&"This account has already been set up. Please log in to access your dashboard.",e==="error"&&s]})]}),(e==="already_claimed"||e==="error")&&r.jsx(et,{children:r.jsx(te,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},but=()=>{const t=ts(),[e]=Pd(),[n,s]=P.useState(e.get("code")||""),[i,o]=P.useState(""),[c,a]=P.useState(""),[h,m]=P.useState(""),[x,v]=P.useState(!1),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState(null),[q,W]=P.useState(null),[K,Z]=P.useState(null);P.useEffect(()=>{const je=e.get("code");je&&(s(je),re(je))},[e]);const re=async je=>{S(!0);const{data:ne,error:ye}=await ee.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",je.toUpperCase().trim()).single();if(ye||!ne){He.error("Invalid invite code"),S(!1);return}if(!ne.is_active){He.error("This invite code is no longer active"),S(!1);return}if(ne.max_uses&&ne.uses_count>=ne.max_uses){He.error("This invite code has reached its maximum uses"),S(!1);return}if(ne.expires_at&&new Date(ne.expires_at){je.preventDefault(),re(n)},ue=async je=>{var ne;if(je.preventDefault(),!h.trim()){He.error("Please enter your name");return}if(c.length<6){He.error("Password must be at least 6 characters");return}k(!0);try{const ye=`${window.location.origin}/`,{data:ie,error:me}=await ee.auth.signUp({email:i.trim(),password:c,options:{emailRedirectTo:ye,data:{name:h.trim()}}});if(me){me.message.includes("already registered")?He.error("This email is already registered. Please sign in instead."):He.error(me.message);return}ie.user&&(await ee.rpc("add_default_signup_tag",{user_id:ie.user.id}),$?await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,brokerageId:$}}):K?await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,trialDays:K}}):await ee.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,grandfathered:!0}}),A&&await ee.from("invite_codes").update({uses_count:((ne=(await ee.from("invite_codes").select("uses_count").eq("id",A).single()).data)==null?void 0:ne.uses_count)+1}).eq("id",A),He.success("Account created! You can now access the dashboard."),t("/dashboard"))}catch(ye){console.error("Signup error:",ye),He.error("An unexpected error occurred")}finally{k(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx(Xt,{className:"text-2xl font-bold text-primary",children:q?`Join ${q}`:"Join LevelUp"}),r.jsx(In,{children:T?q?`Create your account to join ${q}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(et,{children:T?r.jsxs("form",{onSubmit:ue,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Full Name"}),r.jsx(xt,{id:"name",type:"text",placeholder:"John Doe",value:h,onChange:je=>m(je.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"email",children:"Email"}),r.jsx(xt,{id:"email",type:"email",placeholder:"you@example.com",value:i,onChange:je=>o(je.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(xt,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:c,onChange:je=>a(je.target.value),required:!0,minLength:6}),r.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>v(!x),children:x?r.jsx(Qw,{className:"h-4 w-4"}):r.jsx(Al,{className:"h-4 w-4"})})]})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:w,children:w?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:he,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(xt,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:je=>s(je.target.value),required:!0,autoFocus:!0})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},wut="/assets/testimonial-avatar-1-BsCQFauB.jpg",jut="/assets/testimonial-avatar-2-B6VPVc2t.jpg",kut="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Nut="/assets/testimonial-avatar-4-98iKMtkB.jpg",Sut="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Cut=[wut,jut,kut,Nut,Sut],Mut=s5({name:ec().trim().min(2,"Name must be at least 2 characters").max(100),email:ec().trim().email("Please enter a valid email address").max(255),phone:ec().trim().min(10,"Please enter a valid phone number").max(20).optional().or(_je("")),brokerage:ec().trim().max(200).optional().or(_je(""))}),Tut=[{icon:Af,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Yd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:li,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Wl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Si,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ua,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Aut=[{icon:fs,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:As,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ma,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Uh,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:cl,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:oa,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:u1,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Eut=[{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."}],Iut=()=>{const t=ts(),[e,n]=P.useState(!1),[s,i]=P.useState({name:"",email:"",phone:"",brokerage:""}),[o,c]=P.useState({}),a=async h=>{var x,v;h.preventDefault(),c({});const m=Mut.safeParse(s);if(!m.success){const w={};m.error.errors.forEach(k=>{k.path[0]&&(w[k.path[0]]=k.message)}),c(w);return}n(!0);try{const{data:w,error:k}=await ee.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((x=s.phone)==null?void 0:x.trim())||void 0,brokerage:((v=s.brokerage)==null?void 0:v.trim())||void 0}});if(k){console.error("Trial signup error:",k),He.error(k.message||"Something went wrong. Please try again.");return}if(w!=null&&w.error){He.error(w.error);return}He.success("🎉 Welcome aboard! Check your email to claim your account."),t("/trial/success")}catch(w){console.error("Trial signup error:",w),He.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),r.jsx("meta",{name:"description",content:"Take LevelUp for a free 7-day test drive. No credit card required. The all-in-one platform for real estate agents and brokerages."}),r.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),r.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),r.jsx("meta",{property:"og:type",content:"website"})]}),r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Zee,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(te,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var h;return(h=document.getElementById("features"))==null?void 0:h.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(te,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[r.jsx("div",{className:"flex justify-center lg:justify-start",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium",children:[r.jsx(As,{className:"h-4 w-4 text-yellow-400"}),r.jsx("span",{children:"7-Day Free Trial • No Credit Card Required"})]}),r.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white leading-tight font-sans",children:["Take LevelUp for a"," ",r.jsx("span",{className:"italic",children:"Free Test Drive"})]}),r.jsxs("p",{className:"text-lg md:text-xl text-white/80 max-w-xl mx-auto lg:mx-0 font-sans",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Ha,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"No credit card required"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Ha,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"Full access to all features"})]})]}),r.jsxs("div",{className:"flex items-center gap-4 justify-center lg:justify-start pt-4",children:[r.jsx("div",{className:"flex -space-x-3",children:Cut.map((h,m)=>r.jsx("img",{src:h,alt:`Agent ${m+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},m))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(h=>r.jsx(Bs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},h))}),r.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),r.jsx("div",{className:"lg:pl-8",children:r.jsx(Ze,{className:"bg-white shadow-2xl border-0",children:r.jsxs(et,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx(ug,{className:"h-8 w-8 text-white"})}),r.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),r.jsxs("form",{onSubmit:a,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Full Name *"}),r.jsx(xt,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:h=>i({...s,name:h.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"email",children:"Email Address *"}),r.jsx(xt,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:h=>i({...s,email:h.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone Number"}),r.jsx(xt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:h=>i({...s,phone:h.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(xt,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:h=>i({...s,brokerage:h.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(te,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:e,children:e?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(Ho,{className:"ml-2 h-5 w-5"})]})}),r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["By signing up, you agree to our"," ",r.jsx("a",{href:"/terms-of-service",className:"text-[#4a6b6d] hover:underline",children:"Terms"})," ","and"," ",r.jsx("a",{href:"/privacy-policy",className:"text-[#4a6b6d] hover:underline",children:"Privacy Policy"})]})]})]})})})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Tut.map((h,m)=>r.jsxs(Ze,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Wt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(h.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Xt,{className:"text-xl font-sans",children:h.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:h.description})})]},m))})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(As,{className:"w-4 h-4"}),"Included with Your Trial"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:Aut.map((h,m)=>r.jsxs(Ze,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(h.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Xt,{className:"text-lg font-semibold text-white",children:h.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:h.description})})]},m))})]})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:Eut.map((h,m)=>r.jsx(Ze,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(et,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(Bs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',h.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:h.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.role})]})]})},m))})]})}),r.jsx("section",{className:"py-16 bg-muted/30",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(lm,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Secure & Private"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Bank-level encryption"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(u1,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Fast Setup"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Start in 2 minutes"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(fs,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Expert Support"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Real estate pros"})]})]})]})})}),r.jsx("section",{id:"free-trial",className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs(Ze,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs(et,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(te,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),size:"lg",className:"h-14 px-8 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 rounded-full",children:["Start Your Free Trial Now",r.jsx(Ho,{className:"ml-2 h-5 w-5"})]})]})]})})}),r.jsx("footer",{className:"bg-[#1e3a4c] py-12",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[r.jsx("img",{src:pge,alt:"LevelUp",className:"h-8"}),r.jsxs("div",{className:"flex gap-6 text-sm text-white/60",children:[r.jsx("a",{href:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),r.jsx("a",{href:"/terms-of-service",className:"hover:text-white transition-colors",children:"Terms of Service"})]}),r.jsx("p",{className:"text-sm text-white/40",children:"© 2025 LevelUp Consulting Group. All rights reserved."})]})})})]})]})},Put=()=>{const t=ts();return r.jsxs(r.Fragment,{children:[r.jsx(Ag,{children:r.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),r.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:Zee,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(te,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),r.jsxs("section",{className:"relative pt-24 pb-12 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden flex-1 flex items-center",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(Ze,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(et,{className:"p-8 md:p-12 text-center",children:[r.jsxs("div",{className:"relative inline-block mb-8",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:r.jsx(Ha,{className:"h-12 w-12 text-white"})}),r.jsx("div",{className:"absolute -top-2 -right-2 w-10 h-10 rounded-full bg-yellow-500 flex items-center justify-center animate-bounce",children:r.jsx(bc,{className:"h-5 w-5 text-white"})})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4 font-sans",children:"You're In! 🎉"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your 7-day LevelUp adventure starts now!"}),r.jsxs("div",{className:"bg-[#4a6b6d]/10 rounded-xl p-6 mb-8",children:[r.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(oi,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),r.jsx("p",{className:"text-muted-foreground",children:"We just sent you a magic link to claim your account and set up your password. Click the link in your email to get started!"})]}),r.jsxs("div",{className:"text-left space-y-3 mb-8",children:[r.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),r.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),r.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),r.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",r.jsx("button",{onClick:()=>t("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(te,{onClick:()=>t("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(Ho,{className:"ml-2 h-4 w-4"})]})]})})})})]}),r.jsx("footer",{className:"bg-[#1e3a4c] py-8",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[r.jsx("img",{src:pge,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Lut=s5({viewerName:ec().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:ec().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:ec().max(20,"Phone must be less than 20 characters").optional(),message:ec().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Out({shareToken:t,agentName:e,hasContact:n}){const[s,i]=P.useState(!1),[o,c]=P.useState(!1),[a,h]=P.useState(null),m=ese({resolver:tse(Lut),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async v=>{i(!0),h(null);try{const{data:w,error:k}=await ee.functions.invoke("video-reply-notify",{body:{shareToken:t,viewerName:v.viewerName,viewerEmail:v.viewerEmail,viewerPhone:v.viewerPhone||void 0,message:v.message}});if(k)throw new Error(k.message);if(!(w!=null&&w.success))throw new Error((w==null?void 0:w.error)||"Failed to send reply");c(!0)}catch(w){console.error("Failed to submit reply:",w),h(w.message||"Something went wrong. Please try again.")}finally{i(!1)}};return o?r.jsx(Ze,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(et,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(Ha,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Message Sent!"}),r.jsxs("p",{className:"text-muted-foreground",children:[e?`${e} will`:"They'll"," get back to you soon."]})]})}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Wl,{className:"h-5 w-5 text-primary"}),r.jsx(Xt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(In,{children:n?`Have a question or want to connect? Send ${e||"them"} a message.`:`Interested? Share your info and ${e||"your agent"} will be in touch.`})]}),r.jsx(et,{children:r.jsx(rse,{...m,children:r.jsxs("form",{onSubmit:m.handleSubmit(x),className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsx(kl,{control:m.control,name:"viewerName",render:({field:v})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Your Name *"}),r.jsx(gl,{children:r.jsx(xt,{placeholder:"John Smith",...v})}),r.jsx(yu,{})]})}),r.jsx(kl,{control:m.control,name:"viewerEmail",render:({field:v})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Email *"}),r.jsx(gl,{children:r.jsx(xt,{type:"email",placeholder:"john@example.com",...v})}),r.jsx(yu,{})]})})]}),!n&&r.jsx(kl,{control:m.control,name:"viewerPhone",render:({field:v})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Phone (optional)"}),r.jsx(gl,{children:r.jsx(xt,{type:"tel",placeholder:"(555) 123-4567",...v})}),r.jsx(yu,{})]})}),r.jsx(kl,{control:m.control,name:"message",render:({field:v})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Message *"}),r.jsx(gl,{children:r.jsx(gs,{placeholder:n?"Thanks for the video! I had a question about...":"I'm interested in learning more about...",className:"min-h-[100px] resize-none",...v})}),r.jsx(yu,{})]})}),a&&r.jsx("p",{className:"text-sm text-destructive",children:a}),r.jsx(te,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Dut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0 opacity-[0.08]",children:[r.jsx("div",{className:"absolute top-0 left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[16%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[32%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[48%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[64%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[80%] left-0 right-0 h-[8%] bg-red-600"})]}),r.jsx("div",{className:"absolute top-0 left-0 w-[35%] h-[45%] bg-blue-900/10 rounded-br-3xl"}),r.jsx(Bs,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(Bs,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(Bs,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(Bs,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(Bs,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(Px,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Rut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-500/5 via-transparent to-blue-500/5"}),r.jsxs("div",{className:"absolute top-[10%] left-[15%] w-32 h-32",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-red-400/20 animate-ping",style:{animationDuration:"3s"}}),r.jsx(As,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 text-red-400/40"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[20%] w-24 h-24",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-blue-400/20 animate-ping",style:{animationDuration:"4s",animationDelay:"1s"}}),r.jsx(Bs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 text-blue-400/40 fill-blue-400/20"})]}),r.jsxs("div",{className:"absolute top-[20%] left-[50%] w-20 h-20",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border border-white/10 animate-ping",style:{animationDuration:"3.5s",animationDelay:"0.5s"}}),r.jsx(As,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 text-amber-400/40"})]}),r.jsx(Bs,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(Bs,{className:"absolute bottom-[15%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse",style:{animationDelay:"0.5s"}}),r.jsx(Px,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Fut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-200/20 via-rose-100/10 to-purple-200/15"}),r.jsx("div",{className:"absolute top-[5%] left-[5%] opacity-20",children:r.jsx(Qp,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(Qp,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(Qp,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(Qp,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(oa,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(oa,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-300/40 fill-pink-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(oa,{className:"absolute top-[10%] left-[60%] w-4 h-4 text-rose-400/30 fill-rose-400/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx("div",{className:"absolute top-[8%] left-[45%] w-8 h-8 rounded-full bg-pink-300/10 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[30%] w-6 h-6 rounded-full bg-rose-300/10 blur-sm"})]}),zut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/5 via-slate-800/3 to-indigo-900/5"}),r.jsx("div",{className:"absolute top-[5%] right-[10%] opacity-15",children:r.jsxs("div",{className:"w-12 h-24 relative",children:[r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-10 h-3 bg-blue-600 rounded-full"}),r.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-[20px] border-r-[20px] border-t-[60px] border-l-transparent border-r-transparent border-t-blue-500"})]})}),r.jsx(Ml,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(Bs,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Ml,{className:"absolute bottom-[20%] right-[8%] w-14 h-14 text-indigo-500/12"}),r.jsx("div",{className:"absolute top-[3%] left-[40%] opacity-12",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tr-none rotate-6"}),r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tl-none -rotate-6"})]})}),r.jsx(Bs,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(Bs,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),But=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-100/20 via-purple-100/15 to-sky-100/20"}),r.jsx("div",{className:"absolute top-[5%] left-[8%] w-12 h-16 rounded-full bg-gradient-to-b from-pink-300/25 to-pink-400/18 rotate-12"}),r.jsx("div",{className:"absolute top-[8%] right-[12%] w-10 h-14 rounded-full bg-gradient-to-b from-purple-300/25 to-purple-400/18 -rotate-6"}),r.jsx("div",{className:"absolute bottom-[18%] left-[15%] w-11 h-15 rounded-full bg-gradient-to-b from-sky-300/20 to-sky-400/12 rotate-6"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-12 h-16 rounded-full bg-gradient-to-b from-yellow-300/20 to-yellow-400/12 -rotate-12"}),r.jsx("div",{className:"absolute top-[10%] left-[10%] w-6 h-1 bg-white/30 rounded-full rotate-12"}),r.jsx("div",{className:"absolute top-[12%] right-[15%] w-5 h-1 bg-white/25 rounded-full -rotate-6"}),r.jsx(Qp,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(Qp,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(WS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),$ut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/12 via-purple-900/8 to-slate-900/12"}),r.jsx(tj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(tj,{className:"absolute top-[10%] right-[12%] w-12 h-12 text-purple-400/20 animate-pulse"}),r.jsxs("div",{className:"absolute bottom-[18%] left-[8%]",children:[r.jsx("div",{className:"w-14 h-12 rounded-full bg-orange-500/20"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-4 bg-green-600/25 rounded-t-full"})]}),r.jsxs("div",{className:"absolute bottom-[22%] right-[12%]",children:[r.jsx("div",{className:"w-12 h-10 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-1.5 h-3 bg-green-600/20 rounded-t-full"})]}),r.jsx("div",{className:"absolute top-[15%] left-[40%] opacity-20",children:r.jsx("svg",{viewBox:"0 0 24 12",className:"w-10 h-5 text-slate-800 fill-current",children:r.jsx("path",{d:"M12 6c-2-4-6-6-12-6 4 2 6 4 6 6s-2 4-6 6c6 0 10-2 12-6zm0 0c2-4 6-6 12-6-4 2-6 4-6 6s2 4 6 6c-6 0-10-2-12-6z"})})}),r.jsx(As,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(As,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Uut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-900/8 via-green-900/5 to-emerald-900/8"}),r.jsx(l1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(l1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(l1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(I0,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(I0,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(I0,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(I0,{className:"absolute top-[8%] left-[70%] w-8 h-8 text-blue-200/20 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[12%] left-[10%] w-5 h-5 rounded-full bg-red-500/25"}),r.jsx("div",{className:"absolute top-[15%] right-[15%] w-4 h-4 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"absolute top-[20%] left-[55%] w-4 h-4 rounded-full bg-green-500/20"}),r.jsx(Bs,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),qut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/10 via-amber-800/6 to-red-900/10"}),r.jsx("div",{className:"absolute top-[5%] left-[10%] w-10 h-8 rounded-full bg-orange-500/25 rotate-45"}),r.jsx("div",{className:"absolute top-[10%] right-[15%] w-8 h-6 rounded-full bg-red-500/20 -rotate-12"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-7 h-5 rounded-full bg-amber-500/22 rotate-30"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-10 h-7 rounded-full bg-yellow-600/18 -rotate-45"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-9 h-6 rounded-full bg-orange-600/15 rotate-12"}),r.jsxs("div",{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2",children:[r.jsx("div",{className:"w-16 h-14 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-5 bg-green-600/18 rounded-t-full"})]}),r.jsx(oa,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(oa,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Vut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-900/8 via-amber-900/4 to-purple-900/8"}),r.jsx(Bs,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(Bs,{className:"absolute top-[8%] right-[12%] w-10 h-10 text-amber-400/30 fill-amber-400/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(Bs,{className:"absolute top-[15%] left-[40%] w-7 h-7 text-yellow-300/25 fill-yellow-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(Bs,{className:"absolute top-[12%] right-[35%] w-8 h-8 text-amber-300/28 fill-amber-300/18 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[20%] left-[25%] w-4 h-4 rounded-full bg-pink-400/30"}),r.jsx("div",{className:"absolute top-[18%] right-[30%] w-3 h-3 rounded-full bg-sky-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[60%] w-2.5 h-2.5 rounded-full bg-emerald-400/30"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-3 h-3 rounded-full bg-purple-400/30"}),r.jsx(As,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(bc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(bc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),Hut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsxs("div",{className:"absolute bottom-[12%] left-1/2 -translate-x-1/2 flex items-end gap-3",children:[r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2.5 h-20 bg-blue-500/22 rounded-full"})," ",r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"})]}),r.jsx("div",{className:"absolute bottom-[38%] left-[calc(50%-42px)] w-3 h-4 bg-yellow-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[35%] left-[calc(50%-28px)] w-2.5 h-3 bg-yellow-300/25 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[40%] left-[calc(50%-14px)] w-3 h-4 bg-amber-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[45%] left-1/2 -translate-x-1/2 w-4 h-5 bg-yellow-400/35 rounded-full blur-sm"}),r.jsx(Bs,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(As,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(As,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Wut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/12 via-emerald-900/6 to-teal-900/10"}),r.jsx(Nx,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Nx,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Nx,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Nx,{className:"absolute bottom-[22%] right-[10%] w-11 h-11 text-emerald-400/18"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-6 h-6 rounded-full bg-yellow-500/30 border-2 border-yellow-600/25"}),r.jsx("div",{className:"absolute top-[20%] right-[28%] w-5 h-5 rounded-full bg-amber-500/25 border-2 border-amber-600/20"}),r.jsx("div",{className:"absolute bottom-[28%] left-[45%] w-5 h-5 rounded-full bg-yellow-400/25 border-2 border-yellow-500/20"}),r.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 opacity-12 rounded-bl-full overflow-hidden",children:r.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-red-400/60 via-yellow-400/60 to-green-400/60"})}),r.jsxs("div",{className:"absolute bottom-[10%] right-[5%] opacity-15",children:[r.jsx("div",{className:"w-12 h-8 bg-slate-700 rounded-b-full"}),r.jsx("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 w-10 h-3 bg-slate-600 rounded-full"}),r.jsxs("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 flex gap-0.5",children:[r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"})]})]})]}),Gut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsx("div",{className:"absolute top-[8%] left-[12%] w-16 h-16 rounded-full border-4 border-blue-500/18"}),r.jsx("div",{className:"absolute top-[10%] right-[10%] w-14 h-14 rounded-full border-4 border-indigo-500/15"}),r.jsx("div",{className:"absolute bottom-[18%] left-[18%] w-12 h-12 rounded-full border-3 border-sky-500/12"}),r.jsx(Bs,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(Bs,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Ml,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Ml,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(Px,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Kut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/6 via-rose-900/6 to-purple-900/6"}),r.jsx(Uh,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-amber-400/18"}),r.jsxs("div",{className:"absolute top-[5%] left-[15%]",children:[r.jsx("div",{className:"w-12 h-14 rounded-full bg-rose-400/25"}),r.jsx("div",{className:"w-0.5 h-10 bg-rose-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[3%] left-[25%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-sky-400/25"}),r.jsx("div",{className:"w-0.5 h-12 bg-sky-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[8%] right-[18%]",children:[r.jsx("div",{className:"w-11 h-13 rounded-full bg-purple-400/25"}),r.jsx("div",{className:"w-0.5 h-9 bg-purple-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[10%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"w-0.5 h-11 bg-amber-400/18 mx-auto"})]}),r.jsx("div",{className:"absolute top-[20%] left-[35%] w-3 h-3 bg-pink-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[18%] right-[40%] w-2.5 h-2.5 bg-emerald-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-2 h-2 bg-amber-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[30%] w-2.5 h-2.5 bg-sky-400/35 rounded-full"}),r.jsx(bc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(Ua,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),Zut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-rose-900/12 via-pink-900/8 to-red-900/12"}),r.jsx(oa,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(oa,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(oa,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(oa,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(oa,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(oa,{className:"absolute top-[20%] right-[35%] w-5 h-5 text-rose-300/35 fill-rose-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(oa,{className:"absolute top-[12%] left-[55%] w-5 h-5 text-red-300/30 fill-red-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(oa,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-400/30 fill-pink-400/15 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[18%] left-[45%] w-8 h-8 rounded-full bg-rose-300/18 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[40%] w-6 h-6 rounded-full bg-pink-300/15 blur-sm"})]}),Yut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsxs("div",{className:"absolute top-[5%] right-[12%]",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-yellow-400/25 blur-sm"}),r.jsx(o1,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-14 h-14 text-amber-400/45"})]}),r.jsx("div",{className:"absolute bottom-[12%] left-[20%] w-20 h-10 bg-slate-800/12 rounded-full blur-md"}),r.jsx(o1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(As,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(o1,{className:"absolute bottom-[22%] right-[25%] w-8 h-8 text-orange-400/25"}),r.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[15%] bg-gradient-to-t from-amber-900/10 to-transparent"})]}),Xut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-cyan-900/6 to-emerald-900/10"}),r.jsx(ui,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(ui,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(Vh,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(Vh,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(oa,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(oa,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(As,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(bc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Qut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-900/10 via-teal-900/6 to-cyan-900/10"}),r.jsx(bc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(bc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(Vh,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(ui,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(As,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(As,{className:"absolute top-[20%] right-[32%] w-7 h-7 text-cyan-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-3 h-3 bg-amber-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-2.5 h-2.5 bg-teal-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[28%] left-[35%] w-2 h-2 bg-emerald-400/30 rounded-full"})]}),Jut=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsx(Vh,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(Vh,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(Vh,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(ui,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(bc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(As,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(Bs,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),eht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-emerald-900/6 to-green-900/10"}),r.jsx(ui,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-teal-500/22"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-12 h-10 bg-amber-400/18 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[20%] left-[20%] w-10 h-8 bg-orange-400/15 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[16%] right-[15%] w-11 h-9 bg-amber-300/18 rounded-sm"}),r.jsx(Vh,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(oa,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(As,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(X0,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),tke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute top-4 left-[10%] w-3 h-3 bg-amber-400/60 rounded-full animate-pulse"}),r.jsx("div",{className:"absolute top-12 right-[15%] w-2 h-2 bg-rose-400/60 rounded-full animate-pulse delay-100"}),r.jsx("div",{className:"absolute top-8 left-[30%] w-2.5 h-2.5 bg-sky-400/60 rounded-full animate-pulse delay-200"}),r.jsx("div",{className:"absolute top-16 right-[25%] w-2 h-2 bg-emerald-400/60 rounded-full animate-pulse delay-300"})]}),tht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(oa,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(oa,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(oa,{className:"absolute top-4 left-[40%] w-2.5 h-2.5 text-rose-400/40 fill-rose-400/20 animate-pulse delay-300"}),r.jsx(oa,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),rht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(X0,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(As,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(ui,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),nht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Xw,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(s4,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(Xw,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),PM=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(As,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(bc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(As,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),rke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(ui,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(As,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(ui,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),xhe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(As,{className:"h-5 w-5"}),category:"general",headerText:()=>"Video Message",subText:"A personal video just for you",gradientClasses:"from-background to-muted/30",accentColor:"primary"},{id:"thank_you",name:"Thank You",description:"Express your gratitude",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You, ${t}!`:"Thank You!",subText:"Your support means the world to me",gradientClasses:"from-rose-50/70 via-pink-50/50 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(tht,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(wT,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thinking of You, ${t}`:"Thinking of You",subText:"Just wanted to reach out and say hello",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(PM,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(Xw,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Hey ${t}!`:"Hey There!",subText:"Just checking in to see how you're doing",gradientClasses:"from-amber-50/70 via-orange-50/50 to-yellow-50/40 dark:from-amber-950/30 dark:via-orange-950/20 dark:to-yellow-950/20",accentColor:"amber",decorativeElement:r.jsx(nht,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.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:r.jsx(fs,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You for the Referral, ${t}!`:"Thank You for the Referral!",subText:"Your trust in me means everything",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx(PM,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Ml,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"So proud of your accomplishment",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(tke,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(cl,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Welcome to the Neighborhood, ${t}!`:"Welcome to the Neighborhood!",subText:"So excited to have you as our new neighbor",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-sky-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-sky-950/20",accentColor:"teal",decorativeElement:r.jsx(rke,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(s4,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Hey ${t}!`:"Hey There!",subText:"No reason needed – just wanted to connect",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(PM,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(Uh,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Birthday, ${t}!`:"Happy Birthday!",subText:"Wishing you an amazing year ahead",gradientClasses:"from-amber-50/80 via-rose-50/60 to-purple-50/40 dark:from-amber-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"amber",decorativeElement:r.jsx(Kut,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Valentine's Day, ${t}!`:"Happy Valentine's Day!",subText:"A heartfelt message from your real estate professional",gradientClasses:"from-rose-50/80 via-pink-50/60 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(Zut,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(o1,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Groundhog Day, ${t}!`:"Happy Groundhog Day!",subText:"Wishing you an early spring!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(Yut,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(Bs,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy New Year, ${t}!`:"Happy New Year!",subText:"Wishing you a year full of success and happiness",gradientClasses:"from-yellow-50/70 via-amber-50/50 to-orange-50/40 dark:from-yellow-950/30 dark:via-amber-950/20 dark:to-orange-950/20",accentColor:"yellow",decorativeElement:r.jsx(Vut,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(WS,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Easter, ${t}!`:"Happy Easter!",subText:"Wishing you a joyful celebration",gradientClasses:"from-pink-50/70 via-purple-50/50 to-sky-50/40 dark:from-pink-950/30 dark:via-purple-950/20 dark:to-sky-950/20",accentColor:"pink",decorativeElement:r.jsx(But,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(Qp,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Mother's Day, ${t}!`:"Happy Mother's Day!",subText:"Celebrating the wonderful mothers in our lives",gradientClasses:"from-pink-50/70 via-rose-50/50 to-purple-50/40 dark:from-pink-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"pink",decorativeElement:r.jsx(Fut,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Ml,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Father's Day, ${t}!`:"Happy Father's Day!",subText:"Celebrating the wonderful fathers in our lives",gradientClasses:"from-blue-50/70 via-sky-50/50 to-indigo-50/40 dark:from-blue-950/30 dark:via-sky-950/20 dark:to-indigo-950/20",accentColor:"blue",decorativeElement:r.jsx(zut,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(Px,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Memorial Day, ${t}`:"Happy Memorial Day",subText:"Honoring those who served our country",gradientClasses:"from-red-50/60 via-white to-blue-50/60 dark:from-red-950/30 dark:via-slate-950/20 dark:to-blue-950/30",accentColor:"blue",decorativeElement:r.jsx(Dut,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(qh,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy 4th of July, ${t}!`:"Happy 4th of July!",subText:"Celebrating freedom and independence",gradientClasses:"from-red-50/70 via-white to-blue-50/70 dark:from-red-950/30 dark:via-slate-950/10 dark:to-blue-950/30",accentColor:"red",decorativeElement:r.jsx(Rut,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Ml,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Labor Day, ${t}!`:"Happy Labor Day!",subText:"Celebrating the hard work that builds our communities",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(Gut,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(tj,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Halloween, ${t}!`:"Happy Halloween!",subText:"Have a spooktacular day!",gradientClasses:"from-orange-50/70 via-amber-50/50 to-purple-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-purple-950/30",accentColor:"orange",decorativeElement:r.jsx($ut,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Thanksgiving, ${t}!`:"Happy Thanksgiving!",subText:"Grateful for you and your friendship",gradientClasses:"from-orange-50/70 via-amber-50/50 to-red-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-red-950/20",accentColor:"orange",decorativeElement:r.jsx(qut,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(l1,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Merry Christmas, ${t}!`:"Merry Christmas!",subText:"Wishing you joy and peace this holiday season",gradientClasses:"from-red-50/70 via-green-50/40 to-emerald-50/40 dark:from-red-950/30 dark:via-green-950/20 dark:to-emerald-950/20",accentColor:"red",decorativeElement:r.jsx(Uut,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(As,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Hanukkah, ${t}!`:"Happy Hanukkah!",subText:"Wishing you eight nights of light and joy",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(Hut,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Nx,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy St. Patrick's Day, ${t}!`:"Happy St. Patrick's Day!",subText:"Wishing you the luck of the Irish!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(Wut,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(ui,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Happy Home Anniversary, ${t}!`:"Happy Home Anniversary!",subText:"Celebrating another year in your beautiful home",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-emerald-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-emerald-950/20",accentColor:"teal",decorativeElement:r.jsx(Xut,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(bc,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're under contract – exciting times ahead!",gradientClasses:"from-emerald-50/70 via-teal-50/50 to-cyan-50/40 dark:from-emerald-950/30 dark:via-teal-950/20 dark:to-cyan-950/20",accentColor:"emerald",decorativeElement:r.jsx(Qut,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(li,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Exciting News, ${t}!`:"Just Listed!",subText:"A new property is now on the market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-violet-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-violet-950/20",accentColor:"blue",decorativeElement:r.jsx(rke,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(ad,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Just Sold!",subText:"Another successful transaction completed",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx(PM,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(c1,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Great News, ${t}!`:"Price Reduced!",subText:"This property just became more affordable",gradientClasses:"from-orange-50/70 via-amber-50/50 to-yellow-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-yellow-950/20",accentColor:"orange"},{id:"open_house",name:"Open House",description:"Invite to an open house event",icon:r.jsx(X0,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`You're Invited, ${t}!`:"You're Invited!",subText:"Join us for an exclusive open house",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(rht,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(Vh,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"It's official – the keys are yours!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(Jut,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(ui,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Welcome Home, ${t}!`:"Welcome Home!",subText:"Wishing you all the best in your new home",gradientClasses:"from-teal-50/70 via-emerald-50/50 to-green-50/40 dark:from-teal-950/30 dark:via-emerald-950/20 dark:to-green-950/20",accentColor:"teal",decorativeElement:r.jsx(eht,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(Ad,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Amazing News, ${t}!`:"Offer Accepted!",subText:"Your offer has been accepted – congratulations!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(PM,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Ml,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(tke,{})}],sht=[{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 iht(t){return xhe.filter(e=>e.category===t)}function b4(t){return xhe.find(e=>e.id===t)||xhe[0]}function aht(){const{shareToken:t}=hd(),[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState(null),[a,h]=P.useState(!0),[m,x]=P.useState(null),[v,w]=P.useState(!0);P.useEffect(()=>{const q=()=>{['[id*="lc_text_widget"]','[class*="lc-text-widget"]','[id*="chat-widget"]','[class*="chat-widget"]','iframe[src*="widgets.leadconnectorhq"]','iframe[src*="msgsndr"]',"[data-chat-widget]"].forEach(re=>{document.querySelectorAll(re).forEach(he=>{he.style.display="none"})})};q();const W=[setTimeout(q,500),setTimeout(q,1500),setTimeout(q,3e3)],K=new MutationObserver(q);return K.observe(document.body,{childList:!0,subtree:!0}),()=>{W.forEach(clearTimeout),K.disconnect()}},[]),P.useEffect(()=>{(async()=>{if(!t){x("Invalid share link"),h(!1);return}const{data:W,error:K}=await ee.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",t).eq("is_deleted",!1).single();if(K||!W){x("Video not found or has been removed"),h(!1);return}n(W);try{await ee.rpc("log_video_view",{p_video_id:W.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(Z){console.warn("Failed to log video view:",Z)}if(W.owner_user_id){const{data:Z}=await ee.from("profiles").select("id, name, email, phone").eq("id",W.owner_user_id).single();if(Z){i(Z);try{const{data:re}=await ee.storage.from("avatars").list(`${W.owner_user_id}`);if(re&&re.length>0){const{data:he}=ee.storage.from("avatars").getPublicUrl(`${W.owner_user_id}/${re[0].name}`);c(he.publicUrl)}}catch{}}}h(!1)})()},[t]);const k=q=>{if(!q)return"0:00";const W=Math.floor(q/60),K=q%60;return`${W}:${K.toString().padStart(2,"0")}`},C=q=>q.includes("iframe.mediadelivery.net/play/")?q.replace("/play/","/embed/")+"?autoplay=true&responsive=true":q,S=q=>{if(!q)return"?";const W=q.split(" ");return W.length>=2?`${W[0][0]}${W[1][0]}`.toUpperCase():q.substring(0,2).toUpperCase()},T=b4((e==null?void 0:e.page_template)||"default"),I=(e==null?void 0:e.recipient_name)||null,A=T.headerText(I),$=`https://dashboard.relevelup.com/share/video/${t}`;if(a)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-primary"})});if(m||!e)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Ze,{className:"max-w-md w-full",children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Wi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Video Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:m||"This video is no longer available."})]})})});const F=T.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:A}),r.jsx("meta",{name:"description",content:T.subText}),r.jsx("meta",{property:"og:title",content:A}),r.jsx("meta",{property:"og:description",content:T.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:$}),e.preview_url&&r.jsx("meta",{property:"og:image",content:e.preview_url}),!e.preview_url&&e.thumbnail_url&&r.jsx("meta",{property:"og:image",content:e.thumbnail_url}),e.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{property:"og:video",content:e.playback_url}),r.jsx("meta",{property:"og:video:type",content:"text/html"}),r.jsx("meta",{property:"og:video:width",content:"1280"}),r.jsx("meta",{property:"og:video:height",content:"720"})]}),r.jsx("meta",{name:"twitter:card",content:"player"}),r.jsx("meta",{name:"twitter:title",content:A}),r.jsx("meta",{name:"twitter:description",content:T.subText}),e.preview_url&&r.jsx("meta",{name:"twitter:image",content:e.preview_url}),e.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{name:"twitter:player",content:e.playback_url}),r.jsx("meta",{name:"twitter:player:width",content:"1280"}),r.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),r.jsxs("div",{className:$t("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",T.gradientClasses),children:[F&&T.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[F&&r.jsxs("div",{className:"text-center py-4 animate-fade-in",children:[r.jsx("div",{className:"flex justify-center mb-3",children:r.jsx("div",{className:$t("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",T.accentColor==="primary"&&"bg-primary/10 text-primary",T.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",T.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",T.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",T.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",T.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",T.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",T.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",T.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",T.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",T.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",T.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",T.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:r.jsx("div",{className:"scale-150",children:T.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:A}),r.jsx("p",{className:"text-muted-foreground",children:T.subText})]}),s&&r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[r.jsxs(Di,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Po,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(Ri,{className:"bg-primary/10 text-primary font-semibold",children:S(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:F?"A special video from":"A personal video from"}),r.jsx("h2",{className:"text-lg font-semibold truncate",children:s.name||"Your Agent"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[s.phone&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${s.phone}`,"aria-label":"Call agent",children:r.jsx(Ma,{className:"h-4 w-4"})})}),s.email&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${s.email}`,"aria-label":"Email agent",children:r.jsx(oi,{className:"h-4 w-4"})})})]})]}),r.jsx(Ze,{className:"overflow-hidden shadow-lg",children:v&&e.playback_url?r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:r.jsx("iframe",{src:C(e.playback_url),title:e.title||"Video message",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>w(!0),children:[e.preview_url||e.thumbnail_url?r.jsx("img",{src:e.preview_url||e.thumbnail_url||"",alt:e.title?`${e.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:q=>{var K;q.currentTarget.style.display="none";const W=(K=q.currentTarget.parentElement)==null?void 0:K.querySelector(".video-fallback");W&&(W.style.display="flex")}}):null,r.jsx("div",{className:"video-fallback w-full h-full items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",style:{display:e.preview_url||e.thumbnail_url?"none":"flex"},children:r.jsx(Wi,{className:"h-16 w-16 text-primary/50"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 group-hover:bg-black/40 transition-colors",children:r.jsx("div",{className:"w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg transform group-hover:scale-105 transition-transform",children:r.jsx(wc,{className:"h-10 w-10 text-primary ml-1"})})}),e.duration_seconds&&r.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:k(e.duration_seconds)})]})}),!F&&r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold",children:e.title||"Video Message"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:v?"Enjoy the video!":"Click to play the video"})]}),!v&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(te,{size:"lg",onClick:()=>w(!0),className:"gap-2",children:[r.jsx(wc,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Out,{shareToken:t,agentName:(s==null?void 0:s.name)||null,hasContact:!!e.contact_id})]})]})]})}function oht(){return P.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(fJe,{})}function lht(){const{token:t}=hd();return P.useEffect(()=>{if(!t)return;const e=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${t}`;window.location.replace(e)},[t]),r.jsx("main",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[r.jsx(sn,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const cht={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},dht={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},YN={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function uht(){var ne,ye,ie,me;const{slugOrId:t}=hd(),[e]=Pd(),{data:n,isLoading:s}=WPe(t||""),i=GPe(),o=_st(),c=e.get("ref"),[a,h]=P.useState(""),[m,x]=P.useState(""),[v,w]=P.useState(""),[k,C]=P.useState(""),[S,T]=P.useState(!1),[I,A]=P.useState(!1),[D,$]=P.useState(null),[F,q]=P.useState(!1);P.useEffect(()=>{c&&o.mutate(c)},[c]);const W=fe=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(fe),K=async fe=>{if(fe.preventDefault(),!(!a.trim()||!v.trim()||!n)){T(!0);try{await i.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:a.trim(),lastName:m.trim(),email:v.trim(),phone:k.trim(),shareToken:c}),A(!0),He.success("Thanks! The agent will be in touch soon.")}catch(ve){console.error("Lead submission error:",ve),He.error(`Failed to submit: ${ve.message||"Please try again"}`)}finally{T(!1)}}},Z=(n==null?void 0:n.photos)||[],re=Z.find(fe=>fe.is_primary)||Z[0],he=()=>{D!==null&&$(D===0?Z.length-1:D-1)},ue=()=>{D!==null&&$(D===Z.length-1?0:D+1)};if(s)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Kr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Kr,{className:"h-10 w-48 mb-6"}),r.jsx(Kr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Kr,{className:"h-12 w-48"}),r.jsx(Kr,{className:"h-6 w-full"}),r.jsx(Kr,{className:"h-6 w-3/4"})]}),r.jsx(Kr,{className:"h-64"})]})]})]});if(!n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(io,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:qA,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(ui,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(te,{asChild:!0,children:r.jsx(io,{to:"/public/listings",children:"Browse All Listings"})})]})]});const je=n.property_address?`${n.property_address} - ${n.city}, ${n.state}`:`${n.city}, ${n.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(Ag,{children:[r.jsxs("title",{children:[je," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${W(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${YN[n.property_type]} in ${n.city}, ${n.state}. ${((ne=n.description)==null?void 0:ne.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:je}),r.jsx("meta",{property:"og:description",content:`${W(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${YN[n.property_type]} in ${n.city}, ${n.state}. View photos, details, and contact the listing agent.`}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${n.slug||n.id}`}),re&&r.jsx("meta",{property:"og:image",content:re.photo_url}),re&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${YN[n.property_type]} for sale`}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:je}),r.jsx("meta",{name:"twitter:description",content:`${W(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),re&&r.jsx("meta",{name:"twitter:image",content:re.photo_url}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"geo.region",content:`US-${n.state}`}),r.jsx("meta",{name:"geo.placename",content:n.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:n.property_address||`${n.city}, ${n.state} Home`,description:n.description||`${YN[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:Z.map(fe=>fe.photo_url),address:{"@type":"PostalAddress",streetAddress:n.property_address||void 0,addressLocality:n.city,addressRegion:n.state,addressCountry:"US"},geo:n.neighborhood?{"@type":"GeoCoordinates",name:n.neighborhood}:void 0,offers:{"@type":"Offer",price:n.price,priceCurrency:"USD",availability:n.status==="sold"?"https://schema.org/SoldOut":n.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:n.bedrooms||void 0,numberOfBathroomsTotal:n.bathrooms||void 0,floorSize:n.square_footage?{"@type":"QuantitativeValue",value:n.square_footage,unitCode:"FTK"}:void 0,yearBuilt:n.year_built||void 0,broker:n.agent?{"@type":"RealEstateAgent",name:n.agent.name,email:n.agent.email,worksFor:(ye=n.agent.brokerage)!=null&&ye.name?{"@type":"RealEstateAgent",name:n.agent.brokerage.name}:void 0}:void 0})})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(io,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:qA,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(io,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),Z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>$(0),children:r.jsx("img",{src:re==null?void 0:re.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${YN[n.property_type]} main photo`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:Z.slice(1,5).map((fe,ve)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>$(ve+1),children:[r.jsx("img",{src:fe.photo_url,alt:`${n.property_address||n.city} - Photo ${ve+2} of ${Z.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ve===3&&Z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",Z.length-5," more"]})]},fe.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Ft,{className:`${cht[n.status]} text-white border-0`,children:dht[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:W(n.price)}),n.property_address&&r.jsx("p",{className:"text-xl font-medium",children:n.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(cl,{className:"h-4 w-4"}),n.city,", ",n.state,n.neighborhood&&` • ${n.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[n.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(zf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),n.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ff,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),n.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(cm,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),n.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ft,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),YN[n.property_type]]}),n.lot_size&&r.jsxs(Ft,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Ft,{variant:"secondary",children:"HOA"})]}),n.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[n.video&&n.video.playback_url&&r.jsx(Ze,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(et,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>q(!0),children:[n.video.thumbnail_url?r.jsx("img",{src:n.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:r.jsx(Wi,{className:"h-12 w-12 text-primary"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-black/40 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-white/90 group-hover:bg-white flex items-center justify-center transition-colors shadow-lg",children:r.jsx(wc,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(te,{onClick:()=>q(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(wc,{className:"h-4 w-4"}),"Watch Video Tour"]}),n.video.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:n.video.title})]})]})}),n.agent&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(jc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((ie=n.agent.brokerage)==null?void 0:ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(Ze,{className:"border-primary",children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{children:I?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(oi,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:K,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"firstName",children:"First Name *"}),r.jsx(xt,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:fe=>h(fe.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"lastName",children:"Last Name"}),r.jsx(xt,{id:"lastName",type:"text",placeholder:"Doe",value:m,onChange:fe=>x(fe.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"email",children:"Email *"}),r.jsx(xt,{id:"email",type:"email",placeholder:"you@example.com",value:v,onChange:fe=>w(fe.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone"}),r.jsx(xt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:k,onChange:fe=>C(fe.target.value)})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:S,children:S?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Ur,{open:D!==null,onOpenChange:()=>$(null),children:r.jsxs(Br,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Yr,{className:"sr-only",children:r.jsx(Zr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>$(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Es,{className:"h-5 w-5"})}),D!==null&&Z[D]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Z[D].photo_url,alt:`Photo ${D+1}`,className:"w-full max-h-[80vh] object-contain"}),Z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:he,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(id,{className:"h-6 w-6"})}),r.jsx("button",{onClick:ue,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ka,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[D+1," / ",Z.length]})]})]})]})}),r.jsx(Ur,{open:F,onOpenChange:q,children:r.jsxs(Br,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(Yr,{className:"sr-only",children:r.jsx(Zr,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>q(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Es,{className:"h-5 w-5"})}),((me=n==null?void 0:n.video)==null?void 0:me.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:n.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function LM({banners:t,autoPlayInterval:e=5e3,className:n}){const[s,i]=P.useState(0),[o,c]=P.useState(!1),a=P.useCallback(()=>{i(v=>(v+1)%t.length)},[t.length]),h=P.useCallback(()=>{i(v=>(v-1+t.length)%t.length)},[t.length]),m=P.useCallback(v=>{i(v)},[]);if(P.useEffect(()=>{if(t.length<=1||o)return;const v=setInterval(a,e);return()=>clearInterval(v)},[t.length,o,e,a]),!t||t.length===0)return null;const x=t[s];return r.jsxs("div",{className:$t("relative w-full overflow-hidden rounded-xl",n),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[r.jsxs("div",{className:"relative aspect-[21/9] md:aspect-[3/1] w-full",children:[r.jsxs("div",{className:"absolute inset-0 transition-opacity duration-500",children:[r.jsx("img",{src:x.image_url,alt:x.title,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"})]}),r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-8 text-white",children:[r.jsx("h2",{className:"text-xl md:text-3xl font-bold mb-2 drop-shadow-lg",children:x.title}),x.description&&r.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:x.description}),x.link_url&&r.jsx("a",{href:x.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:r.jsx(te,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:x.link_text||"Learn More"})})]}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:$t("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:h,children:r.jsx(id,{className:"h-6 w-6"})}),r.jsx(te,{variant:"ghost",size:"icon",className:$t("absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:a,children:r.jsx(Ka,{className:"h-6 w-6"})})]})]}),t.length>1&&r.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:t.map((v,w)=>r.jsx("button",{onClick:()=>m(w),className:$t("w-2 h-2 rounded-full transition-all duration-300",w===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${w+1}`},w))})]})}function hht(t){return"EST"}function ute(t){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(t),s=hht();return`${n} ${s}`}function w4(t){const e=new Date,n=new Date(t),s=rlt(n,-15),i=che(n,1);return e>i?"ended":Hje(e,{start:n,end:i})?"live":Hje(e,{start:s,end:n})?"starting_soon":"upcoming"}function sxe(t){const e=w4(t);return e==="starting_soon"||e==="live"}const nke=sxe,fht=({events:t,registrations:e,onNavigateToEvents:n})=>{const[s,i]=P.useState(new Date);P.useEffect(()=>{const k=setInterval(()=>{i(new Date)},3e4);return()=>clearInterval(k)},[]);const o=t.filter(k=>sxe(k.event_date));if(o.length===0)return null;const c=o[0],a=w4(c.event_date),h=e.find(k=>k.event_id===c.id),m=(h==null?void 0:h.zoom_join_url)||c.zoom_link,x=!!h,v=a==="live",w=v?{container:"from-red-500/10 via-red-500/5 to-primary/10 border-red-500/30",pulse:"from-red-500/5",indicator:"bg-red-500",text:"text-red-500",button:"bg-red-500 hover:bg-red-600",outlineButton:"border-red-500/50 text-red-500 hover:bg-red-500/10"}:{container:"from-amber-500/10 via-amber-500/5 to-primary/10 border-amber-500/30",pulse:"from-amber-500/5",indicator:"bg-amber-500",text:"text-amber-500",button:"bg-amber-500 hover:bg-amber-600",outlineButton:"border-amber-500/50 text-amber-500 hover:bg-amber-500/10"};return r.jsxs("div",{className:`relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r ${w.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${w.pulse} to-transparent animate-pulse`}),r.jsx("div",{className:"relative p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex items-center justify-center",children:[r.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${w.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${w.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${w.text} font-bold text-sm uppercase tracking-wider`,children:v?r.jsxs(r.Fragment,{children:[r.jsx(ij,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Gi,{className:"h-4 w-4"}),"Starting Soon"]})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:c.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:v?`Started at ${ute(new Date(c.event_date))}`:`Starts at ${ute(new Date(c.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(te,{onClick:()=>window.open(m,"_blank"),className:`${w.button} text-white gap-2`,children:[r.jsx($s,{className:"h-4 w-4"}),v?"Join Now":"Join When Live"]}):r.jsxs(te,{variant:"outline",onClick:n,className:`${w.outlineButton} gap-2`,children:[r.jsx(fs,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var ixe="Progress",axe=100,[pht]=Zl(ixe),[mht,ght]=pht(ixe),$Oe=P.forwardRef((t,e)=>{const{__scopeProgress:n,value:s=null,max:i,getValueLabel:o=xht,...c}=t;(i||i===0)&&!ske(i)&&console.error(yht(`${i}`,"Progress"));const a=ske(i)?i:axe;s!==null&&!ike(s,a)&&console.error(vht(`${s}`,"Progress"));const h=ike(s,a)?s:null,m=hte(h)?o(h,a):void 0;return r.jsx(mht,{scope:n,value:h,max:a,children:r.jsx(Dn.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":hte(h)?h:void 0,"aria-valuetext":m,role:"progressbar","data-state":VOe(h,a),"data-value":h??void 0,"data-max":a,...c,ref:e})})});$Oe.displayName=ixe;var UOe="ProgressIndicator",qOe=P.forwardRef((t,e)=>{const{__scopeProgress:n,...s}=t,i=ght(UOe,n);return r.jsx(Dn.div,{"data-state":VOe(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...s,ref:e})});qOe.displayName=UOe;function xht(t,e){return`${Math.round(t/e*100)}%`}function VOe(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function hte(t){return typeof t=="number"}function ske(t){return hte(t)&&!isNaN(t)&&t>0}function ike(t,e){return hte(t)&&!isNaN(t)&&t<=e&&t>=0}function yht(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${axe}\`.`}function vht(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${axe} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var HOe=$Oe,_ht=qOe;const Bc=P.forwardRef(({className:t,value:e,...n},s)=>r.jsx(HOe,{ref:s,className:$t("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:r.jsx(_ht,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Bc.displayName=HOe.displayName;function bht(){const{user:t,isBrokerageManager:e}=zr(),[n,s]=P.useState([]),[i,o]=P.useState([]),[c,a]=P.useState(!1),[h,m]=P.useState(!0),x=e?"brokerage_manager":"agent";P.useEffect(()=>{if(!(t!=null&&t.id)){m(!1);return}v()},[t==null?void 0:t.id,x]);const v=async()=>{if(t!=null&&t.id)try{const{data:$,error:F}=await ee.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(F)throw F;const{data:q,error:W}=await ee.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",t.id);if(W)throw W;const{data:K,error:Z}=await ee.from("onboarding_checklist_dismissed").select("id").eq("user_id",t.id).maybeSingle();if(Z)throw Z;s($||[]),o(q||[]),a(!!K),$&&$.length>0&&await w($,q||[])}catch($){console.error("Error fetching checklist data:",$)}finally{m(!1)}},w=async($,F)=>{var Le,Qe;if(!(t!=null&&t.id))return;const q=F.map(Fe=>Fe.item_id),W=$.filter(Fe=>!q.includes(Fe.id));if(W.length===0)return;const[K,Z,re,he,ue,je,ne,ye,ie,me,fe,ve,Ie,Se]=await Promise.all([ee.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle(),ee.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",t.id),ee.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",t.id),ee.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",t.id),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","template"),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","academy_video"),ee.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","toolbox"),ee.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),ee.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),ee.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",t.id),ee.from("innercircle_contacts").select("id").eq("owner_user_id",t.id)]),oe={},ae=(Le=K.data)==null?void 0:Le.brokerage_id;oe.share_resource=(Z.count||0)>0,oe.post_community=(re.count||0)>0,oe.register_event=(he.count||0)>0,oe.view_template=(ue.count||0)>0,oe.watch_academy=(je.count||0)>0,oe.use_toolbox=(ne.count||0)>0,oe.launch_app=(ye.count||0)>0,oe.add_contact=(ie.count||0)>0,oe.create_video=(me.count||0)>0,oe.complete_touch=(fe.count||0)>0,oe.add_transaction=(ve.count||0)>0,oe.add_listing=(Ie.count||0)>0;const Ne=((Qe=Se.data)==null?void 0:Qe.map(Fe=>Fe.id))||[],Te=[];ae?Te.push(ee.from("profiles").select("id").eq("brokerage_id",ae).neq("id",t.id).then(Fe=>{var Ce;oe.add_agent=(((Ce=Fe.data)==null?void 0:Ce.length)||0)>0})):oe.add_agent=!1,Ne.length>0?(Te.push(ee.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Ne).then(Fe=>{oe.add_plan=(Fe.count||0)>0})),Te.push(ee.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Ne).then(Fe=>{oe.schedule_popby=(Fe.count||0)>0}))):(oe.add_plan=!1,oe.schedule_popby=!1),await Promise.all(Te);const Be=W.filter(Fe=>oe[Fe.action_type]);if(Be.length>0){const Fe=Be.map(Je=>({user_id:t.id,item_id:Je.id})),{error:Ce}=await ee.from("onboarding_checklist_progress").upsert(Fe,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!Ce){const Je=Be.map(Ae=>({item_id:Ae.id,completed_at:new Date().toISOString()}));o(Ae=>[...Ae,...Je])}}},k=async $=>{if(t!=null&&t.id)try{const{error:F}=await ee.from("onboarding_checklist_progress").insert({user_id:t.id,item_id:$});if(F)throw F;o(q=>[...q,{item_id:$,completed_at:new Date().toISOString()}])}catch(F){console.error("Error marking item complete:",F)}},C=async()=>{if(t!=null&&t.id)try{const{error:$}=await ee.from("onboarding_checklist_dismissed").insert({user_id:t.id});if($)throw $;a(!0)}catch($){console.error("Error dismissing checklist:",$)}},S=i.length,T=n.length,I=T>0&&S>=T,A=T>0?S/T*100:0;return{items:n,progress:i,isDismissed:c,loading:h,completedCount:S,totalCount:T,isComplete:I,progressPercentage:A,isItemComplete:$=>i.some(F=>F.item_id===$),markComplete:k,dismiss:C,refetch:v}}const wht={add_agent:r.jsx(fs,{className:"h-4 w-4"}),share_resource:r.jsx(Xd,{className:"h-4 w-4"}),post_community:r.jsx(vl,{className:"h-4 w-4"}),register_event:r.jsx(li,{className:"h-4 w-4"}),view_template:r.jsx(n0,{className:"h-4 w-4"}),watch_academy:r.jsx(e1,{className:"h-4 w-4"}),use_toolbox:r.jsx(Fx,{className:"h-4 w-4"}),launch_app:r.jsx(_T,{className:"h-4 w-4"})};function jht(){const{items:t,isDismissed:e,loading:n,completedCount:s,totalCount:i,isComplete:o,progressPercentage:c,isItemComplete:a,markComplete:h,dismiss:m}=bht(),[x,v]=P.useState(!0);return n||e||i===0||o?null:r.jsxs(Ze,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(ug,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Get Started with LevelUp"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>v(!x),className:"h-8 w-8 p-0",children:x?r.jsx(K0,{className:"h-4 w-4"}):r.jsx(Tu,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(Es,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Progress"}),r.jsxs("span",{className:"font-medium",children:[s," of ",i," complete"]})]}),r.jsx(Bc,{value:c,className:"h-2"})]})]}),x&&r.jsx(et,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:t.map(w=>{const k=a(w.id);return r.jsxs("div",{className:$t("flex items-start gap-3 p-3 rounded-lg transition-colors",k?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>!k&&h(w.id),children:[r.jsx("div",{className:"mt-0.5",children:k?r.jsx(Ha,{className:"h-5 w-5 text-primary"}):r.jsx(Au,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:wht[w.action_type]||r.jsx(Au,{className:"h-4 w-4"})}),r.jsx("span",{className:$t("font-medium",k&&"line-through text-muted-foreground"),children:w.title})]}),w.description&&r.jsx("p",{className:$t("text-sm text-muted-foreground mt-1",k&&"line-through"),children:w.description})]})]},w.id)})})})]})}const Ig=()=>rr({queryKey:["relationship-types"],queryFn:async()=>{const{data:t,error:e}=await ee.from("relationship_types").select("*").order("sort_order");if(e)throw e;return t}}),vm=t=>{const{user:e}=zr(),n=1e3,s=async i=>{const o=[];let c=0;for(;;){const{data:a,error:h}=await i.range(c,c+n-1);if(h)throw h;const m=a??[];if(o.push(...m),m.length{let i=ee.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).order("created_at",{ascending:!1}).order("first_name");return await s(i)},enabled:!!e})},kht=t=>rr({queryKey:["innercircle-contact",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",t).maybeSingle();if(n)throw n;return e},enabled:!!t}),WOe=()=>{const{user:t}=zr();return rr({queryKey:["innercircle-contact-counts",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return e==null||e.forEach(i=>{var o;(o=i.tags)==null||o.forEach(c=>{s[c.relationship_type_id]=(s[c.relationship_type_id]||0)+1})}),s},enabled:!!t})},GOe=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{tagIds:s,...i}=n,o={...i,birthday:i.birthday||null,home_anniversary:i.home_anniversary||null,owner_user_id:e.id},{data:c,error:a}=await ee.from("innercircle_contacts").insert(o).select().single();if(a)throw a;if(s&&s.length>0){const{error:h}=await ee.from("innercircle_contact_tags").insert(s.map(m=>({contact_id:c.id,relationship_type_id:m})));if(h)throw h}return c},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Yi({title:"Contact created successfully"})},onError:n=>{Yi({title:"Error creating contact",description:n.message,variant:"destructive"})}})},KOe=()=>{const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{tagIds:s,tags:i,...o}=n,c={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:a,error:h}=await ee.from("innercircle_contacts").update(c).eq("id",e).select().single();if(h)throw h;if(s!==void 0&&(await ee.from("innercircle_contact_tags").delete().eq("contact_id",e),s.length>0)){const{error:m}=await ee.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:e,relationship_type_id:x})));if(m)throw m}return a},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Yi({title:"Contact updated successfully"})},onError:e=>{Yi({title:"Error updating contact",description:e.message,variant:"destructive"})}})},ZOe=()=>{const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("innercircle_contacts").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Yi({title:"Contact deleted successfully"})},onError:e=>{Yi({title:"Error deleting contact",description:e.message,variant:"destructive"})}})},oxe=()=>rr({queryKey:["action-types"],queryFn:async()=>{const{data:t,error:e}=await ee.from("action_types").select("*").order("sort_order");if(e)throw e;return t}}),Nht=t=>rr({queryKey:["action-scripts",t],queryFn:async()=>{let e=ee.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await e;if(s)throw s;return n}}),Sht=()=>rr({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:t,error:e}=await ee.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(e)throw e;return t}}),Cht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async({name:n,description:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:e.id,active:!0,is_template:!1}).select().single();if(o)throw o;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Yi({title:"Plan created successfully"})},onError:n=>{Yi({title:"Error creating plan",description:n.message,variant:"destructive"})}})},Mht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!i)throw new Error("Source plan not found");const{data:c,error:a}=await ee.from("touchpoint_plans").insert({name:s,description:i.description,owner_user_id:e.id,active:!0,is_template:!1}).select().single();if(a)throw a;if(i.items&&i.items.length>0){const h=i.items.map(x=>({plan_id:c.id,month_number:x.month_number,action_type_id:x.action_type_id,default_script_id:x.default_script_id,notes:x.notes})),{error:m}=await ee.from("touchpoint_plan_items").insert(h);if(m)throw m}return c},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Yi({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{Yi({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},Tht=()=>{const t=Qr();return dr({mutationFn:async({id:e,name:n,description:s})=>{const{data:i,error:o}=await ee.from("touchpoint_plans").update({name:n,description:s}).eq("id",e).select().single();if(o)throw o;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Yi({title:"Plan updated successfully"})}})},Aht=()=>{const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("touchpoint_plans").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Yi({title:"Plan deleted successfully"})}})},Eht=()=>{const t=Qr();return dr({mutationFn:async({planId:e,items:n})=>{if(await ee.from("touchpoint_plan_items").delete().eq("plan_id",e),n.length>0){const{error:s}=await ee.from("touchpoint_plan_items").insert(n.map(i=>({plan_id:e,month_number:i.month_number,action_type_id:i.action_type_id,default_script_id:i.default_script_id||null,notes:i.notes})));if(s)throw s}},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Yi({title:"Plan schedule updated"})}})},Iht=()=>{const t=Qr();return dr({mutationFn:async({actionTypeId:e,title:n,scriptBody:s,emailSubject:i,tone:o})=>{const{data:c,error:a}=await ee.from("action_scripts").insert({action_type_id:e,title:n,script_body:s,email_subject:i||null,tone:o||null,active:!0}).select().single();if(a)throw a;return c},onSuccess:()=>{t.invalidateQueries({queryKey:["action-scripts"]}),Yi({title:"Script created successfully"})},onError:e=>{Yi({title:"Error creating script",description:e.message,variant:"destructive"})}})},Pht=()=>{const{user:t}=zr();return rr({queryKey:["user-plan-enrollments",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return e},enabled:!!t})},Lht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async({planId:n,relationshipTypeId:s,active:i})=>{const{data:o}=await ee.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:c}=await ee.from("user_plan_enrollments").update({active:i}).eq("id",o.id);if(c)throw c}else if(i){const{error:c}=await ee.from("user_plan_enrollments").insert({owner_user_id:e.id,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(c)throw c}},onSuccess:()=>{t.invalidateQueries({queryKey:["user-plan-enrollments"]}),Yi({title:"Plan enrollment updated"})}})},use=(t=7)=>{const{user:e}=zr();return rr({queryKey:["contact-touch-logs",e==null?void 0:e.id,t],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-t);const{data:s,error:i}=await ee.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(i)throw i;return s},enabled:!!e})},YOe=()=>{const{user:t}=zr();return rr({queryKey:["contacts-last-touch",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(n)throw n;const s={};return e==null||e.forEach(i=>{s[i.contact_id]||(s[i.contact_id]=i.completed_at)}),s},enabled:!!t})},Oht=(t=90)=>{const{data:e}=vm(),{data:n}=YOe();if(!e||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-t);const i=e.filter(o=>{const c=n[o.id];return c?new Date(c){const t=Qr(),{user:e}=zr();return dr({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:i,notes:o})=>{const{data:c,error:a}=await ee.from("contact_touch_logs").insert({owner_user_id:e.id,contact_id:n,action_type_id:s,script_used_id:i,notes:o,completed_at:new Date().toISOString()}).select().single();if(a)throw a;return c},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts-last-touch"]}),t.invalidateQueries({queryKey:["today-actions"]}),Yi({title:"Action completed!"})}})},QOe="agentos_weekly_touch_goal",ake=20,fte=()=>{if(typeof window>"u")return ake;const t=localStorage.getItem(QOe);if(t){const e=parseInt(t,10);if(!isNaN(e)&&e>0)return e}return ake},JOe=t=>{localStorage.setItem(QOe,t.toString())},e8e=()=>{const{data:t}=use(7),e=new Date;e.setHours(0,0,0,0);const n=new Date(e);n.setDate(e.getDate()-e.getDay());const s=(t==null?void 0:t.filter(c=>new Date(c.completed_at)>=n).length)||0;let i=0;if(t&&t.length>0){const c=new Set(t.map(h=>new Date(h.completed_at).toDateString()));let a=new Date(e);for(;c.has(a.toDateString());)i++,a.setDate(a.getDate()-1)}const o=fte();return{actionsThisWeek:s,weeklyGoal:o,streak:i,progress:Math.min(s/o*100,100)}},Dht=()=>{const{user:t}=zr();return rr({queryKey:["contact-plan-cycles",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(n)throw n;return e},enabled:!!t})},Rht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async()=>{const{data:n}=await ee.from("user_plan_enrollments").select("*").eq("active",!0);if(!n||n.length===0)return;const{data:s}=await ee.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!s)return;const{data:i}=await ee.from("contact_plan_cycles").select("contact_id, plan_id"),o=new Set((i==null?void 0:i.map(a=>`${a.contact_id}-${a.plan_id}`))||[]),c=[];for(const a of s)for(const h of a.tags||[]){const m=n.find(x=>x.relationship_type_id===h.relationship_type_id);m&&!o.has(`${a.id}-${m.plan_id}`)&&c.push({contact_id:a.id,plan_id:m.plan_id,relationship_type_id:h.relationship_type_id})}if(c.length>0){const{error:a}=await ee.from("contact_plan_cycles").insert(c);if(a)throw a}return c.length},onSuccess:n=>{t.invalidateQueries({queryKey:["contact-plan-cycles"]}),n&&n>0&&Yi({title:`${n} contact(s) enrolled in plans`})}})},t8e=()=>{const{user:t}=zr(),{data:e}=Dht(),{data:n}=use(30);return rr({queryKey:["today-actions",t==null?void 0:t.id,e==null?void 0:e.length,n==null?void 0:n.length],queryFn:async()=>{var w;if(!e||e.length===0)return[];const s=new Date,i=[],o=new Date(s.getFullYear(),s.getMonth(),1),c=new Set((n==null?void 0:n.filter(k=>new Date(k.completed_at)>=o).map(k=>`${k.contact_id}-${k.action_type_id}`))||[]);for(const k of e){if(!((w=k.plan)!=null&&w.items)||k.plan.items.length===0||!k.contact)continue;const C=new Date(k.cycle_start_date),T=Math.floor((s.getTime()-C.getTime())/(30.44*24*60*60*1e3))%12+1,I=k.plan.items.find(A=>A.month_number===T);if(I&&I.action_type){const A=`${k.contact_id}-${I.action_type_id}`;if(!c.has(A)){const{data:D}=await ee.from("relationship_types").select("name").eq("id",k.relationship_type_id).single();i.push({contact:k.contact,actionType:I.action_type,script:I.default_script||void 0,planName:k.plan.name,relationshipTypeName:(D==null?void 0:D.name)||"",monthNumber:T})}}}const a=5,h=s.getDate(),m=i.sort((k,C)=>k.contact.first_name.localeCompare(C.contact.first_name)),x=(h-1)%Math.max(1,m.length);return[...m.slice(x),...m.slice(0,x)].slice(0,a)},enabled:!!t&&!!e})};function Fht(){const t=ts(),{data:e,isLoading:n}=t8e(),{data:s}=vm(),i=e8e(),[o,c]=P.useState(fte()),[a,h]=P.useState(""),[m,x]=P.useState(!1);P.useEffect(()=>{c(fte())},[]);const v=()=>{const q=parseInt(a,10);if(isNaN(q)||q<1){Yi({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}c(q),JOe(q),x(!1),Yi({title:"Goal updated",description:`Weekly touch goal set to ${q}`})},w=()=>{h(o.toString()),x(!0)},k=Qh(new Date),C=zl(k,7),S=q=>{if(!q)return null;const W=new Date(q);return new Date(k.getFullYear(),W.getMonth(),W.getDate())},T=(s==null?void 0:s.map(q=>{const W=S(q.birthday),K=S(q.home_anniversary),Z=[];return W&&W>=k&&W<=C&&Z.push({contact:q,type:"birthday",date:W,isToday:Hl(W,k)}),K&&K>=k&&K<=C&&Z.push({contact:q,type:"anniversary",date:K,isToday:Hl(K,k)}),Z}).flat().sort((q,W)=>q.date.getTime()-W.date.getTime()).slice(0,3))||[],I=(s==null?void 0:s.filter(q=>{const W=S(q.birthday),K=S(q.home_anniversary);return W&&Hl(W,k)||K&&Hl(K,k)}).length)||0,A=(e==null?void 0:e.length)||0,D=I+A,$=(i==null?void 0:i.actionsThisWeek)||0,F=(i==null?void 0:i.streak)||0;return n?r.jsx(Ze,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(Ze,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:F>0&&r.jsxs(Ft,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(qh,{className:"h-3 w-3"}),F," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[D>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[D," tasks"]})," for today"]}):"No tasks for today",$>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:$})," touches this week"]})]})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control/contacts?new=true")},children:[r.jsx(d1,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control")},children:[r.jsx(Ma,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:q=>{q.stopPropagation(),t("/mission-control/video/record")},children:[r.jsx(Wi,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control/popbys")},children:[r.jsx(cl,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(te,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:q=>{q.stopPropagation(),t("/mission-control/pipeline")},children:[r.jsx(t1,{className:"h-3.5 w-3.5"}),"Pipeline"]})]}),r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rx,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Ur,{open:m,onOpenChange:x,children:[r.jsx(Oo,{asChild:!0,children:r.jsx("button",{onClick:w,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(od,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Br,{className:"sm:max-w-[360px]",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Set Weekly Goal"}),r.jsx(us,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(xt,{id:"weekly-goal",type:"number",min:"1",value:a,onChange:q=>h(q.target.value),placeholder:"20",onKeyDown:q=>{q.key==="Enter"&&v()}})]}),r.jsx(te,{onClick:v,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:$}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(Bc,{value:Math.min($/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),$>=o&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[r.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),$0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-$," more to hit your weekly goal"]})]}),T.length>0&&r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Uh,{className:"h-4 w-4 text-pink-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),r.jsx("div",{className:"space-y-2",children:T.map((q,W)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${q.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:K=>{K.stopPropagation(),t(`/mission-control/contacts/${q.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[q.type==="birthday"?r.jsx(Uh,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(ui,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[q.contact.first_name," ",q.contact.last_name]}),q.isToday&&r.jsx(Ft,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.isToday?q.type==="birthday"?"🎂":"🏠":un(q.date,"EEE, MMM d")}),r.jsx(Ka,{className:"h-3 w-3"})]})]},`${q.contact.id}-${q.type}-${W}`))})]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>t("/mission-control"),children:["Open Agent OS",r.jsx(Ho,{className:"h-4 w-4"})]})]})]})}const r8e=()=>rr({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:t,error:e}=await ee.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(e)throw e;return(t==null?void 0:t.enabled)??!1}}),n8e=t=>{const{user:e,brokerageId:n}=zr();return rr({queryKey:["listings",t,n],queryFn:async()=>{let s=ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);t!=null&&t.status&&(s=s.eq("status",t.status)),t!=null&&t.propertyType&&(s=s.eq("property_type",t.propertyType)),t!=null&&t.city&&(s=s.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(s=s.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(s=s.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(s=s.eq("open_to_referrals",!0));const{data:i,error:o}=await s;if(o)throw o;let c=i||[];if(n){const{data:a}=await ee.from("profiles").select("id").eq("brokerage_id",n);if(a&&a.length>0){const h=a.map(v=>v.id);let m=ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("share_with_brokerage",!0).eq("is_public",!1).in("agent_id",h);t!=null&&t.status&&(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:x}=await m;if(x){const v=new Set(c.map(k=>k.id)),w=x.filter(k=>!v.has(k.id));c=[...c,...w]}}}switch(t==null?void 0:t.sortBy){case"updated":c.sort((a,h)=>new Date(h.updated_at).getTime()-new Date(a.updated_at).getTime());break;case"price_asc":c.sort((a,h)=>a.price-h.price);break;case"price_desc":c.sort((a,h)=>h.price-a.price);break;default:c.sort((a,h)=>new Date(h.created_at).getTime()-new Date(a.created_at).getTime())}return c}})},lxe=()=>{const{user:t}=zr();return rr({queryKey:["my-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})},s8e=t=>{const{user:e}=zr();return rr({queryKey:["listing",t],queryFn:async()=>{const{data:n,error:s}=await ee.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",t).single();if(s)throw s;return e&&await ee.from("listing_views").insert({listing_id:t,viewer_id:e.id}),n},enabled:!!t})},zht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("listings").insert({...n,agent_id:e.id}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Bht=()=>{const t=Qr();return dr({mutationFn:async({agentId:e,...n})=>{const{data:s,error:i}=await ee.from("listings").insert({...n,agent_id:e}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["brokerage-listings"]})}})},$ht=()=>{const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("listings").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:e=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["listing",e.id]})}})},i8e=()=>{const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("listings").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Uht=()=>{const t=Qr();return dr({mutationFn:async({listingId:e,photoUrl:n,isPrimary:s=!1})=>{const{data:i,error:o}=await ee.from("listing_photos").insert({listing_id:e,photo_url:n,is_primary:s}).select().single();if(o)throw o;return i},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e.listing_id]}),t.invalidateQueries({queryKey:["my-listings"]})}})},qht=()=>{const t=Qr();return dr({mutationFn:async({photoId:e,listingId:n})=>{const{error:s}=await ee.from("listing_photos").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Vht=()=>{const{user:t}=zr();return rr({queryKey:["saved-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",t.id);if(n)throw n;return e},enabled:!!t})},a8e=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await ee.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await ee.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await ee.from("listing_saves").insert({listing_id:n,agent_id:e.id}),{saved:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["saved-listings"]}),t.invalidateQueries({queryKey:["listings"]})}})},o8e=t=>{const{user:e}=zr();return rr({queryKey:["listing-saved",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await ee.from("listing_saves").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Hht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await ee.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await ee.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await ee.from("listing_follows").insert({listing_id:n,agent_id:e.id}),{following:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-following"]})}})},Wht=t=>{const{user:e}=zr();return rr({queryKey:["listing-following",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await ee.from("listing_follows").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Ght=()=>{const{user:t}=zr();return dr({mutationFn:async({listingId:e,shareType:n})=>{if(!t)throw new Error("Not authenticated");const{error:s}=await ee.from("listing_shares").insert({listing_id:e,sharing_agent_id:t.id,share_type:n});if(s)throw s}})},Kht=()=>{const{user:t}=zr();return rr({queryKey:["my-referrals",t==null?void 0:t.id],queryFn:async()=>{if(!t)return{sent:[],received:[]};const[e,n]=await Promise.all([ee.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",t.id).order("created_at",{ascending:!1}),ee.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",t.id).order("created_at",{ascending:!1})]);return{sent:e.data||[],received:n.data||[]}},enabled:!!t})},Zht=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async({listingId:n,listingAgentId:s,buyerName:i,buyerType:o,notes:c})=>{if(!e)throw new Error("Not authenticated");const{data:a,error:h}=await ee.from("listing_referrals").insert({listing_id:n,sender_agent_id:e.id,listing_agent_id:s,buyer_name:i,buyer_type:o,notes:c}).select().single();if(h)throw h;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["my-referrals"]})}})},Yht=()=>rr({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:t}=await ee.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),e=new Map;t==null||t.forEach(c=>{var m;const a=c.sharing_agent_id;if(!a)return;const h=e.get(a);h?h.count++:e.set(a,{name:((m=c.profiles)==null?void 0:m.name)||"Unknown",count:1})});const n=Array.from(e.entries()).map(([c,a])=>({agentId:c,...a})).sort((c,a)=>a.count-c.count).slice(0,10),{data:s}=await ee.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),i=new Map;s==null||s.forEach(c=>{var h;const a=i.get(c.agent_id);a?a.count++:i.set(c.agent_id,{name:((h=c.agent)==null?void 0:h.name)||"Unknown",count:1})});const o=Array.from(i.entries()).map(([c,a])=>({agentId:c,...a})).sort((c,a)=>a.count-c.count).slice(0,10);return{topSharers:n,topListers:o}}}),Xht=({className:t,variant:e="default"})=>r.jsx(Ft,{variant:"outline",className:$t("text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0 h-4",e==="default"?"border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10":"border-muted-foreground/30 text-muted-foreground",t),children:"Beta"}),Qht={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"},Jht={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function eft(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function tft(){const t=ts(),{data:e,isLoading:n}=r8e(),{data:s,isLoading:i}=n8e({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(x=>x.is_approved&&x.is_public))||[],c=o.filter(x=>x.is_featured),a=o.filter(x=>!x.is_featured),h=[...c,...a].slice(0,6),m=n||i;return!m&&!e?null:m?r.jsx(Ze,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(Xht,{})]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),h.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(ui,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),r.jsx(te,{variant:"link",size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:h.map(x=>{var w,k;const v=((w=x.photos)==null?void 0:w.find(C=>C.is_primary))||((k=x.photos)==null?void 0:k[0]);return r.jsxs("div",{onClick:()=>t(`/mission-control/listings/${x.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden relative",children:[v!=null&&v.photo_url?r.jsx("img",{src:v.photo_url,alt:`${x.city}, ${x.state}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(ui,{className:"h-8 w-8 text-muted-foreground/50"})}),x.is_featured&&r.jsx("div",{className:"absolute top-1.5 left-1.5",children:r.jsxs(Ft,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(Bs,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Ft,{className:`text-[10px] px-1.5 py-0.5 ${Qht[x.status]}`,children:Jht[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:eft(x.price)}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[x.city,", ",x.state]}),(x.bedrooms||x.bathrooms)&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[x.bedrooms&&`${x.bedrooms} bed`,x.bedrooms&&x.bathrooms&&" · ",x.bathrooms&&`${x.bathrooms} bath`]})]})]},x.id)})})]})}function l8e(t=10,e){return rr({queryKey:["event-leaderboard",t,e],queryFn:async()=>{const{data:n}=await ee.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(w=>w.user_id))||[]);let i=null;if(e){const{data:w}=await ee.from("profiles").select("id").eq("brokerage_id",e);i=new Set((w==null?void 0:w.map(k=>k.id))||[])}const{data:o,error:c}=await ee.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(t+s.size+50);if(c)throw c;if(!o||o.length===0)return[];let a=o.filter(w=>!s.has(w.user_id));i&&(a=a.filter(w=>i.has(w.user_id)));const h=a.slice(0,t),m=h.map(w=>w.user_id),{data:x}=await ee.from("profiles").select("id, name").in("id",m),v=new Map((x==null?void 0:x.map(w=>[w.id,{name:w.name}]))||[]);return h.map(w=>({user_id:w.user_id,total_points:w.total_points,total_events_attended:w.total_events_attended,current_streak:w.current_streak,profile:v.get(w.user_id)||null}))}})}function c8e(t){return rr({queryKey:["user-attendance-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await ee.from("agent_attendance_stats").select("*").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return e},enabled:!!t})}function d8e(t){return rr({queryKey:["user-badges",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("agent_badges").select("*").eq("user_id",t).order("earned_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function u8e(t,e){return rr({queryKey:["user-rank",t,e],queryFn:async()=>{if(!t)return null;const{data:n}=await ee.from("agent_attendance_stats").select("total_points").eq("user_id",t).single();if(!n)return null;const{data:s}=await ee.from("user_roles").select("user_id").eq("role","admin"),i=new Set((s==null?void 0:s.map(h=>h.user_id))||[]),{data:o,error:c}=await ee.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(c)throw c;let a=(o==null?void 0:o.filter(h=>!i.has(h.user_id)))||[];if(e){const{data:h}=await ee.from("profiles").select("id").eq("brokerage_id",e),m=new Set((h==null?void 0:h.map(x=>x.id))||[]);a=a.filter(x=>m.has(x.user_id))}return a.length+1},enabled:!!t})}function rft(){const{user:t,brokerageId:e,isAdmin:n}=zr();ts();const s=!!e,[i,o]=P.useState("brokerage"),c=()=>{if(n)return null;if(s)return i==="global"?null:e},{data:a,isLoading:h}=l8e(5,c()),{data:m}=c8e(t==null?void 0:t.id),{data:x}=u8e(t==null?void 0:t.id,c()),{data:v}=d8e(t==null?void 0:t.id),w=n||s,k=()=>n?"Agent Leaderboard":s?i==="global"?"All LevelUp":"My Brokerage":"My Points";if(h)return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-yellow-500"}),k()]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-2",children:[...Array(w?5:3)].map((S,T)=>r.jsx(Kr,{className:"h-10 w-full"},T))})})]});const C=S=>S===0?r.jsx(qa,{className:"h-4 w-4 text-yellow-500 mx-auto"}):S===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):S===2?r.jsx("span",{className:"text-sm font-medium text-amber-600",children:"3"}):r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:S+1});if(w){const S=(a==null?void 0:a.slice(0,5))||[];return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-yellow-500"}),k()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(te,{variant:i==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(te,{variant:i==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(et,{children:[!n&&m&&r.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),r.jsxs("span",{className:"font-bold text-primary",children:["#",x||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:m.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:m.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[S.map((T,I)=>{var A,D,$;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${T.user_id===(t==null?void 0:t.id)?"bg-primary/10 border border-primary/20":I===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:C(I)}),r.jsx(Di,{className:"h-6 w-6",children:r.jsx(Ri,{className:"text-xs",children:((D=(A=T.profile)==null?void 0:A.name)==null?void 0:D.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:(($=T.profile)==null?void 0:$.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:T.total_points})]},T.user_id)}),S.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(io,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ua,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ka,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(et,{children:m?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:m.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Total Points"})]}),r.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:m.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events Attended"})]})]}),r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Current Streak"})]}),r.jsxs("span",{className:"font-bold text-orange-500",children:[m.current_streak," 🔥"]})]}),v&&v.length>0&&r.jsxs("div",{className:"pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx(Ml,{className:"h-3 w-3 text-muted-foreground"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Badges"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.slice(0,4).map(S=>r.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:S.badge_name},S.id)),v.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",v.length-4," more"]})]})]}),r.jsxs(io,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ua,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ka,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(Bs,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(io,{to:"/reward-store",className:"mt-3 inline-flex items-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ua,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Ka,{className:"h-4 w-4"})]})]})})]})}const hse=()=>rr({queryKey:["lead-sources"],queryFn:async()=>{const{data:t,error:e}=await ee.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}}),nft=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("lead_sources").insert({name:n,owner_user_id:e==null?void 0:e.id,sort_order:100}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["lead-sources"]}),He.success("Lead source added")},onError:n=>{He.error("Failed to add lead source"),console.error(n)}})},cxe=(t,e)=>{const{user:n,isAdmin:s}=zr(),i=s&&e?e:n==null?void 0:n.id;return rr({queryKey:["scorecard-transactions",t,i],queryFn:async()=>{let o=ee.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",i).order("close_date",{ascending:!1});t&&(o=o.gte("close_date",`${t}-01-01`).lte("close_date",`${t}-12-31`));const{data:c,error:a}=await o;if(a)throw a;return c},enabled:!!i})},h8e=t=>{const{user:e,isAdmin:n}=zr(),s=n&&t?t:e==null?void 0:e.id;return rr({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:i,error:o}=await ee.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",s).order("close_date",{ascending:!1});if(o)throw o;return i},enabled:!!s})},fse=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_transactions").insert({...n,owner_user_id:e.id}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),He.success("Transaction added")},onError:n=>{He.error("Failed to add transaction"),console.error(n)}})},sft=()=>{const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("scorecard_transactions").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),He.success("Transaction updated")},onError:e=>{He.error("Failed to update transaction"),console.error(e)}})},ift=()=>{const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("scorecard_transactions").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),He.success("Transaction deleted")},onError:e=>{He.error("Failed to delete transaction"),console.error(e)}})},f8e=(t,e)=>{const{user:n,isAdmin:s}=zr(),i=s&&e?e:n==null?void 0:n.id;return rr({queryKey:["scorecard-goals",t,i],queryFn:async()=>{const{data:o,error:c}=await ee.from("scorecard_goals").select("*").eq("owner_user_id",i).eq("year",t).maybeSingle();if(c)throw c;return o},enabled:!!i})},aft=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_goals").upsert({...n,owner_user_id:e.id},{onConflict:"owner_user_id,year"}).select().single();if(i)throw i;return s},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["scorecard-goals",s.year]}),He.success("Goals saved")},onError:n=>{He.error("Failed to save goals"),console.error(n)}})},pse=()=>{const{user:t}=zr();return rr({queryKey:["scorecard-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("scorecard_settings").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e},enabled:!!(t!=null&&t.id)})},oft=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{data:s,error:i}=await ee.from("scorecard_settings").upsert({...n,user_id:e.id},{onConflict:"user_id"}).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-settings"]}),He.success("Settings saved")},onError:n=>{He.error("Failed to save settings"),console.error(n)}})},p8e=(t,e)=>{const{data:n,isLoading:s}=cxe(t,e),{data:i,isLoading:o}=h8e(e),{data:c}=pse(),a=(c==null?void 0:c.show_commission)??!0,h=m=>{if(!m||m.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=m.filter($=>$.transaction_type==="buyer").length,v=m.filter($=>$.transaction_type==="seller").length,w=m.reduce(($,F)=>$+Number(F.sale_price),0),k=m.reduce(($,F)=>$+(Number(F.commission_amount)||0),0),C={};m.forEach($=>{var q;const F=((q=$.lead_source)==null?void 0:q.name)||"Unknown";C[F]=(C[F]||0)+1});const S=Object.entries(C).map(([$,F])=>({name:$,count:F})).sort(($,F)=>F.count-$.count),T=S[0]||null,I={};m.forEach($=>{const F=new Date($.close_date).toLocaleString("default",{month:"short"});I[F]=(I[F]||0)+1});const D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map($=>({month:$,count:I[$]||0}));return{totalTransactions:m.length,buyerCount:x,sellerCount:v,totalVolume:w,averagePrice:m.length>0?w/m.length:0,totalCommission:a?k:0,topLeadSource:T,transactionsByMonth:D,leadSourceBreakdown:S}};return{yearStats:h(n),lifetimeStats:h(i),isLoading:s||o,showCommission:a}},lft=()=>{const{isAdmin:t}=zr();return rr({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:e,error:n}=await ee.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(e.map(c=>c.owner_user_id))],{data:i,error:o}=await ee.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return i},enabled:t})},o0={recency:40,touchpoints:30,transactions:20},oke={warm:70,cooling:40};function cft(t){return t===null?0:t<=14?o0.recency:t<=30?o0.recency*.85:t<=60?o0.recency*.65:t<=90?o0.recency*.4:t<=180?o0.recency*.2:o0.recency*.05}function dft(t){const e=Math.min(t/12,1);return Math.round(o0.touchpoints*e)}function uft(t){return t?o0.transactions:0}function hft(){return 0}function fft(t){return t>=oke.warm?"warm":t>=oke.cooling?"cooling":"at-risk"}function dxe(){const{data:t,isLoading:e}=vm(),{data:n}=YOe(),{data:s}=use(365),{data:i}=h8e(),o=P.useMemo(()=>{if(!t)return[];const a=new Date,h=cdt(a),m={};s==null||s.forEach(v=>{new Date(v.completed_at)>=h&&(m[v.contact_id]=(m[v.contact_id]||0)+1)});const x=new Set((i==null?void 0:i.filter(v=>v.contact_id).map(v=>v.contact_id))||[]);return t.map(v=>{const w=(n==null?void 0:n[v.id])||null,k=w?cC(a,new Date(w)):null,C=m[v.id]||0,S=x.has(v.id),T=cft(k),I=dft(C),A=uft(S),D=hft(),$=Math.round(T+I+A+D),F={score:$,status:fft($),breakdown:{recency:Math.round(T),touchpoints:Math.round(I),transactions:Math.round(A),referrals:Math.round(D)},lastTouchDate:w,daysSinceTouch:k,touchCountLast12Months:C,hasTransaction:S};return{...v,relationshipScore:F}})},[t,n,s,i]),c=P.useMemo(()=>{const a=o.filter(w=>w.relationshipScore.status==="warm").length,h=o.filter(w=>w.relationshipScore.status==="cooling").length,m=o.filter(w=>w.relationshipScore.status==="at-risk").length,x=o.length,v=x>0?Math.round(o.reduce((w,k)=>w+k.relationshipScore.score,0)/x):0;return{warm:a,cooling:h,atRisk:m,total:x,averageScore:v}},[o]);return{contactsWithScores:o,stats:c,isLoading:e}}function m8e(){const t=ts(),{stats:e,contactsWithScores:n,isLoading:s}=dxe();if(s)return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Kr,{className:"h-5 w-40"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Kr,{className:"h-20 w-full"}),r.jsx(Kr,{className:"h-16 w-full"})]})]});if(e.total===0)return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(te,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>t("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const i=Math.round(e.warm/e.total*100),o=Math.round(e.cooling/e.total*100),c=Math.round(e.atRisk/e.total*100),a=n.filter(h=>h.relationshipScore.status==="at-risk").sort((h,m)=>h.relationshipScore.score-m.relationshipScore.score).slice(0,3);return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(qf,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),r.jsx("span",{className:"text-2xl font-bold",children:e.averageScore})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",e.total," contacts"]})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsx("span",{children:"Warm"})]}),r.jsxs("span",{className:"font-medium",children:[e.warm," (",i,"%)"]})]}),r.jsx(Bc,{value:i,className:"h-2 bg-muted [&>div]:bg-emerald-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-amber-500"}),r.jsx("span",{children:"Cooling Off"})]}),r.jsxs("span",{className:"font-medium",children:[e.cooling," (",o,"%)"]})]}),r.jsx(Bc,{value:o,className:"h-2 bg-muted [&>div]:bg-amber-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-red-500"}),r.jsx("span",{children:"At Risk"})]}),r.jsxs("span",{className:"font-medium",children:[e.atRisk," (",c,"%)"]})]}),r.jsx(Bc,{value:c,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),a.length>0&&r.jsxs("div",{className:"pt-3 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(c1,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),r.jsx("div",{className:"space-y-2",children:a.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>t(`/mission-control/contacts/${h.id}`),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),r.jsxs("span",{className:"text-sm",children:[h.first_name," ",h.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:h.relationshipScore.daysSinceTouch===null?"Never":`${h.relationshipScore.daysSinceTouch}d`}),r.jsx(Ka,{className:"h-3 w-3"})]})]},h.id))})]}),r.jsxs(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Ka,{className:"h-4 w-4 ml-1"})]})]})]})}const pft=()=>{var ne,ye;const{user:t,isAdmin:e}=zr(),n=ts(),[s,i]=P.useState([]),[o,c]=P.useState([]),[a,h]=P.useState([]),[m,x]=P.useState([]),[v,w]=P.useState([]),[k,C]=P.useState([]),[S,T]=P.useState(new Set),[I,A]=P.useState([]),[D,$]=P.useState([]),[F,q]=P.useState([]),[W,K]=P.useState(!0);P.useEffect(()=>{Z()},[t]);const Z=async()=>{var ie,me,fe,ve;try{const[Ie,Se,oe,ae,Ne,Te,Be,Le,Qe,Fe]=await Promise.all([ee.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),ee.from("app_tiles").select("*").order("name"),ee.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),ee.from("events").select("*").order("event_date",{ascending:!0}),ee.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t==null?void 0:t.id),ee.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),ee.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),ee.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),ee.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),Ce=((ie=Ie.data)==null?void 0:ie.map(nt=>nt.tag))||[],Je=new Set(((me=oe.data)==null?void 0:me.map(nt=>nt.app_id))||[]);T(Je);const Ye=(((fe=Se.data)==null?void 0:fe.filter(nt=>!nt.required_tags||nt.required_tags.length===0?!0:nt.required_tags.some(Ve=>Ce.includes(Ve))))||[]).sort((nt,Ve)=>nt.name==="LevelUp Members Portal"?-1:Ve.name==="LevelUp Members Portal"?1:0);i(Ye.slice(0,6));const ge=((ve=ae.data)==null?void 0:ve.filter(nt=>w4(nt.event_date)!=="ended"))||[];c(ge.slice(0,4)),A(Ne.data||[]),h(Te.data||[]),x(Be.data||[]),w(Le.data||[]),C(Qe.data||[]);const ft=Fe.data||[];$(ft.filter(nt=>nt.placement==="top")),q(ft.filter(nt=>nt.placement==="between"))}catch(Ie){console.error("Error loading dashboard:",Ie),He.error("Failed to load dashboard data")}finally{K(!1)}},re=async ie=>{var fe;const me=window.open("about:blank","_blank");try{await ee.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:ie.app_id,app_name:ie.name,user_agent:navigator.userAgent});const{data:ve,error:Ie}=await ee.functions.invoke("sso-launch",{body:{app_id:ie.app_id}});if(Ie)throw Ie;ve!=null&&ve.redirect_url?me&&!me.closed?(me.location.href=ve.redirect_url,(fe=me.focus)==null||fe.call(me)):window.location.assign(ve.redirect_url):(me==null||me.close(),He.error("Launch link unavailable"))}catch(ve){me==null||me.close(),console.error("Error launching app:",ve),He.error("Failed to launch app")}},he=ie=>I==null?void 0:I.some(me=>me.event_id===ie),ue=ie=>{const me=I==null?void 0:I.find(fe=>fe.event_id===ie);return me==null?void 0:me.zoom_join_url};if(W)return r.jsx(Dr,{title:"Dashboard",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading your dashboard..."})]})})});const je=ie=>F.filter(me=>me.section_after===ie);return r.jsxs(Dr,{title:"Dashboard",children:[r.jsx(fht,{events:o,registrations:I,onNavigateToEvents:()=>n("/events")}),D.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(LM,{banners:D})}),r.jsx(jht,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((ye=(ne=t==null?void 0:t.user_metadata)==null?void 0:ne.name)==null?void 0:ye.split(" ")[0])||"there","!"]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Are you ready to LevelUp today?"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-8",children:[r.jsx(Fht,{}),r.jsx(m8e,{}),r.jsx(rft,{})]}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"})]})})}):r.jsx("div",{className:"bg-card rounded-xl border border-border overflow-hidden divide-y divide-border max-w-full",children:o.map(ie=>{const me=he(ie.id),fe=ue(ie.id)||ie.zoom_link;return r.jsxs("div",{className:`flex items-start gap-3 sm:gap-4 p-3 sm:p-4 hover:bg-muted/50 transition-colors cursor-pointer group ${nke(ie.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[nke(ie.event_date)?r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-red-500/10 flex flex-col items-center justify-center relative",children:[r.jsx("span",{className:"absolute inline-flex h-3 w-3 top-1 right-1 animate-ping rounded-full bg-red-500 opacity-75"}),r.jsx(ij,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase mt-0.5",children:"Live"})]}):r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-primary/10 flex flex-col items-center justify-center",children:[r.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-primary uppercase",children:un(new Date(ie.event_date),"MMM")}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-primary",children:un(new Date(ie.event_date),"d")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"font-medium text-sm sm:text-base text-foreground group-hover:text-primary transition-colors line-clamp-2 sm:truncate",children:ie.title}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-0.5",children:[un(new Date(ie.event_date),"EEEE")," at ",un(new Date(ie.event_date),"h:mm a")," EST"]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:me?r.jsxs(te,{size:"sm",variant:"default",className:"gap-1",onClick:ve=>{ve.stopPropagation(),window.open(fe,"_blank")},children:[r.jsx($s,{className:"h-3.5 w-3.5"}),"Join"]}):r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors",children:[r.jsx("span",{className:"text-sm",children:"Register"}),r.jsx(Ka,{className:"h-4 w-4"})]})})]},ie.id)})})]}),je("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(LM,{banners:je("events")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),v.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Af,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No academy videos available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:v.map(ie=>r.jsxs("div",{onClick:()=>n(`/academy/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden relative",children:[ie.thumbnail_url?r.jsx("img",{src:ie.thumbnail_url,alt:ie.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Af,{className:"h-8 w-8 text-muted-foreground/50"})}),ie.duration&&r.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:ie.duration})]}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:ie.title})})]},ie.id))})]}),je("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(LM,{banners:je("academy")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),m.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Lx,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No resource kits available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:m.map(ie=>r.jsxs("div",{onClick:()=>n(`/toolbox/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.featured_image_url?r.jsx("img",{src:ie.featured_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Lx,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),je("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(LM,{banners:je("toolbox")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),a.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Q0,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No templates available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map(ie=>r.jsxs("div",{onClick:()=>n("/templates"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Q0,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),je("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(LM,{banners:je("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(tft,{})}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(nm,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No apps available"})]})})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(ie=>{const me=S.has(ie.id);return r.jsxs("div",{onClick:()=>re(ie),className:"group flex items-start gap-4 p-5 bg-card rounded-xl border border-border cursor-pointer transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:ie.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:ie.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ie.description})]}),me&&r.jsx(nm,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ie.id)})})]}),r.jsxs("section",{className:"mt-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Ho,{className:"h-4 w-4"})]})]}),k.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(As,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional services available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:k.map(ie=>r.jsxs("div",{onClick:()=>window.open(ie.signup_link_url,"_blank"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(As,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsxs("div",{className:"p-3",children:[r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name}),ie.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ie.description})]})]},ie.id))})]})]})};var mse="Switch",[mft]=Zl(mse),[gft,xft]=mft(mse),g8e=P.forwardRef((t,e)=>{const{__scopeSwitch:n,name:s,checked:i,defaultChecked:o,required:c,disabled:a,value:h="on",onCheckedChange:m,form:x,...v}=t,[w,k]=P.useState(null),C=Xs(e,D=>k(D)),S=P.useRef(!1),T=w?x||!!w.closest("form"):!0,[I,A]=Eu({prop:i,defaultProp:o??!1,onChange:m,caller:mse});return r.jsxs(gft,{scope:n,checked:I,disabled:a,children:[r.jsx(Dn.button,{type:"button",role:"switch","aria-checked":I,"aria-required":c,"data-state":_8e(I),"data-disabled":a?"":void 0,disabled:a,value:h,...v,ref:C,onClick:an(t.onClick,D=>{A($=>!$),T&&(S.current=D.isPropagationStopped(),S.current||D.stopPropagation())})}),T&&r.jsx(v8e,{control:w,bubbles:!S.current,name:s,value:h,checked:I,required:c,disabled:a,form:x,style:{transform:"translateX(-100%)"}})]})});g8e.displayName=mse;var x8e="SwitchThumb",y8e=P.forwardRef((t,e)=>{const{__scopeSwitch:n,...s}=t,i=xft(x8e,n);return r.jsx(Dn.span,{"data-state":_8e(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})});y8e.displayName=x8e;var yft="SwitchBubbleInput",v8e=P.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:s=!0,...i},o)=>{const c=P.useRef(null),a=Xs(c,o),h=dI(n),m=eI(e);return P.useEffect(()=>{const x=c.current;if(!x)return;const v=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(v,"checked").set;if(h!==n&&k){const C=new Event("click",{bubbles:s});k.call(x,n),x.dispatchEvent(C)}},[h,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});v8e.displayName=yft;function _8e(t){return t?"checked":"unchecked"}var b8e=g8e,vft=y8e;const Js=P.forwardRef(({className:t,...e},n)=>r.jsx(b8e,{className:$t("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...e,ref:n,children:r.jsx(vft,{className:$t("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Js.displayName=b8e.displayName;var _ft=Object.defineProperty,bft=(t,e,n)=>e in t?_ft(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fl=(t,e,n)=>bft(t,typeof e!="symbol"?e+"":e,n);const pte={x:0,y:0,width:0,height:0,unit:"px"},XN=(t,e,n)=>Math.min(Math.max(t,e),n),wft=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),lke=(t,e)=>t===e||t.width===e.width&&t.height===e.height&&t.x===e.x&&t.y===e.y&&t.unit===e.unit;function jft(t,e,n,s){const i=Wm(t,n,s);return t.width&&(i.height=i.width/e),t.height&&(i.width=i.height*e),i.y+i.height>s&&(i.height=s-i.y,i.width=i.height*e),i.x+i.width>n&&(i.width=n-i.x,i.height=i.width/e),t.unit==="%"?l0(i,n,s):i}function kft(t,e,n){const s=Wm(t,e,n);return s.x=(e-s.width)/2,s.y=(n-s.height)/2,t.unit==="%"?l0(s,e,n):s}function l0(t,e,n){return t.unit==="%"?{...pte,...t,unit:"%"}:{unit:"%",x:t.x?t.x/e*100:0,y:t.y?t.y/n*100:0,width:t.width?t.width/e*100:0,height:t.height?t.height/n*100:0}}function Wm(t,e,n){return t.unit?t.unit==="px"?{...pte,...t,unit:"px"}:{unit:"px",x:t.x?t.x*e/100:0,y:t.y?t.y*n/100:0,width:t.width?t.width*e/100:0,height:t.height?t.height*n/100:0}:{...pte,...t,unit:"px"}}function cke(t,e,n,s,i,o=0,c=0,a=s,h=i){const m={...t};let x=Math.min(o,s),v=Math.min(c,i),w=Math.min(a,s),k=Math.min(h,i);e&&(e>1?(x=c?c*e:x,v=x/e,w=a*e):(v=o?o/e:v,x=v*e,k=h/e)),m.y<0&&(m.height=Math.max(m.height+m.y,v),m.y=0),m.x<0&&(m.width=Math.max(m.width+m.x,x),m.x=0);const C=s-(m.x+m.width);C<0&&(m.x=Math.min(m.x,s-x),m.width+=C);const S=i-(m.y+m.height);if(S<0&&(m.y=Math.min(m.y,i-v),m.height+=S),m.widthw&&((n==="sw"||n=="nw")&&(m.x-=w-m.width),m.width=w),m.height>k&&((n==="nw"||n=="ne")&&(m.y-=k-m.height),m.height=k),e){const T=m.width/m.height;if(Te){const I=Math.max(m.height*e,x);(n==="sw"||n=="nw")&&(m.x-=I-m.width),m.width=I}}return m}function Nft(t,e,n,s){const i={...t};return e==="ArrowLeft"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="w"?(i.x-=n,i.width+=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="e"?i.width-=n:s==="se"&&(i.width-=n,i.height-=n):e==="ArrowRight"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="w"?(i.x+=n,i.width-=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="e"?i.width+=n:s==="se"&&(i.width+=n,i.height+=n)),e==="ArrowUp"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="n"?(i.y-=n,i.height+=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="s"?i.height-=n:s==="se"&&(i.width-=n,i.height-=n):e==="ArrowDown"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="n"?(i.y+=n,i.height-=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="s"?i.height+=n:s==="se"&&(i.width+=n,i.height+=n)),i}const QN={capture:!0,passive:!1};let Sft=0;const Jy=class Rp extends P.PureComponent{constructor(){super(...arguments),fl(this,"docMoveBound",!1),fl(this,"mouseDownOnCrop",!1),fl(this,"dragStarted",!1),fl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),fl(this,"componentRef",P.createRef()),fl(this,"mediaRef",P.createRef()),fl(this,"resizeObserver"),fl(this,"initChangeCalled",!1),fl(this,"instanceId",`rc-${Sft++}`),fl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),fl(this,"onCropPointerDown",e=>{const{crop:n,disabled:s}=this.props,i=this.getBox();if(!n)return;const o=Wm(n,i.width,i.height);if(s)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const c=e.target.dataset.ord,a=!!c;let h=e.clientX,m=e.clientY,x=o.x,v=o.y;if(c){const w=e.clientX-i.x,k=e.clientY-i.y;let C=0,S=0;c==="ne"||c=="e"?(C=w-(o.x+o.width),S=k-o.y,x=o.x,v=o.y+o.height):c==="se"||c==="s"?(C=w-(o.x+o.width),S=k-(o.y+o.height),x=o.x,v=o.y):c==="sw"||c=="w"?(C=w-o.x,S=k-(o.y+o.height),x=o.x+o.width,v=o.y):(c==="nw"||c=="n")&&(C=w-o.x,S=k-o.y,x=o.x+o.width,v=o.y+o.height),h=x+i.x+C,m=v+i.y+S}this.evData={startClientX:h,startClientY:m,startCropX:x,startCropY:v,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:c},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),fl(this,"onComponentPointerDown",e=>{const{crop:n,disabled:s,locked:i,keepSelection:o,onChange:c}=this.props,a=this.getBox();if(s||i||o&&n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=e.clientX-a.x,m=e.clientY-a.y,x={unit:"px",x:h,y:m,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:m,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,c(Wm(x,a.width,a.height),l0(x,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),fl(this,"onDocPointerMove",e=>{const{crop:n,disabled:s,onChange:i,onDragStart:o}=this.props,c=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(e));const{evData:a}=this;a.clientX=e.clientX,a.clientY=e.clientY;let h;a.isResize?h=this.resizeCrop():h=this.dragCrop(),lke(n,h)||i(Wm(h,c.width,c.height),l0(h,c.width,c.height))}),fl(this,"onComponentKeyDown",e=>{const{crop:n,disabled:s,onChange:i,onComplete:o}=this.props;if(s)return;const c=e.key;let a=!1;if(!n)return;const h=this.getBox(),m=this.makePixelCrop(h),x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Rp.nudgeStepLarge:e.shiftKey?Rp.nudgeStepMedium:Rp.nudgeStep;if(c==="ArrowLeft"?(m.x-=x,a=!0):c==="ArrowRight"?(m.x+=x,a=!0):c==="ArrowUp"?(m.y-=x,a=!0):c==="ArrowDown"&&(m.y+=x,a=!0),a){e.cancelable&&e.preventDefault(),m.x=XN(m.x,0,h.width-m.width),m.y=XN(m.y,0,h.height-m.height);const v=Wm(m,h.width,h.height),w=l0(m,h.width,h.height);i(v,w),o&&o(v,w)}}),fl(this,"onHandlerKeyDown",(e,n)=>{const{aspect:s=0,crop:i,disabled:o,minWidth:c=0,minHeight:a=0,maxWidth:h,maxHeight:m,onChange:x,onComplete:v}=this.props,w=this.getBox();if(o||!i)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;const k=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Rp.nudgeStepLarge:e.shiftKey?Rp.nudgeStepMedium:Rp.nudgeStep,C=Wm(i,w.width,w.height),S=Nft(C,e.key,k,n),T=cke(S,s,n,w.width,w.height,c,a,h,m);if(!lke(i,T)){const I=l0(T,w.width,w.height);x(T,I),v&&v(T,I)}}),fl(this,"onDocPointerDone",e=>{const{crop:n,disabled:s,onComplete:i,onDragEnd:o}=this.props,c=this.getBox();this.unbindDocMove(),!(s||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(e),i&&i(Wm(n,c.width,c.height),l0(n,c.width,c.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),fl(this,"onDragFocus",()=>{var e;(e=this.componentRef.current)==null||e.scrollTo(0,0)})}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};const{x:n,y:s,width:i,height:o}=e.getBoundingClientRect();return{x:n,y:s,width:i,height:o}}componentDidUpdate(e){const{crop:n,onComplete:s}=this.props;if(s&&!e.crop&&n){const{width:i,height:o}=this.getBox();i&&o&&s(Wm(n,i,o),l0(n,i,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,QN),this.document.addEventListener("pointerup",this.onDocPointerDone,QN),this.document.addEventListener("pointercancel",this.onDocPointerDone,QN),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,QN),this.document.removeEventListener("pointerup",this.onDocPointerDone,QN),this.document.removeEventListener("pointercancel",this.onDocPointerDone,QN),this.docMoveBound=!1)}getCropStyle(){const{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,n=this.getBox(),s=this.makePixelCrop(n),i=e.clientX-e.startClientX,o=e.clientY-e.startClientY;return s.x=XN(e.startCropX+i,0,n.width-s.width),s.y=XN(e.startCropY+o,0,n.height-s.height),s}getPointRegion(e,n,s,i){const{evData:o}=this,c=o.clientX-e.x,a=o.clientY-e.y;let h;i&&n?h=n==="nw"||n==="n"||n==="ne":h=a1?o?[o,o/n]:[c*n,c]:c?[c*n,c]:[o,o/n]}resizeCrop(){const{evData:e}=this,{aspect:n=0,maxWidth:s,maxHeight:i}=this.props,o=this.getBox(),[c,a]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let h=this.makePixelCrop(o);const m=this.getPointRegion(o,e.ord,c,a),x=e.ord||m;let v=e.clientX-e.startClientX,w=e.clientY-e.startClientY;(c&&x==="nw"||x==="w"||x==="sw")&&(v=Math.min(v,-c)),(a&&x==="nw"||x==="n"||x==="ne")&&(w=Math.min(w,-a));const k={unit:"px",x:0,y:0,width:0,height:0};m==="ne"?(k.x=e.startCropX,k.width=v,n?(k.height=k.width/n,k.y=e.startCropY-k.height):(k.height=Math.abs(w),k.y=e.startCropY-k.height)):m==="se"?(k.x=e.startCropX,k.y=e.startCropY,k.width=v,n?k.height=k.width/n:k.height=w):m==="sw"?(k.x=e.startCropX+v,k.y=e.startCropY,k.width=Math.abs(v),n?k.height=k.width/n:k.height=w):m==="nw"&&(k.x=e.startCropX+v,k.width=Math.abs(v),n?(k.height=k.width/n,k.y=e.startCropY-k.height):(k.height=Math.abs(w),k.y=e.startCropY+w));const C=cke(k,n,m,o.width,o.height,c,a,s,i);return n||Rp.xyOrds.indexOf(x)>-1?h=C:Rp.xOrds.indexOf(x)>-1?(h.x=C.x,h.width=C.width):Rp.yOrds.indexOf(x)>-1&&(h.y=C.y,h.height=C.height),h.x=XN(h.x,0,o.width-h.width),h.y=XN(h.y,0,o.height-h.height),h}renderCropSelection(){const{ariaLabels:e=Rp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:i,ruleOfThirds:o,crop:c}=this.props,a=this.getCropStyle();if(c)return lt.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&<.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},lt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"nw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"n"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"ne"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"e"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"se"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"s"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"sw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"w"),role:"button"})),i&<.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:h=>h.stopPropagation()},i(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(e){const n={...pte,...this.props.crop||{}};return Wm(n,e.width,e.height)}render(){const{aspect:e,children:n,circularCrop:s,className:i,crop:o,disabled:c,locked:a,style:h,ruleOfThirds:m}=this.props,{cropIsActive:x,newCropIsBeingDrawn:v}=this.state,w=o?this.renderCropSelection():null,k=wft("ReactCrop",i,x&&"ReactCrop--active",c&&"ReactCrop--disabled",a&&"ReactCrop--locked",v&&"ReactCrop--new-crop",o&&e&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&m&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return lt.createElement("div",{ref:this.componentRef,className:k,style:h},lt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?lt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},lt.createElement("defs",null,lt.createElement("mask",{id:`hole-${this.instanceId}`},lt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?lt.createElement("ellipse",{cx:`${o.x+o.width/2}${o.unit}`,cy:`${o.y+o.height/2}${o.unit}`,rx:`${o.width/2}${o.unit}`,ry:`${o.height/2}${o.unit}`,fill:"black"}):lt.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),lt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,w)}};fl(Jy,"xOrds",["e","w"]),fl(Jy,"yOrds",["n","s"]),fl(Jy,"xyOrds",["nw","ne","se","sw"]),fl(Jy,"nudgeStep",1),fl(Jy,"nudgeStepMedium",10),fl(Jy,"nudgeStepLarge",100),fl(Jy,"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 Cft=Jy;var w8e=["PageUp","PageDown"],j8e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k8e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},a5="Slider",[yhe,Mft,Tft]=XE(a5),[N8e]=Zl(a5,[Tft]),[Aft,gse]=N8e(a5),S8e=P.forwardRef((t,e)=>{const{name:n,min:s=0,max:i=100,step:o=1,orientation:c="horizontal",disabled:a=!1,minStepsBetweenThumbs:h=0,defaultValue:m=[s],value:x,onValueChange:v=()=>{},onValueCommit:w=()=>{},inverted:k=!1,form:C,...S}=t,T=P.useRef(new Set),I=P.useRef(0),D=c==="horizontal"?Eft:Ift,[$=[],F]=Eu({prop:x,defaultProp:m,onChange:he=>{var je;(je=[...T.current][I.current])==null||je.focus(),v(he)}}),q=P.useRef($);function W(he){const ue=Rft($,he);re(he,ue)}function K(he){re(he,I.current)}function Z(){const he=q.current[I.current];$[I.current]!==he&&w($)}function re(he,ue,{commit:je}={commit:!1}){const ne=$ft(o),ye=Uft(Math.round((he-s)/o)*o+s,ne),ie=VA(ye,[s,i]);F((me=[])=>{const fe=Oft(me,ie,ue);if(Bft(fe,h*o)){I.current=fe.indexOf(ie);const ve=String(fe)!==String(me);return ve&&je&&w(fe),ve?fe:me}else return me})}return r.jsx(Aft,{scope:t.__scopeSlider,name:n,disabled:a,min:s,max:i,valueIndexToChangeRef:I,thumbs:T.current,values:$,orientation:c,form:C,children:r.jsx(yhe.Provider,{scope:t.__scopeSlider,children:r.jsx(yhe.Slot,{scope:t.__scopeSlider,children:r.jsx(D,{"aria-disabled":a,"data-disabled":a?"":void 0,...S,ref:e,onPointerDown:an(S.onPointerDown,()=>{a||(q.current=$)}),min:s,max:i,inverted:k,onSlideStart:a?void 0:W,onSlideMove:a?void 0:K,onSlideEnd:a?void 0:Z,onHomeKeyDown:()=>!a&&re(s,0,{commit:!0}),onEndKeyDown:()=>!a&&re(i,$.length-1,{commit:!0}),onStepKeyDown:({event:he,direction:ue})=>{if(!a){const ye=w8e.includes(he.key)||he.shiftKey&&j8e.includes(he.key)?10:1,ie=I.current,me=$[ie],fe=o*ye*ue;re(me+fe,ie,{commit:!0})}}})})})})});S8e.displayName=a5;var[C8e,M8e]=N8e(a5,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Eft=P.forwardRef((t,e)=>{const{min:n,max:s,dir:i,inverted:o,onSlideStart:c,onSlideMove:a,onSlideEnd:h,onStepKeyDown:m,...x}=t,[v,w]=P.useState(null),k=Xs(e,D=>w(D)),C=P.useRef(void 0),S=Zj(i),T=S==="ltr",I=T&&!o||!T&&o;function A(D){const $=C.current||v.getBoundingClientRect(),F=[0,$.width],W=uxe(F,I?[n,s]:[s,n]);return C.current=$,W(D-$.left)}return r.jsx(C8e,{scope:t.__scopeSlider,startEdge:I?"left":"right",endEdge:I?"right":"left",direction:I?1:-1,size:"width",children:r.jsx(T8e,{dir:S,"data-orientation":"horizontal",...x,ref:k,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:D=>{const $=A(D.clientX);c==null||c($)},onSlideMove:D=>{const $=A(D.clientX);a==null||a($)},onSlideEnd:()=>{C.current=void 0,h==null||h()},onStepKeyDown:D=>{const F=k8e[I?"from-left":"from-right"].includes(D.key);m==null||m({event:D,direction:F?-1:1})}})})}),Ift=P.forwardRef((t,e)=>{const{min:n,max:s,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:a,onStepKeyDown:h,...m}=t,x=P.useRef(null),v=Xs(e,x),w=P.useRef(void 0),k=!i;function C(S){const T=w.current||x.current.getBoundingClientRect(),I=[0,T.height],D=uxe(I,k?[s,n]:[n,s]);return w.current=T,D(S-T.top)}return r.jsx(C8e,{scope:t.__scopeSlider,startEdge:k?"bottom":"top",endEdge:k?"top":"bottom",size:"height",direction:k?1:-1,children:r.jsx(T8e,{"data-orientation":"vertical",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:S=>{const T=C(S.clientY);o==null||o(T)},onSlideMove:S=>{const T=C(S.clientY);c==null||c(T)},onSlideEnd:()=>{w.current=void 0,a==null||a()},onStepKeyDown:S=>{const I=k8e[k?"from-bottom":"from-top"].includes(S.key);h==null||h({event:S,direction:I?-1:1})}})})}),T8e=P.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:c,onEndKeyDown:a,onStepKeyDown:h,...m}=t,x=gse(a5,n);return r.jsx(Dn.span,{...m,ref:e,onKeyDown:an(t.onKeyDown,v=>{v.key==="Home"?(c(v),v.preventDefault()):v.key==="End"?(a(v),v.preventDefault()):w8e.concat(j8e).includes(v.key)&&(h(v),v.preventDefault())}),onPointerDown:an(t.onPointerDown,v=>{const w=v.target;w.setPointerCapture(v.pointerId),v.preventDefault(),x.thumbs.has(w)?w.focus():s(v)}),onPointerMove:an(t.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&i(v)}),onPointerUp:an(t.onPointerUp,v=>{const w=v.target;w.hasPointerCapture(v.pointerId)&&(w.releasePointerCapture(v.pointerId),o(v))})})}),A8e="SliderTrack",E8e=P.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,i=gse(A8e,n);return r.jsx(Dn.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...s,ref:e})});E8e.displayName=A8e;var vhe="SliderRange",I8e=P.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,i=gse(vhe,n),o=M8e(vhe,n),c=P.useRef(null),a=Xs(e,c),h=i.values.length,m=i.values.map(w=>O8e(w,i.min,i.max)),x=h>1?Math.min(...m):0,v=100-Math.max(...m);return r.jsx(Dn.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...s,ref:a,style:{...t.style,[o.startEdge]:x+"%",[o.endEdge]:v+"%"}})});I8e.displayName=vhe;var _he="SliderThumb",P8e=P.forwardRef((t,e)=>{const n=Mft(t.__scopeSlider),[s,i]=P.useState(null),o=Xs(e,a=>i(a)),c=P.useMemo(()=>s?n().findIndex(a=>a.ref.current===s):-1,[n,s]);return r.jsx(Pft,{...t,ref:o,index:c})}),Pft=P.forwardRef((t,e)=>{const{__scopeSlider:n,index:s,name:i,...o}=t,c=gse(_he,n),a=M8e(_he,n),[h,m]=P.useState(null),x=Xs(e,A=>m(A)),v=h?c.form||!!h.closest("form"):!0,w=eI(h),k=c.values[s],C=k===void 0?0:O8e(k,c.min,c.max),S=Dft(s,c.values.length),T=w==null?void 0:w[a.size],I=T?Fft(T,C,a.direction):0;return P.useEffect(()=>{if(h)return c.thumbs.add(h),()=>{c.thumbs.delete(h)}},[h,c.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${C}% + ${I}px)`},children:[r.jsx(yhe.ItemSlot,{scope:t.__scopeSlider,children:r.jsx(Dn.span,{role:"slider","aria-label":t["aria-label"]||S,"aria-valuemin":c.min,"aria-valuenow":k,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0,...o,ref:x,style:k===void 0?{display:"none"}:t.style,onFocus:an(t.onFocus,()=>{c.valueIndexToChangeRef.current=s})})}),v&&r.jsx(L8e,{name:i??(c.name?c.name+(c.values.length>1?"[]":""):void 0),form:c.form,value:k},s)]})});P8e.displayName=_he;var Lft="RadioBubbleInput",L8e=P.forwardRef(({__scopeSlider:t,value:e,...n},s)=>{const i=P.useRef(null),o=Xs(i,s),c=dI(e);return P.useEffect(()=>{const a=i.current;if(!a)return;const h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(c!==e&&x){const v=new Event("input",{bubbles:!0});x.call(a,e),a.dispatchEvent(v)}},[c,e]),r.jsx(Dn.input,{style:{display:"none"},...n,ref:o,defaultValue:e})});L8e.displayName=Lft;function Oft(t=[],e,n){const s=[...t];return s[n]=e,s.sort((i,o)=>i-o)}function O8e(t,e,n){const o=100/(n-e)*(t-e);return VA(o,[0,100])}function Dft(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Rft(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),s=Math.min(...n);return n.indexOf(s)}function Fft(t,e,n){const s=t/2,o=uxe([0,50],[0,s]);return(s-o(e)*n)*n}function zft(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Bft(t,e){if(e>0){const n=zft(t);return Math.min(...n)>=e}return!0}function uxe(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function $ft(t){return(String(t).split(".")[1]||"").length}function Uft(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var D8e=S8e,qft=E8e,Vft=I8e,Hft=P8e;const kw=P.forwardRef(({className:t,...e},n)=>r.jsxs(D8e,{ref:n,className:$t("relative flex w-full touch-none select-none items-center",t),...e,children:[r.jsx(qft,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(Vft,{className:"absolute h-full bg-primary"})}),r.jsx(Hft,{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"})]}));kw.displayName=D8e.displayName;function Wft(t,e,n){return kft(jft({unit:"%",width:90},n,t,e),t,e)}const Gft=({open:t,onClose:e,imageSrc:n,onCropComplete:s,aspectRatio:i=1})=>{const o=P.useRef(null),[c,a]=P.useState(),[h,m]=P.useState(),[x,v]=P.useState(1),[w,k]=P.useState(0),C=P.useCallback(I=>{const{width:A,height:D}=I.currentTarget;a(Wft(A,D,i))},[i]),S=P.useCallback(async()=>{const I=o.current;if(!I||!h)return;const A=document.createElement("canvas"),D=A.getContext("2d");if(!D)return;const $=I.naturalWidth/I.width,F=I.naturalHeight/I.height,q=400;A.width=q,A.height=q,D.imageSmoothingQuality="high";const W=h.x*$,K=h.y*F,Z=h.width*$,re=h.height*F,he=w*Math.PI/180,ue=A.width/2,je=A.height/2;return D.save(),D.translate(ue,je),D.rotate(he),D.scale(x,x),D.translate(-ue,-je),D.drawImage(I,W,K,Z,re,0,0,q,q),D.restore(),new Promise((ne,ye)=>{A.toBlob(ie=>{ie?ne(ie):ye(new Error("Canvas is empty"))},"image/jpeg",.95)})},[h,x,w]),T=async()=>{try{const I=await S();I&&(s(I),e())}catch(I){console.error("Error cropping image:",I)}};return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Crop Your Photo"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative max-h-[400px] overflow-hidden rounded-lg bg-muted flex items-center justify-center",children:r.jsx(Cft,{crop:c,onChange:(I,A)=>a(A),onComplete:I=>m(I),aspect:i,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${w}deg)`,maxHeight:"400px",width:"auto"},onLoad:C})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(u4,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(kw,{value:[x],min:.5,max:3,step:.1,onValueChange:([I])=>v(I),className:"flex-1"}),r.jsx(d4,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(OT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(kw,{value:[w],min:-180,max:180,step:1,onValueChange:([I])=>k(I),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[w,"°"]})]})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:e,children:"Cancel"}),r.jsx(te,{onClick:T,children:"Save Photo"})]})]})})},Kft=()=>{const{user:t}=zr(),{toast:e}=ua(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[c,a]=P.useState(null);P.useEffect(()=>{t&&h()},[t]);const h=async()=>{s(!0);try{const{data:v}=await ee.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",t==null?void 0:t.id).single();v&&a({status:v.subscription_status||"none",productId:v.subscription_product_id,endDate:v.subscription_end_date,isGrandfathered:v.is_grandfathered||!1})}catch(v){console.error("Error loading subscription:",v)}finally{s(!1)}},m=async()=>{o(!0);try{const{data:{session:v}}=await ee.auth.getSession();if(!v)throw new Error("Not authenticated");const{data:w,error:k}=await ee.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${v.access_token}`}});if(k)throw k;w!=null&&w.url&&window.open(w.url,"_blank")}catch(v){console.error("Error opening customer portal:",v),e({title:"Error",description:v.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},x=()=>{if(c!=null&&c.isGrandfathered)return r.jsx(Ft,{className:"bg-amber-500",children:"Grandfathered"});switch(c==null?void 0:c.status){case"active":return r.jsx(Ft,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Ft,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Ft,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Ft,{variant:"secondary",children:"Canceled"});default:return r.jsx(Ft,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Z0,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Z0,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(In,{children:"Manage your subscription and billing"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:x()})]}),(c==null?void 0:c.endDate)&&c.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(c.endDate).toLocaleDateString()})]})]}),c!=null&&c.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(c==null?void 0:c.status)==="active"||(c==null?void 0:c.status)==="trialing"?r.jsxs(r.Fragment,{children:[(c==null?void 0:c.status)==="trialing"&&(c==null?void 0:c.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(c.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(te,{onClick:m,variant:"outline",disabled:i,children:[i?r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx($s,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active subscription."})]})]})},Zft=()=>{const{user:t}=zr(),e=ts(),{toast:n}=ua(),[s]=Pd(),i=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:c,isSubscribed:a,isLoading:h,subscribe:m,unsubscribe:x}=FOe(),[v,w]=P.useState(!1),[k,C]=P.useState(""),[S,T]=P.useState(!1),[I,A]=P.useState(!1),[D,$]=P.useState(""),[F,q]=P.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}),[W,K]=P.useState(!1),[Z,re]=P.useState(!1),[he,ue]=P.useState({newPassword:"",confirmPassword:""});P.useEffect(()=>{t&&je()},[t]),P.useEffect(()=>{o&&t&&setTimeout(()=>{var fe;(fe=document.getElementById("change-password-section"))==null||fe.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,t]);const je=async()=>{var fe,ve,Ie;if(!(t!=null&&t.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",t.id);const{data:Se,error:oe}=await ee.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("id",t.id).maybeSingle();if(oe)throw console.error("Profile query error:",oe),oe;Se?(console.log("Profile loaded successfully:",Se),q({name:Se.name||"",email:Se.email||"",title:Se.title||"",bio:Se.bio||"",areas_served:Se.areas_served||"",years_experience:((fe=Se.years_experience)==null?void 0:fe.toString())||"",instagram_url:Se.instagram_url||"",facebook_url:Se.facebook_url||"",linkedin_url:Se.linkedin_url||""}),K(Se.digest_opt_out||!1)):(console.warn("No profile found for user"),q({name:((ve=t.user_metadata)==null?void 0:ve.name)||((Ie=t.email)==null?void 0:Ie.split("@")[0])||"",email:t.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}));const{data:ae}=await ee.storage.from("avatars").list(`${t.id}`);if(ae&&ae.length>0){const{data:Ne}=ee.storage.from("avatars").getPublicUrl(`${t.id}/${ae[0].name}`);C(Ne.publicUrl)}}catch(Se){console.error("Error loading profile:",Se),n({title:"Error",description:Se.message||"Failed to load profile",variant:"destructive"})}},ne=fe=>{var Se;const ve=(Se=fe.target.files)==null?void 0:Se[0];if(!ve)return;const Ie=new FileReader;Ie.onloadend=()=>{$(Ie.result),A(!0)},Ie.readAsDataURL(ve),fe.target.value=""},ye=async fe=>{if(t){T(!0);try{const{data:ve}=await ee.storage.from("avatars").list(`${t.id}`);ve&&ve.length>0&&await ee.storage.from("avatars").remove(ve.map(Ne=>`${t.id}/${Ne.name}`));const Se=`${t.id}/avatar.jpg`,{error:oe}=await ee.storage.from("avatars").upload(Se,fe,{upsert:!0,contentType:"image/jpeg"});if(oe)throw oe;const{data:ae}=ee.storage.from("avatars").getPublicUrl(Se);C(`${ae.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(ve){console.error("Error uploading avatar:",ve),n({title:"Error",description:ve.message||"Failed to upload photo",variant:"destructive"})}finally{T(!1)}}},ie=async()=>{if(!F.name.trim()||!F.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}w(!0);try{const{error:fe}=await ee.from("profiles").update({name:F.name.trim(),email:F.email.trim(),title:F.title.trim()||null,bio:F.bio.trim()||null,areas_served:F.areas_served.trim()||null,years_experience:F.years_experience?parseInt(F.years_experience):null,instagram_url:F.instagram_url.trim()||null,facebook_url:F.facebook_url.trim()||null,linkedin_url:F.linkedin_url.trim()||null}).eq("id",t==null?void 0:t.id);if(fe)throw fe;n({title:"Success",description:"Profile updated successfully"})}catch(fe){console.error("Error updating profile:",fe),n({title:"Error",description:fe.message||"Failed to update profile",variant:"destructive"})}finally{w(!1)}},me=async()=>{if(!he.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(he.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(he.newPassword!==he.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}w(!0);try{const{error:fe}=await ee.auth.updateUser({password:he.newPassword});if(fe)throw fe;n({title:"Success",description:"Password updated successfully"}),ue({newPassword:"",confirmPassword:""}),i&&setTimeout(()=>e("/dashboard"),1e3)}catch(fe){console.error("Error updating password:",fe),n({title:"Error",description:fe.message||"Failed to update password",variant:"destructive"})}finally{w(!1)}};return r.jsx(Dr,{title:i?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:i?"Welcome! Please complete your profile setup":o?"Please set a new password for your account":"Manage your account information and password",children:r.jsxs("div",{className:"mx-auto max-w-4xl",children:[!i&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(te,{variant:"outline",onClick:()=>{var fe;(fe=document.getElementById("change-password-section"))==null||fe.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(nj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Profile Photo"}),r.jsx(In,{children:"Upload a professional photo for your profile"})]}),r.jsxs(et,{className:"flex items-center gap-6",children:[r.jsxs(Di,{className:"h-24 w-24",children:[r.jsx(Po,{src:k}),r.jsx(Ri,{className:"text-2xl",children:F.name.split(" ").map(fe=>fe[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ne,disabled:S}),r.jsxs(te,{variant:"outline",onClick:()=>{var fe;return(fe=document.getElementById("avatar-upload"))==null?void 0:fe.click()},disabled:S,children:[r.jsx(Ao,{className:"mr-2 h-4 w-4"}),S?"Uploading...":"Upload Photo"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload an image and crop it to your liking."})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Personal Information"}),r.jsx(In,{children:"Update your profile details"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",value:F.name,onChange:fe=>q({...F,name:fe.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"email",children:"Email"}),r.jsx(xt,{id:"email",type:"email",value:F.email,onChange:fe=>q({...F,email:fe.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Job Title"}),r.jsx(xt,{id:"title",value:F.title,onChange:fe=>q({...F,title:fe.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"bio",children:"Bio"}),r.jsx(xt,{id:"bio",value:F.bio,onChange:fe=>q({...F,bio:fe.target.value}),placeholder:"A short description about yourself",maxLength:500})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(xt,{id:"areas_served",value:F.areas_served,onChange:fe=>q({...F,areas_served:fe.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(xt,{id:"years_experience",type:"number",min:"0",value:F.years_experience,onChange:fe=>q({...F,years_experience:fe.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(xt,{value:F.linkedin_url,onChange:fe=>q({...F,linkedin_url:fe.target.value}),placeholder:"LinkedIn URL"}),r.jsx(xt,{value:F.instagram_url,onChange:fe=>q({...F,instagram_url:fe.target.value}),placeholder:"Instagram URL"}),r.jsx(xt,{value:F.facebook_url,onChange:fe=>q({...F,facebook_url:fe.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(te,{onClick:ie,disabled:v,children:[r.jsx(hg,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ze,{id:"change-password-section",children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:i?"Set Your Password":"Change Password"}),r.jsx(In,{children:i?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"newPassword",children:"New Password"}),r.jsx(xt,{id:"newPassword",type:"password",value:he.newPassword,onChange:fe=>ue({...he,newPassword:fe.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(xt,{id:"confirmPassword",type:"password",value:he.confirmPassword,onChange:fe=>ue({...he,confirmPassword:fe.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(te,{onClick:me,disabled:v,children:[r.jsx(hg,{className:"mr-2 h-4 w-4"}),i?"Complete Setup":"Update Password"]}),i&&r.jsx(te,{variant:"outline",onClick:()=>e("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[a?r.jsx(dg,{className:"h-5 w-5"}):r.jsx(Ww,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(In,{children:"Receive browser notifications when new content is added"})]}),r.jsx(et,{children:c?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:a?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(Js,{checked:a,onCheckedChange:fe=>{fe?m():x()},disabled:h})]}):r.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"Push notifications are not supported in this browser."}),r.jsxs("p",{className:"text-xs",children:[r.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",r.jsx("br",{}),r.jsx("strong",{children:"iPhone/iPad:"}),' Open this site in Safari, tap the Share button, then "Add to Home Screen". Push notifications will work from the installed app.']})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[W?r.jsx(MT,{className:"h-5 w-5"}):r.jsx(oi,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(In,{children:"Manage your email subscription settings"})]}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:W?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(Js,{checked:!W,onCheckedChange:async fe=>{re(!0);try{const{error:ve}=await ee.from("profiles").update({digest_opt_out:!fe}).eq("id",t==null?void 0:t.id);if(ve)throw ve;K(!fe),n({title:fe?"Subscribed":"Unsubscribed",description:fe?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(ve){n({title:"Error",description:ve.message||"Failed to update preference",variant:"destructive"})}finally{re(!1)}},disabled:Z})]})})]}),r.jsx(Kft,{})]}),r.jsx(Gft,{open:I,onClose:()=>A(!1),imageSrc:D,onCropComplete:ye,aspectRatio:1})]})})};var Yft="AspectRatio",R8e=P.forwardRef((t,e)=>{const{ratio:n=1/1,style:s,...i}=t;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(Dn.div,{...i,ref:e,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});R8e.displayName=Yft;var Xft=R8e;const Qft=Xft;function Jft(){const{user:t}=zr(),e=Qr(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),{data:c,isLoading:a}=rr({queryKey:["calendar-token",t==null?void 0:t.id],queryFn:async()=>{const{data:C,error:S}=await ee.from("profiles").select("calendar_token").eq("id",t==null?void 0:t.id).single();if(S)throw S;return C},enabled:!!t&&i}),h=dr({mutationFn:async()=>{const C=new Uint8Array(12);crypto.getRandomValues(C);const S=btoa(String.fromCharCode(...C)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:T}=await ee.from("profiles").update({calendar_token:S}).eq("id",t==null?void 0:t.id);if(T)throw T;return S},onSuccess:()=>{e.invalidateQueries({queryKey:["calendar-token",t==null?void 0:t.id]}),He.success("Calendar subscription URL generated!")},onError:C=>{He.error("Failed to generate calendar URL: "+C.message)}}),m=c!=null&&c.calendar_token?`https://dashboard.relevelup.com/api/calendar/${c.calendar_token}.ics`:null,x=async()=>{m&&(await navigator.clipboard.writeText(m),s(!0),He.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},v=()=>{m&&(window.location.href=m.replace("https://","webcal://"))},w=()=>{if(m){const C=m.replace("https://","webcal://"),S=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(C)}`;window.open(S,"_blank")}},k=()=>{if(m){const C=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(m)}&name=Level%20Up%20Events`;window.open(C,"_blank")}};return r.jsxs(Ur,{open:i,onOpenChange:o,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(us,{children:"Add all Level Up events to your personal calendar. Events will sync automatically and update when we add or change events."})]}),r.jsx("div",{className:"space-y-4 py-4",children:a?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):m?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Your Calendar URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:m,readOnly:!0,className:"text-xs font-mono"}),r.jsx(te,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx($a,{className:"h-4 w-4 text-green-500"}):r.jsx(Vl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:v,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})}),"Add to Apple Calendar",r.jsx($s,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:w,children:[r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("path",{d:"M19.5 22h-15A2.5 2.5 0 0 1 2 19.5v-15A2.5 2.5 0 0 1 4.5 2H9v2H4.5a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V15h2v4.5a2.5 2.5 0 0 1-2.5 2.5z"}),r.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),r.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),r.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",r.jsx($s,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(te,{variant:"outline",className:"w-full justify-start gap-2",onClick:k,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V12zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.81v-2.72zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z"})}),"Add to Outlook",r.jsx($s,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Events sync automatically. If your membership expires, the calendar will show as empty."})]}):r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),r.jsx(te,{onClick:()=>h.mutate(),disabled:h.isPending,className:"w-full",children:h.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(li,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var xse="Tabs",[ept]=Zl(xse,[i5]),F8e=i5(),[tpt,hxe]=ept(xse),z8e=P.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:o,orientation:c="horizontal",dir:a,activationMode:h="automatic",...m}=t,x=Zj(a),[v,w]=Eu({prop:s,onChange:i,defaultProp:o??"",caller:xse});return r.jsx(tpt,{scope:n,baseId:zc(),value:v,onValueChange:w,orientation:c,dir:x,activationMode:h,children:r.jsx(Dn.div,{dir:x,"data-orientation":c,...m,ref:e})})});z8e.displayName=xse;var B8e="TabsList",$8e=P.forwardRef((t,e)=>{const{__scopeTabs:n,loop:s=!0,...i}=t,o=hxe(B8e,n),c=F8e(n);return r.jsx(Nge,{asChild:!0,...c,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Dn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});$8e.displayName=B8e;var U8e="TabsTrigger",q8e=P.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,disabled:i=!1,...o}=t,c=hxe(U8e,n),a=F8e(n),h=W8e(c.baseId,s),m=G8e(c.baseId,s),x=s===c.value;return r.jsx(Sge,{asChild:!0,...a,focusable:!i,active:x,children:r.jsx(Dn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":m,"data-state":x?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:h,...o,ref:e,onMouseDown:an(t.onMouseDown,v=>{!i&&v.button===0&&v.ctrlKey===!1?c.onValueChange(s):v.preventDefault()}),onKeyDown:an(t.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&c.onValueChange(s)}),onFocus:an(t.onFocus,()=>{const v=c.activationMode!=="manual";!x&&!i&&v&&c.onValueChange(s)})})})});q8e.displayName=U8e;var V8e="TabsContent",H8e=P.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,forceMount:i,children:o,...c}=t,a=hxe(V8e,n),h=W8e(a.baseId,s),m=G8e(a.baseId,s),x=s===a.value,v=P.useRef(x);return P.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),r.jsx(lc,{present:i||x,children:({present:w})=>r.jsx(Dn.div,{"data-state":x?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":h,hidden:!w,id:m,tabIndex:0,...c,ref:e,style:{...t.style,animationDuration:v.current?"0s":void 0},children:w&&o})})});H8e.displayName=V8e;function W8e(t,e){return`${t}-trigger-${e}`}function G8e(t,e){return`${t}-content-${e}`}var rpt=z8e,K8e=$8e,Z8e=q8e,Y8e=H8e;const Oa=rpt,Ta=P.forwardRef(({className:t,...e},n)=>r.jsx(K8e,{ref:n,className:$t("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ta.displayName=K8e.displayName;const xn=P.forwardRef(({className:t,...e},n)=>r.jsx(Z8e,{ref:n,className:$t("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...e}));xn.displayName=Z8e.displayName;const Un=P.forwardRef(({className:t,...e},n)=>r.jsx(Y8e,{ref:n,className:$t("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Un.displayName=Y8e.displayName;const npt={first_timer:Bs,regular:Ox,dedicated:Ml,veteran:qa,streak_master:qh,century:qa},spt={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 dke(t){return t===1?r.jsx(qa,{className:"h-5 w-5 text-yellow-500"}):t===2?r.jsx(Ox,{className:"h-5 w-5 text-gray-400"}):t===3?r.jsx(Ml,{className:"h-5 w-5 text-amber-600"}):r.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:t})}function X8e({showUserStats:t=!0,compact:e=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:i}=zr(),{data:o,isLoading:c}=l8e(e?5:10,n),{data:a}=c8e(i==null?void 0:i.id),{data:h}=u8e(i==null?void 0:i.id),{data:m}=d8e(i==null?void 0:i.id);return c?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,v)=>r.jsx(Kr,{className:"h-12 w-full"},v))})})]}):r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(et,{children:[t&&a&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),h&&r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:["Rank #",h]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-primary",children:a.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold",children:a.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(qh,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:a.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),m&&m.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[m.slice(0,4).map(x=>{const v=npt[x.badge_type]||Bs;return r.jsxs(Ft,{variant:"outline",className:`text-xs ${spt[x.badge_type]||""}`,title:x.badge_description||"",children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),x.badge_name]},x.id)}),m.length>4&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:["+",m.length-4," more"]})]})]}),r.jsxs(Oa,{defaultValue:"points",className:"w-full",children:[r.jsxs(Ta,{className:"w-full mb-3",children:[r.jsx(xn,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(xn,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(Un,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,v)=>{var w,k,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${v===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:dke(v+1)}),r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{className:"text-xs",children:((k=(w=x.profile)==null?void 0:w.name)==null?void 0:k.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=x.profile)==null?void 0:C.name)||"Unknown",x.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:x.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},x.user_id)}),(!o||o.length===0)&&r.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No attendance data yet. Attend an event to get on the leaderboard!"})]})}),r.jsx(Un,{value:"events",className:"mt-0",children:r.jsx("div",{className:"space-y-2",children:[...o||[]].sort((x,v)=>v.total_events_attended-x.total_events_attended).map((x,v)=>{var w,k,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${v===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:dke(v+1)}),r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{className:"text-xs",children:((k=(w=x.profile)==null?void 0:w.name)==null?void 0:k.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=x.profile)==null?void 0:C.name)||"Unknown",x.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:x.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},x.user_id)})})})]})]})]})}function ipt(){const t=ts(),{user:e,isAdmin:n}=zr(),s=Qr(),{data:i,isLoading:o}=rr({queryKey:["public-events"],queryFn:async()=>{const{data:S,error:T}=await ee.from("events").select("*").order("event_date",{ascending:!0});if(T)throw T;return S}}),{data:c}=rr({queryKey:["my-registrations"],queryFn:async()=>{if(!e)return[];const{data:S,error:T}=await ee.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e.id);if(T)throw T;return S},enabled:!!e}),{data:a}=rr({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:S,error:T}=await ee.from("event_registrations").select("event_id");if(T)throw T;const I={};return S.forEach(A=>{I[A.event_id]=(I[A.event_id]||0)+1}),I}}),h=dr({mutationFn:async S=>{const{data:T,error:I}=await ee.functions.invoke("zoom-register",{body:{event_id:S}});if(I)throw I;if(T!=null&&T.error)throw new Error(T.error);return T},onSuccess:S=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),S!=null&&S.join_url?He.success("Successfully registered! You'll receive a Zoom confirmation email."):He.success("Successfully registered for the event!")},onError:S=>{He.error("Failed to register: "+S.message)}}),m=dr({mutationFn:async S=>{const{data:T,error:I}=await ee.functions.invoke("zoom-unregister",{body:{event_id:S}});if(I)throw I;if(T!=null&&T.error)throw new Error(T.error);return T},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),He.success("Registration cancelled and removed from Zoom")},onError:S=>{He.error("Failed to cancel: "+S.message)}}),x=S=>c==null?void 0:c.some(T=>T.event_id===S),v=S=>{const T=c==null?void 0:c.find(I=>I.event_id===S);return T==null?void 0:T.zoom_join_url},w=S=>S.capacity?((a==null?void 0:a[S.id])||0)>=S.capacity:!1,k=(i==null?void 0:i.filter(S=>w4(S.event_date)!=="ended"))||[],C=(i==null?void 0:i.filter(S=>w4(S.event_date)==="ended"))||[];return r.jsx(Dr,{title:"Events",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Events"}),r.jsx("p",{className:"text-muted-foreground",children:"Browse and register for upcoming events"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Jft,{}),n&&r.jsx(te,{variant:"outline",onClick:()=>t("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${n?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:n?"lg:col-span-2":"",children:[o?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):k.length===0?r.jsx(Ze,{className:"text-center py-12",children:r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:k.map(S=>{const T=w4(S.event_date),I=sxe(S.event_date),A=T==="live",D=T==="starting_soon";return r.jsxs(Ze,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${A?"border-red-500 ring-2 ring-red-500/20":D?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>t(`/events/${S.id}`),children:[I&&r.jsxs("div",{className:`${A?"bg-red-500":"bg-amber-500"} text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium`,children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),A?r.jsxs(r.Fragment,{children:[r.jsx(ij,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Gi,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),S.image_url&&r.jsx(Qft,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:S.image_url,alt:S.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Wt,{children:[r.jsx(Xt,{className:"line-clamp-2",children:S.title}),S.description&&r.jsx(In,{className:"line-clamp-2",children:S.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(et,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(S.event_date),"EEEE, MMMM d, yyyy")]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Gi,{className:"h-4 w-4"}),ute(new Date(S.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(fs,{className:"h-4 w-4"}),(a==null?void 0:a[S.id])||0," registered",S.capacity&&` / ${S.capacity} spots`]})]}),r.jsx(ZT,{className:"flex gap-2",onClick:$=>$.stopPropagation(),children:x(S.id)?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>m.mutate(S.id),disabled:m.isPending,children:[r.jsx(Es,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(te,{className:"flex-1",onClick:()=>window.open(v(S.id)||S.zoom_link,"_blank"),children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(te,{className:"w-full",onClick:()=>h.mutate(S.id),disabled:h.isPending||w(S),children:w(S)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx($a,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},S.id)})}),C.length>0&&r.jsxs("div",{className:"mt-12",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:C.map(S=>r.jsx(Ze,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t(`/events/${S.id}`),children:r.jsxs(Wt,{children:[r.jsx(Xt,{className:"text-base line-clamp-1",children:S.title}),r.jsx(In,{children:un(new Date(S.event_date),"MMMM d, yyyy")})]})},S.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(X8e,{showUserStats:!0})})]})]})})}const qle=[{value:"all",label:"All Roles",icon:fs},{value:"brokerage_manager",label:"Brokerage Managers",icon:VT},{value:"admin",label:"Admins",icon:lm}];function apt({open:t,onOpenChange:e,resourceType:n,resourceId:s,resourceTitle:i}){var Ce,Je;const{user:o,isAdmin:c,isBrokerageManager:a}=zr(),[h,m]=P.useState([]),[x,v]=P.useState([]),[w,k]=P.useState([]),[C,S]=P.useState([]),[T,I]=P.useState(""),[A,D]=P.useState(""),[$,F]=P.useState(""),[q,W]=P.useState(!1),[K,Z]=P.useState(!1),[re,he]=P.useState("agents"),[ue,je]=P.useState("all"),[ne,ye]=P.useState({}),ie=c||a;P.useEffect(()=>{t&&o&&(c?me():fe())},[t,o,c]),P.useEffect(()=>{t||(k([]),S([]),I(""),D(""),F(""),he("agents"),je("all"))},[t]);const me=async()=>{if(o){W(!0);try{const{data:Ae,error:Ye}=await ee.from("brokerages").select("id, name").order("name");if(Ye)throw Ye;const ge=1e3,ft={};let nt=0,Ve=!0;for(;Ve;){const{data:Re,error:Ge}=await ee.from("profiles").select("brokerage_id").range(nt*ge,(nt+1)*ge-1);if(Ge)throw Ge;Re==null||Re.forEach(tt=>{tt.brokerage_id&&(ft[tt.brokerage_id]=(ft[tt.brokerage_id]||0)+1)}),Ve=(Re==null?void 0:Re.length)===ge,nt++}v((Ae==null?void 0:Ae.map(Re=>({...Re,agent_count:ft[Re.id]||0})))||[]);const Me=[];for(nt=0,Ve=!0;Ve;){const{data:Re,error:Ge}=await ee.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(nt*ge,(nt+1)*ge-1);if(Ge)throw Ge;Re&&Me.push(...Re),Ve=(Re==null?void 0:Re.length)===ge,nt++}const rt={};for(nt=0,Ve=!0;Ve;){const{data:Re,error:Ge}=await ee.from("user_roles").select("user_id, role").range(nt*ge,(nt+1)*ge-1);if(Ge)throw Ge;Re==null||Re.forEach(tt=>{rt[tt.user_id]||(rt[tt.user_id]=[]),rt[tt.user_id].push(tt.role)}),Ve=(Re==null?void 0:Re.length)===ge,nt++}ye(rt),m(Me.map(Re=>{var Ge;return{id:Re.id,name:Re.name,email:Re.email,brokerage_name:((Ge=Re.brokerages)==null?void 0:Ge.name)||"No Brokerage",roles:rt[Re.id]||[]}}))}catch(Ae){console.error("Error loading data:",Ae),He.error("Failed to load agents and brokerages")}finally{W(!1)}}},fe=async()=>{if(o){W(!0);try{const{data:Ae}=await ee.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Ae!=null&&Ae.brokerage_id)){He.error("You must be part of a brokerage to share resources"),e(!1);return}const{data:Ye,error:ge}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",Ae.brokerage_id).neq("id",o.id).order("name");if(ge)throw ge;m(Ye||[])}catch(Ae){console.error("Error loading agents:",Ae),He.error("Failed to load agents")}finally{W(!1)}}},ve=h.filter(Ae=>{var ge;const Ye=Ae.name.toLowerCase().includes(T.toLowerCase())||Ae.email.toLowerCase().includes(T.toLowerCase())||((ge=Ae.brokerage_name)==null?void 0:ge.toLowerCase().includes(T.toLowerCase()));if(c&&ue!=="all"){const ft=ne[Ae.id]||[];return Ye&&ft.includes(ue)}return Ye}),Ie=x.filter(Ae=>Ae.name.toLowerCase().includes(A.toLowerCase())),Se=()=>{w.length===ve.length?k([]):k(ve.map(Ae=>Ae.id))},oe=()=>{C.length===Ie.length?S([]):S(Ie.map(Ae=>Ae.id))},ae=Ae=>{if(!ie){k([Ae]);return}k(Ye=>Ye.includes(Ae)?Ye.filter(ge=>ge!==Ae):[...Ye,Ae])},Ne=Ae=>{S(Ye=>Ye.includes(Ae)?Ye.filter(ge=>ge!==Ae):[...Ye,Ae])},Te=async()=>{if(!(w.length>0||C.length>0)){He.error("Please select at least one agent or brokerage to share with");return}Z(!0);try{const{data:Ye,error:ge}=await ee.functions.invoke("send-share-notification",{body:{recipientIds:w,brokerageIds:C,resourceType:n,resourceId:s,resourceTitle:i,message:$.trim()||void 0}});if(ge)throw ge;const ft=(Ye==null?void 0:Ye.sharesCreated)||w.length;He.success(`Shared with ${ft} agent${ft!==1?"s":""}`),e(!1)}catch(Ye){console.error("Error sharing resource:",Ye),He.error("Failed to share resource")}finally{Z(!1)}},Be=Ae=>Ae.split(" ").map(Ye=>Ye[0]).join("").toUpperCase().slice(0,2),Le=Ae=>{const Ye=ne[Ae]||[];return Ye.includes("admin")?r.jsx(Ft,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Ye.includes("brokerage_manager")?r.jsx(Ft,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Qe=w.length+C.length,Fe=ue!=="all"?ve.length:null;return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(Yr,{className:"flex-shrink-0",children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(us,{className:"line-clamp-2",children:['Share "',i,'" with ',c?"agents or brokerages":"agents in your brokerage"]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[c?r.jsxs(Oa,{value:re,onValueChange:he,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(xn,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),w.length>0&&r.jsx(Ft,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:w.length})]}),r.jsxs(xn,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),C.length>0&&r.jsx(Ft,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:C.length})]})]}),r.jsxs(Un,{value:"agents",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name, email, or brokerage...",value:T,onChange:Ae=>I(Ae.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:ue,onValueChange:je,children:[r.jsxs(yn,{className:"w-[180px]",children:[r.jsx(Jw,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(bn,{placeholder:"Filter by role"})]}),r.jsx(vn,{children:qle.map(Ae=>r.jsx(tr,{value:Ae.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ae.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Ae.label})]})},Ae.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:ve.length===0,children:[r.jsx(fs,{className:"h-3.5 w-3.5 mr-1.5"}),w.length===ve.length&&ve.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Fe!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Fe," ",(Ce=qle.find(Ae=>Ae.value===ue))==null?void 0:Ce.label]}),r.jsxs("span",{className:"font-medium",children:[w.length," selected"]})]})]}),r.jsx(_l,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ve.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(fs,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:ue!=="all"?`No ${(Je=qle.find(Ae=>Ae.value===ue))==null?void 0:Je.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ve.map(Ae=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${w.includes(Ae.id)?"bg-accent":""}`,onClick:()=>ae(Ae.id),children:[r.jsx(vc,{checked:w.includes(Ae.id),onCheckedChange:()=>ae(Ae.id),className:"flex-shrink-0"}),r.jsx(Di,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Ri,{className:"text-xs bg-primary/10 text-primary",children:Be(Ae.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ae.name}),Le(Ae.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Ae.email,Ae.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Ae.brokerage_name]})]})]})]},Ae.id))})})]}),r.jsxs(Un,{value:"brokerages",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search brokerages...",value:A,onChange:Ae=>D(Ae.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:oe,className:"text-xs h-8",disabled:Ie.length===0,children:[r.jsx(na,{className:"h-3.5 w-3.5 mr-1.5"}),C.length===Ie.length&&Ie.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[C.length," selected"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground px-1 flex-shrink-0",children:"Selecting a brokerage will send to all agents in that brokerage."}),r.jsx(_l,{className:"h-[250px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ie.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(na,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No brokerages found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:Ie.map(Ae=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${C.includes(Ae.id)?"bg-accent":""}`,onClick:()=>Ne(Ae.id),children:[r.jsx(vc,{checked:C.includes(Ae.id),onCheckedChange:()=>Ne(Ae.id),className:"flex-shrink-0"}),r.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(na,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ae.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ae.agent_count," agent",Ae.agent_count!==1?"s":""]})]})]},Ae.id))})})]})]}):r.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search agents...",value:T,onChange:Ae=>I(Ae.target.value),className:"pl-9"})]}),ie&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:Se,className:"text-xs h-8",disabled:ve.length===0,children:[r.jsx(fs,{className:"h-3.5 w-3.5 mr-1.5"}),w.length===ve.length&&ve.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[w.length," selected"]})]}),r.jsx(_l,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ve.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(fs,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ve.map(Ae=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${w.includes(Ae.id)?"bg-accent":""}`,onClick:()=>ae(Ae.id),children:[r.jsx(vc,{checked:w.includes(Ae.id),onCheckedChange:()=>ae(Ae.id),className:"flex-shrink-0"}),r.jsx(Di,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Ri,{className:"text-xs bg-primary/10 text-primary",children:Be(Ae.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ae.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ae.email})]})]},Ae.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(Xe,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(gs,{id:"message",placeholder:"I thought you might find this useful...",value:$,onChange:Ae=>F(Ae.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:Te,disabled:Qe===0||K,children:K?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function o5({resourceType:t,resourceId:e,resourceTitle:n,variant:s="outline",size:i="sm",className:o=""}){const[c,a]=P.useState(!1),{user:h}=zr();return h?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:s,size:i,onClick:()=>a(!0),className:o,children:[r.jsx(Xd,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(apt,{open:c,onOpenChange:a,resourceType:t,resourceId:e,resourceTitle:n})]}):null}function opt(){const{eventId:t}=hd(),e=ts(),{user:n}=zr(),[s,i]=P.useState(null),[o,c]=P.useState(null),[a,h]=P.useState(0),[m,x]=P.useState(!0),[v,w]=P.useState(!1);P.useEffect(()=>{t&&k()},[t,n]);const k=async()=>{try{const{data:D,error:$}=await ee.from("events").select("*").eq("id",t).single();if($)throw $;i(D);const{count:F}=await ee.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",t);if(h(F||0),n){const{data:q}=await ee.from("event_registrations").select("id, zoom_join_url").eq("event_id",t).eq("user_id",n.id).maybeSingle();c(q)}}catch(D){console.error("Error loading event:",D),He.error("Failed to load event"),e("/events")}finally{x(!1)}},C=async()=>{if(!(!n||!s)){w(!0);try{if(o){const{error:D}=await ee.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(D)throw D;He.success("Successfully cancelled registration"),c(null),h($=>$-1)}else{const{data:D,error:$}=await ee.functions.invoke("zoom-register",{body:{event_id:s.id}});if($)throw $;He.success("Successfully registered for event!"),c({id:D.registration_id,zoom_join_url:D.zoom_join_url}),h(F=>F+1)}}catch(D){console.error("Registration error:",D),He.error(o?"Failed to cancel registration":"Failed to register for event")}finally{w(!1)}}},S=D=>{var $,F,q;if(D.includes("iframe.mediadelivery.net")||D.includes("video.bunnycdn.com")){const W=D.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(W)return`https://iframe.mediadelivery.net/embed/${W[1]}/${W[2]}?autoplay=false&preload=true`}if(D.includes("youtube.com")||D.includes("youtu.be")){const W=D.includes("youtu.be")?($=D.split("youtu.be/")[1])==null?void 0:$.split("?")[0]:(F=D.split("v=")[1])==null?void 0:F.split("&")[0];if(W)return`https://www.youtube.com/embed/${W}`}if(D.includes("vimeo.com")){const W=(q=D.split("vimeo.com/")[1])==null?void 0:q.split("?")[0];if(W)return`https://player.vimeo.com/video/${W}`}return D};if(m)return r.jsx(Dr,{title:"Event",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!s)return r.jsx(Dr,{title:"Event Not Found",children:r.jsxs("div",{className:"text-center py-16",children:[r.jsx("p",{className:"text-muted-foreground",children:"Event not found"}),r.jsx(te,{onClick:()=>e("/events"),className:"mt-4",children:"Back to Events"})]})});const T=odt(new Date(s.event_date)),I=s.capacity&&a>=s.capacity,A=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Dr,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(te,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>e("/events"),children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Events"]}),s.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),T&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ft,{variant:"secondary",className:"text-lg px-4 py-2",children:"Event Ended"})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground",children:s.title}),r.jsx(o5,{resourceType:"event",resourceId:s.id,resourceTitle:s.title})]}),s.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground dark:prose-invert",dangerouslySetInnerHTML:{__html:s.description}})]}),s.video_url&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(Af,{className:"h-5 w-5"}),"Event Preview"]}),r.jsx("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden border bg-muted",children:r.jsx("iframe",{src:S(s.video_url),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Event Preview Video"})})]})]}),r.jsx("div",{className:"space-y-4",children:r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(li,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:un(new Date(s.event_date),"EEEE, MMMM d, yyyy")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:ute(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(fs,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[a," / ",s.capacity]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Registered"})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 rounded-lg",children:[r.jsx(Ba,{className:"h-5 w-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),r.jsxs("div",{className:"space-y-2 pt-2",children:[!T&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(te,{className:"w-full gap-2",onClick:()=>window.open(A,"_blank"),children:[r.jsx($s,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:C,disabled:v,children:[v?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(te,{className:"w-full gap-2",onClick:C,disabled:v||(I??!1),children:v?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):I?"Event Full":"Register Now"})}),T&&o&&r.jsxs(te,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx($s,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const lpt=()=>{const{user:t,isAdmin:e}=zr(),n=ts(),[s,i]=P.useState([]),[o,c]=P.useState(!0),[a,h]=P.useState(""),[m,x]=P.useState("all"),[v,w]=P.useState(new Set);P.useEffect(()=>{k()},[t]);const k=async()=>{try{const{data:A}=await ee.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),D=(A==null?void 0:A.map(re=>re.tag))||[],{data:$,error:F}=await ee.from("app_tiles").select("*").order("name");if(F)throw F;const{data:q}=await ee.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),W=new Set((q==null?void 0:q.map(re=>re.app_id))||[]);w(W);const Z=(($==null?void 0:$.filter(re=>!re.required_tags||re.required_tags.length===0?!0:re.required_tags.some(he=>D.includes(he))))||[]).sort((re,he)=>re.name==="LevelUp Members Portal"?-1:he.name==="LevelUp Members Portal"?1:0);i(Z)}catch(A){console.error("Error loading apps:",A),He.error("Failed to load apps")}finally{c(!1)}},C=async A=>{var $;const D=window.open("about:blank","_blank");try{const{data:F,error:q}=await ee.auth.getSession();if(q||!F.session){D==null||D.close(),He.error("Session expired. Please refresh the page and try again.");return}const W=F.session.access_token;await ee.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:A.app_id,app_name:A.name,user_agent:navigator.userAgent});const{data:K,error:Z}=await ee.functions.invoke("sso-launch",{body:{app_id:A.app_id},headers:{Authorization:`Bearer ${W}`}});if(Z)throw Z;K!=null&&K.redirect_url?D&&!D.closed?(D.location.href=K.redirect_url,($=D.focus)==null||$.call(D)):window.location.assign(K.redirect_url):(D==null||D.close(),He.error("Launch link unavailable"))}catch(F){D==null||D.close(),console.error("Error launching app:",F),He.error("Failed to launch app. Please try again.")}},S=async(A,D)=>{A.stopPropagation();const $=v.has(D);try{if($){const{error:F}=await ee.from("user_favorites").delete().eq("user_id",t==null?void 0:t.id).eq("app_id",D);if(F)throw F;w(q=>{const W=new Set(q);return W.delete(D),W}),He.success("Removed from favorites")}else{const{error:F}=await ee.from("user_favorites").insert({user_id:t==null?void 0:t.id,app_id:D});if(F)throw F;w(q=>new Set(q).add(D)),He.success("Added to favorites")}}catch(F){console.error("Error toggling favorite:",F),He.error("Failed to update favorites")}},T=s.filter(A=>{var $;const D=A.name.toLowerCase().includes(a.toLowerCase())||(($=A.description)==null?void 0:$.toLowerCase().includes(a.toLowerCase()));return m==="favorites"?D&&v.has(A.id):D}),I=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Dr,{title:"Apps & Tools",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading apps..."})]})})}):r.jsxs(Dr,{title:"Apps & Tools",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Apps & Tools"}),r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:a,onChange:A=>h(A.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:I.map(A=>r.jsxs("button",{onClick:()=>x(A.id),className:$t("pb-3 text-sm font-medium transition-colors relative",m===A.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[A.label,m===A.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},A.id))}),T.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:m==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(nm,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No favorites yet"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:"Click the bookmark icon on any app to add it to your favorites"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Uf,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:e?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),e&&r.jsx(te,{className:"mt-4",onClick:()=>n("/admin/apps"),children:"Add Apps"})]})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:T.map(A=>{const D=v.has(A.id),$=A.name.toLowerCase().includes("agent review")||A.app_id==="agent_review";return r.jsxs("div",{className:"group flex flex-col p-5 bg-card rounded-xl border border-border transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>C(A),children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:A.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:A.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:A.description})]}),r.jsx("button",{className:$t("flex-shrink-0 p-1 transition-colors",D?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:F=>S(F,A.id),children:r.jsx(nm,{className:$t("h-5 w-5",D&&"fill-current")})})]}),$&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:F=>F.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},A.id)})})]})},cpt=()=>{const t=ts(),[e,n]=P.useState(""),[s,i]=P.useState("all"),[o,c]=P.useState("all"),[a,h]=P.useState("grid"),{data:m=[]}=rr({queryKey:["template-categories"],queryFn:async()=>{const{data:I,error:A}=await ee.from("template_categories").select("*").order("name");if(A)throw A;return I}}),{data:x=[]}=rr({queryKey:["template-types"],queryFn:async()=>{const{data:I,error:A}=await ee.from("template_types").select("*").order("name");if(A)throw A;return I}}),{data:v=[],isLoading:w}=rr({queryKey:["canva-templates"],queryFn:async()=>{const{data:I,error:A}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(A)throw A;const{data:D,error:$}=await ee.from("template_links").select("*").order("sort_order");if($)throw $;const{data:F}=await ee.from("template_likes").select("template_id"),{data:q}=await ee.from("template_comments").select("template_id"),W=new Map;F==null||F.forEach(re=>{W.set(re.template_id,(W.get(re.template_id)||0)+1)});const K=new Map;return q==null||q.forEach(re=>{K.set(re.template_id,(K.get(re.template_id)||0)+1)}),(I||[]).map(re=>({...re,links:(D||[]).filter(he=>he.template_id===re.id)||[],likesCount:W.get(re.id)||0,commentsCount:K.get(re.id)||0}))}}),k=v.filter(I=>{var F;const A=I.name.toLowerCase().includes(e.toLowerCase())||((F=I.description)==null?void 0:F.toLowerCase().includes(e.toLowerCase())),D=s==="all"||I.category_id===s,$=o==="all"||I.type_id===o;return A&&D&&$}),C=()=>{n(""),i("all"),c("all")},S=e||s!=="all"||o!=="all",T=I=>{t(`/templates/${I}`)};return r.jsx(Dr,{title:"Canva Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Canva Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and use our collection of professionally designed templates"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search templates...",value:e,onChange:I=>n(I.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:s,onValueChange:i,children:[r.jsx(yn,{className:"w-full sm:w-48",children:r.jsx(bn,{placeholder:"All Categories"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Categories"}),m.map(I=>r.jsx(tr,{value:I.id,children:I.name},I.id))]})]}),r.jsxs(_n,{value:o,onValueChange:c,children:[r.jsx(yn,{className:"w-full sm:w-48",children:r.jsx(bn,{placeholder:"All Types"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Types"}),x.map(I=>r.jsx(tr,{value:I.id,children:I.name},I.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[S&&r.jsx(te,{variant:"outline",size:"sm",onClick:C,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:a==="grid"?"secondary":"outline",size:"icon",onClick:()=>h("grid"),className:"rounded-full",children:r.jsx(im,{className:"h-4 w-4"})}),r.jsx(te,{variant:a==="list"?"secondary":"outline",size:"icon",onClick:()=>h("list"),className:"rounded-full",children:r.jsx($f,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[k.length," template",k.length!==1?"s":""," found"]}),w&&r.jsx("div",{className:a==="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((I,A)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Kr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Kr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Kr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Kr,{className:"h-5 w-16"}),r.jsx(Kr,{className:"h-5 w-20"})]})]})},A))}),!w&&k.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:S?"No templates match your filters":"No templates available yet"}),S&&r.jsx(te,{variant:"outline",onClick:C,children:"Clear Filters"})]}),!w&&k.length>0&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:k.map(I=>r.jsxs(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${a==="list"?"flex flex-row":""}`,onClick:()=>T(I.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${a==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[I.preview_image_url?r.jsx("img",{src:I.preview_image_url,alt:I.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),I.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(bo,{className:"h-3 w-3"}),I.links.length]})})]}),r.jsxs(et,{className:`p-4 flex flex-col ${a==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:I.name}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:jne(I.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[I.category&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:I.category.name}),I.type&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:I.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ad,{className:"h-3.5 w-3.5"}),I.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wl,{className:"h-3.5 w-3.5"}),I.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:A=>{A.stopPropagation(),T(I.id)},children:[r.jsx($s,{className:"h-4 w-4"}),"View Template"]})]})]},I.id))})]})})};var dpt="Separator",uke="horizontal",upt=["horizontal","vertical"],Q8e=P.forwardRef((t,e)=>{const{decorative:n,orientation:s=uke,...i}=t,o=hpt(s)?s:uke,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Dn.div,{"data-orientation":o,...a,...i,ref:e})});Q8e.displayName=dpt;function hpt(t){return upt.includes(t)}var J8e=Q8e;const Gd=P.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...s},i)=>r.jsx(J8e,{ref:i,decorative:n,orientation:e,className:$t("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));Gd.displayName=J8e.displayName;const xI=()=>({trackEngagement:P.useCallback(async(e,n,s,i="view")=>{try{const{data:{user:o}}=await ee.auth.getUser();if(!o)return;await ee.from("content_engagement_logs").insert({user_id:o.id,resource_type:e,resource_id:n,resource_title:s,action_type:i})}catch(o){console.error("Error tracking engagement:",o)}},[])}),fpt=()=>{const{templateId:t}=hd(),{user:e,isAdmin:n}=zr(),{toast:s}=ua(),i=Qr(),{trackEngagement:o}=xI(),[c,a]=P.useState(""),{data:h,isLoading:m}=rr({queryKey:["template-detail",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",t).single();if(D)throw D;const{data:$}=await ee.from("template_links").select("*").eq("template_id",t).order("sort_order"),{data:F}=await ee.from("template_guides").select("*").eq("template_id",t).order("sort_order");return{...A,links:$||[],guides:F||[]}},enabled:!!t});P.useEffect(()=>{h&&o("template",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=rr({queryKey:["template-likes",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("template_likes").select("*").eq("template_id",t);if(D)throw D;return A},enabled:!!t}),{data:v=[]}=rr({queryKey:["template-comments",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("template_comments").select("*").eq("template_id",t).order("created_at",{ascending:!1});if(D)throw D;const $=[...new Set(A.map(W=>W.user_id))],{data:F}=await ee.from("profiles").select("id, name").in("id",$),q=new Map((F==null?void 0:F.map(W=>[W.id,W.name]))||[]);return A.map(W=>({...W,user_name:q.get(W.user_id)||"Unknown User"}))},enabled:!!t}),w=dr({mutationFn:async A=>{const{error:D}=await ee.from("template_comments").insert({template_id:t,user_id:e.id,content:A});if(D)throw D},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",t]}),a(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error adding comment",description:A.message,variant:"destructive"})}}),k=dr({mutationFn:async A=>{const{error:D}=await ee.from("template_comments").delete().eq("id",A);if(D)throw D},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",t]}),s({title:"Comment deleted"})}}),C=dr({mutationFn:async()=>{const A=x.find(D=>D.user_id===(e==null?void 0:e.id));if(A){const{error:D}=await ee.from("template_likes").delete().eq("id",A.id);if(D)throw D}else{const{error:D}=await ee.from("template_likes").insert({template_id:t,user_id:e.id});if(D)throw D}},onSuccess:()=>{i.invalidateQueries({queryKey:["template-likes",t]})}}),S=x.some(A=>A.user_id===(e==null?void 0:e.id)),T=A=>A.split(" ").map(D=>D[0]).join("").toUpperCase().slice(0,2),I=A=>{A.preventDefault(),!(!c.trim()||!e)&&w.mutate(c.trim())};return m?r.jsx(Dr,{title:"Templates",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Dr,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(io,{to:"/templates",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Templates"]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.category&&r.jsx(Ft,{variant:"secondary",children:h.category.name}),h.type&&r.jsx(Ft,{variant:"outline",children:h.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(io,{to:`/admin/templates?edit=${h.id}`,children:[r.jsx(ya,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(o5,{resourceType:"template",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(te,{variant:S?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(Ad,{className:`h-4 w-4 ${S?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&>p]:mb-4 [&>p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:h.description}})]}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(bo,{className:"h-4 w-4"}),h.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(A=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_canva"),window.open(A.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:A.title}),r.jsx($s,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),h.video_url&&r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:h.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),h.guides&&h.guides.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Si,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:h.guides.map(A=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_pdf"),window.open(A.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:A.name}),A.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(A.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),r.jsx(Gd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Wl,{className:"h-5 w-5"}),"Comments (",v.length,")"]}),e?r.jsxs("form",{onSubmit:I,className:"flex gap-2",children:[r.jsx(gs,{placeholder:"Add a comment...",value:c,onChange:A=>a(A.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!c.trim()||w.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:v.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):v.map(A=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Di,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Ri,{className:"text-sm",children:T(A.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:A.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Qd(new Date(A.created_at),{addSuffix:!0})}),A.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>k.mutate(A.id),children:r.jsx(es,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content})]})]})})},A.id))})]})]})}):r.jsx(Dr,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(bo,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(io,{to:"/templates",children:"Back to Templates"})})]})})},ppt=()=>{const{user:t}=zr(),[e,n]=P.useState(""),[s,i]=P.useState("all"),{data:o=[]}=rr({queryKey:["academy-categories"],queryFn:async()=>{const{data:w,error:k}=await ee.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(k)throw k;return w}}),{data:c=[],isLoading:a}=rr({queryKey:["academy-videos"],queryFn:async()=>{const{data:w,error:k}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(k)throw k;const{data:C,error:S}=await ee.from("academy_resources").select("*").order("sort_order");if(S)throw S;return w.map(I=>({...I,resources:(C==null?void 0:C.filter(A=>A.video_id===I.id))||[]}))}}),{data:h=[]}=rr({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:w,error:k}=await ee.from("academy_video_likes").select("video_id, user_id");if(k)throw k;return w}}),m=c.filter(w=>{var S;const k=e===""||w.title.toLowerCase().includes(e.toLowerCase())||((S=w.description)==null?void 0:S.toLowerCase().includes(e.toLowerCase())),C=s==="all"||w.category_id===s;return k&&C}),x=w=>h.filter(k=>k.video_id===w).length,v=w=>h.some(k=>k.video_id===w&&k.user_id===(t==null?void 0:t.id));return r.jsx(Dr,{title:"Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Academy"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"On-demand training videos and resources"})]}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search videos...",value:e,onChange:w=>n(w.target.value),className:"pl-10"})]})}),r.jsx(Oa,{value:s,onValueChange:i,children:r.jsxs(Ta,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(xn,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(w=>r.jsx(xn,{value:w.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:w.name},w.id))]})}),a?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Wi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"No videos found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:e?"Try adjusting your search terms":"Check back soon for new content"})]})}):r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:m.map(w=>r.jsx(io,{to:`/academy/${w.id}`,children:r.jsxs(Ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[w.thumbnail_url?r.jsx("img",{src:w.thumbnail_url,alt:w.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Wi,{className:"h-12 w-12 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:r.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/90 flex items-center justify-center",children:r.jsx(wc,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),w.duration&&r.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded flex items-center gap-1",children:[r.jsx(Gi,{className:"h-3 w-3"}),w.duration]})]}),r.jsxs(Wt,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Xt,{className:"text-lg line-clamp-2",children:w.title})}),w.category&&r.jsx(Ft,{variant:"secondary",className:"w-fit",children:w.category.name})]}),r.jsxs(et,{className:"pt-0",children:[w.description&&r.jsx(In,{className:"line-clamp-2",children:w.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ad,{className:`h-4 w-4 ${v(w.id)?"fill-primary text-primary":""}`}),x(w.id)]}),w.resources&&w.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Si,{className:"h-4 w-4"}),w.resources.length]})]})]})]})},w.id))})]})})},mpt=(t,e)=>{if(e==="bunny_stream"){let n=t.replace("iframe.mediadelivery.net","player.mediadelivery.net");return n.includes("?")||(n+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),n}if(e==="youtube"){const n=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=t.match(n);if(s)return`https://www.youtube.com/embed/${s[1]}`}if(e==="vimeo"){const n=/vimeo\.com\/(?:video\/)?(\d+)/,s=t.match(n);if(s)return`https://player.vimeo.com/video/${s[1]}`}if(e==="loom"){const n=/loom\.com\/share\/([a-zA-Z0-9]+)/,s=t.match(n);if(s)return`https://www.loom.com/embed/${s[1]}`}return t},gpt=()=>{const{videoId:t}=hd();ts();const{user:e}=zr(),{toast:n}=ua(),s=Qr(),{trackEngagement:i}=xI(),[o,c]=P.useState(""),{data:a,isLoading:h}=rr({queryKey:["academy-video",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",t).eq("is_published",!0).single();if(D)throw D;const{data:$}=await ee.from("academy_resources").select("*").eq("video_id",t).order("sort_order");return{...A,resources:$||[]}},enabled:!!t});P.useEffect(()=>{a&&i("academy_video",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:m=[]}=rr({queryKey:["academy-video-likes",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("academy_video_likes").select("*").eq("video_id",t);if(D)throw D;return A},enabled:!!t}),{data:x=[]}=rr({queryKey:["academy-video-comments",t],queryFn:async()=>{const{data:A,error:D}=await ee.from("academy_video_comments").select("*").eq("video_id",t).order("created_at",{ascending:!1});if(D)throw D;const $=[...new Set(A.map(W=>W.user_id))],{data:F}=await ee.from("profiles").select("id, name").in("id",$),q=new Map((F==null?void 0:F.map(W=>[W.id,W.name]))||[]);return A.map(W=>({...W,user_name:q.get(W.user_id)||"Unknown User"}))},enabled:!!t}),v=dr({mutationFn:async A=>{const{error:D}=await ee.from("academy_video_comments").insert({video_id:t,user_id:e.id,content:A});if(D)throw D},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),c(""),n({title:"Comment added!"})},onError:A=>{n({title:"Error adding comment",description:A.message,variant:"destructive"})}}),w=dr({mutationFn:async A=>{const{error:D}=await ee.from("academy_video_comments").delete().eq("id",A);if(D)throw D},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),n({title:"Comment deleted"})}}),k=dr({mutationFn:async()=>{const A=m.find(D=>D.user_id===(e==null?void 0:e.id));if(A){const{error:D}=await ee.from("academy_video_likes").delete().eq("id",A.id);if(D)throw D}else{const{error:D}=await ee.from("academy_video_likes").insert({video_id:t,user_id:e.id});if(D)throw D}},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-likes",t]})}}),C=m.some(A=>A.user_id===(e==null?void 0:e.id)),S=A=>{switch(A==null?void 0:A.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},T=A=>A.split(" ").map(D=>D[0]).join("").toUpperCase().slice(0,2),I=A=>{A.preventDefault(),!(!o.trim()||!e)&&v.mutate(o.trim())};return h?r.jsx(Dr,{title:"Academy",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Dr,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(io,{to:"/academy",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Academy"]})}),r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(a.video_type)?r.jsx("iframe",{src:mpt(a.video_url,a.video_type),loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,height:"100%",width:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[r.jsx(Wi,{className:"h-16 w-16 opacity-50"}),r.jsx(te,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx($s,{className:"h-4 w-4"}),"Open Video"]})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title}),a.category&&r.jsx(Ft,{variant:"secondary",children:a.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(o5,{resourceType:"academy_video",resourceId:a.id,resourceTitle:a.title}),r.jsxs(te,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>k.mutate(),disabled:!e||k.isPending,children:[r.jsx(Ad,{className:`h-4 w-4 ${C?"fill-current":""}`}),m.length," ",m.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.resources&&a.resources.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Si,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:a.resources.map(A=>r.jsxs("a",{href:A.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted transition-colors",children:[r.jsx("span",{className:"text-2xl",children:S(A.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:A.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:A.file_type})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),r.jsx(Gd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Wl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:I,className:"flex gap-2",children:[r.jsx(gs,{placeholder:"Add a comment...",value:o,onChange:A=>c(A.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||v.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(A=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Di,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Ri,{className:"text-sm",children:T(A.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:A.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Qd(new Date(A.created_at),{addSuffix:!0})}),A.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(A.id),children:r.jsx(es,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content})]})]})})},A.id))})]})]})}):r.jsx(Dr,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Wi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(io,{to:"/academy",children:"Back to Academy"})})]})})};function xpt(){const t=ts(),[e,n]=P.useState(""),{data:s,isLoading:i}=rr({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(C)throw C;return k}}),{data:o}=rr({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(C)throw C;return k}}),{data:c}=rr({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kit_likes").select("kit_id");if(C)throw C;return k}}),{data:a}=rr({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:k,error:C}=await ee.from("resource_kit_comments").select("kit_id");if(C)throw C;return k}}),h=s==null?void 0:s.filter(k=>{var C;return k.name.toLowerCase().includes(e.toLowerCase())||((C=k.description)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))}),m=k=>(o==null?void 0:o.filter(C=>C.kit_id===k))||[],x=k=>(c==null?void 0:c.filter(C=>C.kit_id===k).length)||0,v=k=>(a==null?void 0:a.filter(C=>C.kit_id===k).length)||0,w=k=>{t(`/toolbox/${k}`)};return r.jsx(Dr,{title:"Toolbox",description:"Download resource kits and tools to help grow your business",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Toolbox"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Download resource kits and tools to help grow your business"})]}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search resource kits...",value:e,onChange:k=>n(k.target.value),className:"pl-10"})]}),!i&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(h==null?void 0:h.length)||0," resource kit",(h==null?void 0:h.length)!==1?"s":""," available"]}),i?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((k,C)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Kr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Kr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Kr,{className:"h-4 w-full mb-4"}),r.jsx(Kr,{className:"h-4 w-2/3"})]})},C))}):(h==null?void 0:h.length)===0?r.jsxs(Ze,{className:"p-12 text-center",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),r.jsx("p",{className:"text-muted-foreground",children:e?"Try adjusting your search terms":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:h==null?void 0:h.map(k=>{const C=m(k.id).length,S=x(k.id),T=v(k.id);return r.jsxs(Ze,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>w(k.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:k.featured_image_url?r.jsx("img",{src:k.featured_image_url,alt:k.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(El,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:k.name}),k.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:jne(k.description)}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Si,{className:"h-4 w-4"}),C," file",C!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ad,{className:"h-3.5 w-3.5"}),S]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wl,{className:"h-3.5 w-3.5"}),T]})]})]})]})]},k.id)})})]})})}const ypt=()=>{const{kitId:t}=hd(),{user:e,isAdmin:n}=zr(),{toast:s}=ua(),i=Qr(),{trackEngagement:o}=xI(),[c,a]=P.useState(""),{data:h,isLoading:m}=rr({queryKey:["resource-kit-detail",t],queryFn:async()=>{const{data:D,error:$}=await ee.from("resource_kits").select("*").eq("id",t).eq("is_published",!0).single();if($)throw $;const{data:F}=await ee.from("resource_kit_files").select("*").eq("kit_id",t).order("sort_order"),{data:q}=await ee.from("resource_kit_links").select("*").eq("kit_id",t).order("sort_order");return{...D,files:F||[],links:q||[]}},enabled:!!t});P.useEffect(()=>{h&&o("toolbox",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=rr({queryKey:["resource-kit-likes",t],queryFn:async()=>{const{data:D,error:$}=await ee.from("resource_kit_likes").select("*").eq("kit_id",t);if($)throw $;return D},enabled:!!t}),{data:v=[]}=rr({queryKey:["resource-kit-comments",t],queryFn:async()=>{const{data:D,error:$}=await ee.from("resource_kit_comments").select("*").eq("kit_id",t).order("created_at",{ascending:!1});if($)throw $;const F=[...new Set(D.map(K=>K.user_id))],{data:q}=await ee.from("profiles").select("id, name").in("id",F),W=new Map((q==null?void 0:q.map(K=>[K.id,K.name]))||[]);return D.map(K=>({...K,user_name:W.get(K.user_id)||"Unknown User"}))},enabled:!!t}),w=dr({mutationFn:async D=>{const{error:$}=await ee.from("resource_kit_comments").insert({kit_id:t,user_id:e.id,content:D});if($)throw $},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",t]}),a(""),s({title:"Comment added!"})},onError:D=>{s({title:"Error adding comment",description:D.message,variant:"destructive"})}}),k=dr({mutationFn:async D=>{const{error:$}=await ee.from("resource_kit_comments").delete().eq("id",D);if($)throw $},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",t]}),s({title:"Comment deleted"})}}),C=dr({mutationFn:async()=>{const D=x.find($=>$.user_id===(e==null?void 0:e.id));if(D){const{error:$}=await ee.from("resource_kit_likes").delete().eq("id",D.id);if($)throw $}else{const{error:$}=await ee.from("resource_kit_likes").insert({kit_id:t,user_id:e.id});if($)throw $}},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-likes",t]})}}),S=x.some(D=>D.user_id===(e==null?void 0:e.id)),T=D=>D.split(" ").map($=>$[0]).join("").toUpperCase().slice(0,2),I=D=>D?D<1024?D+" B":D<1024*1024?(D/1024).toFixed(1)+" KB":(D/(1024*1024)).toFixed(1)+" MB":"",A=D=>{D.preventDefault(),!(!c.trim()||!e)&&w.mutate(c.trim())};return m?r.jsx(Dr,{title:"Toolbox",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Dr,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(io,{to:"/toolbox",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Toolbox"]})}),h.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:h.featured_image_url,alt:h.name,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(te,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(io,{to:`/admin/toolbox?edit=${h.id}`,children:[r.jsx(ya,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(o5,{resourceType:"resource_kit",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(te,{variant:S?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(Ad,{className:`h-4 w-4 ${S?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}})]}),h.files&&h.files.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Si,{className:"h-4 w-4"}),"Included Resources (",h.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.files.map(D=>r.jsxs("a",{href:D.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Si,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:D.name}),D.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:I(D.file_size)})]})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},D.id))})]})}),h.links&&h.links.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx($s,{className:"h-4 w-4"}),"Canva Templates (",h.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(D=>r.jsxs("a",{href:D.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:r.jsx($s,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:D.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},D.id))})]})}),r.jsx(Gd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Wl,{className:"h-5 w-5"}),"Comments (",v.length,")"]}),e?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(gs,{placeholder:"Add a comment...",value:c,onChange:D=>a(D.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!c.trim()||w.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:v.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):v.map(D=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Di,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Ri,{className:"text-sm",children:T(D.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:D.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Qd(new Date(D.created_at),{addSuffix:!0})}),D.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>k.mutate(D.id),children:r.jsx(es,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:D.content})]})]})})},D.id))})]})]})}):r.jsx(Dr,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(El,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(io,{to:"/toolbox",children:"Back to Toolbox"})})]})})},vpt=()=>{const t=ts(),[e,n]=P.useState(""),[s,i]=P.useState("grid"),{data:o=[],isLoading:c}=rr({queryKey:["social-swag"],queryFn:async()=>{const{data:m,error:x}=await ee.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:v,error:w}=await ee.from("social_swag_links").select("*").order("sort_order");if(w)throw w;const{data:k}=await ee.from("social_swag_likes").select("swag_id"),{data:C}=await ee.from("social_swag_comments").select("swag_id"),S=new Map;k==null||k.forEach(A=>{S.set(A.swag_id,(S.get(A.swag_id)||0)+1)});const T=new Map;return C==null||C.forEach(A=>{T.set(A.swag_id,(T.get(A.swag_id)||0)+1)}),(m||[]).map(A=>({...A,links:(v||[]).filter(D=>D.swag_id===A.id)||[],likesCount:S.get(A.id)||0,commentsCount:T.get(A.id)||0}))}}),a=o.filter(m=>{var v;return m.title.toLowerCase().includes(e.toLowerCase())||((v=m.description)==null?void 0:v.toLowerCase().includes(e.toLowerCase()))}),h=m=>{t(`/social-swag/${m}`)};return r.jsx(Dr,{title:"Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Social Swag"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse our collection of social media content and graphics"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search social swag...",value:e,onChange:m=>n(m.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(im,{className:"h-4 w-4"})}),r.jsx(te,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx($f,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," item",a.length!==1?"s":""," found"]}),c&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((m,x)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Kr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Kr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Kr,{className:"h-4 w-full mb-4"})]})},x))}),!c&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No items match your search":"No social swag available yet"}),e&&r.jsx(te,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!c&&a.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(m=>r.jsxs(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>h(m.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[m.preview_image_url?r.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"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),m.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(bo,{className:"h-3 w-3"}),m.links.length]})})]}),r.jsxs(et,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:m.title}),m.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:m.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ad,{className:"h-3.5 w-3.5"}),m.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wl,{className:"h-3.5 w-3.5"}),m.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),h(m.id)},children:[r.jsx($s,{className:"h-4 w-4"}),"View Details"]})]})]},m.id))})]})})};var ki=function(){return ki=Object.assign||function(e){for(var n,s=1,i=arguments.length;s1&&(h||!m),v=e>1&&(m||!h),w=function(){s&&o(s)},k=function(){i&&o(i)};return r.jsx(Qpt,{displayMonth:t.displayMonth,hideNext:x,hidePrevious:v,nextMonth:i,previousMonth:s,onPreviousClick:w,onNextClick:k})}function Jpt(t){var e,n=Zo(),s=n.classNames,i=n.disableNavigation,o=n.styles,c=n.captionLayout,a=n.components,h=(e=a==null?void 0:a.CaptionLabel)!==null&&e!==void 0?e:rDe,m;return i?m=r.jsx(h,{id:t.id,displayMonth:t.displayMonth}):c==="dropdown"?m=r.jsx(hke,{displayMonth:t.displayMonth,id:t.id}):c==="dropdown-buttons"?m=r.jsxs(r.Fragment,{children:[r.jsx(hke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),r.jsx(fke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):m=r.jsxs(r.Fragment,{children:[r.jsx(h,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(fke,{displayMonth:t.displayMonth,id:t.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:m})}function emt(t){var e=Zo(),n=e.footer,s=e.styles,i=e.classNames.tfoot;return n?r.jsx("tfoot",{className:i,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function tmt(t,e,n){for(var s=n?Xx(new Date):Xh(new Date,{locale:t,weekStartsOn:e}),i=[],o=0;o<7;o++){var c=zl(s,o);i.push(c)}return i}function rmt(){var t=Zo(),e=t.classNames,n=t.styles,s=t.showWeekNumber,i=t.locale,o=t.weekStartsOn,c=t.ISOWeek,a=t.formatters.formatWeekdayName,h=t.labels.labelWeekday,m=tmt(i,o,c);return r.jsxs("tr",{style:n.head_row,className:e.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:e.head_cell}),m.map(function(x,v){return r.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":h(x,{locale:i}),children:a(x,{locale:i})},v)})]})}function nmt(){var t,e=Zo(),n=e.classNames,s=e.styles,i=e.components,o=(t=i==null?void 0:i.HeadRow)!==null&&t!==void 0?t:rmt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function smt(t){var e=Zo(),n=e.locale,s=e.formatters.formatDay;return r.jsx(r.Fragment,{children:s(t.date,{locale:n})})}var fxe=P.createContext(void 0);function imt(t){if(!yI(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return r.jsx(fxe.Provider,{value:e,children:t.children})}return r.jsx(amt,{initialProps:t.initialProps,children:t.children})}function amt(t){var e=t.initialProps,n=t.children,s=e.selected,i=e.min,o=e.max,c=function(m,x,v){var w,k;(w=e.onDayClick)===null||w===void 0||w.call(e,m,x,v);var C=!!(x.selected&&i&&(s==null?void 0:s.length)===i);if(!C){var S=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!S){var T=s?eDe([],s):[];if(x.selected){var I=T.findIndex(function(A){return Hl(m,A)});T.splice(I,1)}else T.push(m);(k=e.onSelect)===null||k===void 0||k.call(e,T,m,x,v)}}},a={disabled:[]};s&&a.disabled.push(function(m){var x=o&&s.length>o-1,v=s.some(function(w){return Hl(w,m)});return!!(x&&!v)});var h={selected:s,onDayClick:c,modifiers:a};return r.jsx(fxe.Provider,{value:h,children:n})}function pxe(){var t=P.useContext(fxe);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function omt(t,e){var n=e||{},s=n.from,i=n.to;return s&&i?Hl(i,t)&&Hl(s,t)?void 0:Hl(i,t)?{from:i,to:void 0}:Hl(s,t)?void 0:cte(s,t)?{from:t,to:i}:{from:s,to:t}:i?cte(t,i)?{from:i,to:t}:{from:t,to:i}:s?ase(t,s)?{from:t,to:s}:{from:s,to:t}:{from:t,to:void 0}}var mxe=P.createContext(void 0);function lmt(t){if(!vI(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(mxe.Provider,{value:e,children:t.children})}return r.jsx(cmt,{initialProps:t.initialProps,children:t.children})}function cmt(t){var e=t.initialProps,n=t.children,s=e.selected,i=s||{},o=i.from,c=i.to,a=e.min,h=e.max,m=function(k,C,S){var T,I;(T=e.onDayClick)===null||T===void 0||T.call(e,k,C,S);var A=omt(k,s);(I=e.onSelect)===null||I===void 0||I.call(e,A,k,C,S)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],c?(x.range_end=[c],Hl(o,c)||(x.range_middle=[{after:o,before:c}])):x.range_end=[o]):c&&(x.range_start=[c],x.range_end=[c]),a&&(o&&!c&&x.disabled.push({after:Fle(o,a-1),before:zl(o,a-1)}),o&&c&&x.disabled.push({after:o,before:zl(o,a-1)}),!o&&c&&x.disabled.push({after:Fle(c,a-1),before:zl(c,a-1)})),h){if(o&&!c&&(x.disabled.push({before:zl(o,-h+1)}),x.disabled.push({after:zl(o,h-1)})),o&&c){var v=em(c,o)+1,w=h-v;x.disabled.push({before:Fle(o,w)}),x.disabled.push({after:zl(c,w)})}!o&&c&&(x.disabled.push({before:zl(c,-h+1)}),x.disabled.push({after:zl(c,h-1)}))}return r.jsx(mxe.Provider,{value:{selected:s,onDayClick:m,modifiers:x},children:n})}function gxe(){var t=P.useContext(mxe);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function nee(t){return Array.isArray(t)?eDe([],t):t!==void 0?[t]:[]}function dmt(t){var e={};return Object.entries(t).forEach(function(n){var s=n[0],i=n[1];e[s]=nee(i)}),e}var mm;(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"})(mm||(mm={}));var umt=mm.Selected,ix=mm.Disabled,hmt=mm.Hidden,fmt=mm.Today,Vle=mm.RangeEnd,Hle=mm.RangeMiddle,Wle=mm.RangeStart,pmt=mm.Outside;function mmt(t,e,n){var s,i=(s={},s[umt]=nee(t.selected),s[ix]=nee(t.disabled),s[hmt]=nee(t.hidden),s[fmt]=[t.today],s[Vle]=[],s[Hle]=[],s[Wle]=[],s[pmt]=[],s);return t.fromDate&&i[ix].push({before:t.fromDate}),t.toDate&&i[ix].push({after:t.toDate}),yI(t)?i[ix]=i[ix].concat(e.modifiers[ix]):vI(t)&&(i[ix]=i[ix].concat(n.modifiers[ix]),i[Wle]=n.modifiers[Wle],i[Hle]=n.modifiers[Hle],i[Vle]=n.modifiers[Vle]),i}var iDe=P.createContext(void 0);function gmt(t){var e=Zo(),n=pxe(),s=gxe(),i=mmt(e,n,s),o=dmt(e.modifiers),c=ki(ki({},i),o);return r.jsx(iDe.Provider,{value:c,children:t.children})}function aDe(){var t=P.useContext(iDe);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function xmt(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function ymt(t){return!!(t&&typeof t=="object"&&"from"in t)}function vmt(t){return!!(t&&typeof t=="object"&&"after"in t)}function _mt(t){return!!(t&&typeof t=="object"&&"before"in t)}function bmt(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function wmt(t,e){var n,s=e.from,i=e.to;if(s&&i){var o=em(i,s)<0;o&&(n=[i,s],s=n[0],i=n[1]);var c=em(t,s)>=0&&em(i,t)>=0;return c}return i?Hl(i,t):s?Hl(s,t):!1}function jmt(t){return Hge(t)}function kmt(t){return Array.isArray(t)&&t.every(Hge)}function Nmt(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(jmt(n))return Hl(t,n);if(kmt(n))return n.includes(t);if(ymt(n))return wmt(t,n);if(bmt(n))return n.dayOfWeek.includes(t.getDay());if(xmt(n)){var s=em(n.before,t),i=em(n.after,t),o=s>0,c=i<0,a=cte(n.before,n.after);return a?c&&o:o||c}return vmt(n)?em(t,n.after)>0:_mt(n)?em(n.before,t)>0:typeof n=="function"?n(t):!1})}function xxe(t,e,n){var s=Object.keys(e).reduce(function(o,c){var a=e[c];return Nmt(t,a)&&o.push(c),o},[]),i={};return s.forEach(function(o){return i[o]=!0}),n&&!Jge(t,n)&&(i.outside=!0),i}function Smt(t,e){for(var n=fh(t[0]),s=sse(t[t.length-1]),i,o,c=n;c<=s;){var a=xxe(c,e),h=!a.disabled&&!a.hidden;if(!h){c=zl(c,1);continue}if(a.selected)return c;a.today&&!o&&(o=c),i||(i=c),c=zl(c,1)}return o||i}var Cmt=365;function oDe(t,e){var n=e.moveBy,s=e.direction,i=e.context,o=e.modifiers,c=e.retry,a=c===void 0?{count:0,lastFocused:t}:c,h=i.weekStartsOn,m=i.fromDate,x=i.toDate,v=i.locale,w={day:zl,week:dhe,month:Yf,year:nlt,startOfWeek:function(T){return i.ISOWeek?Xx(T):Xh(T,{locale:v,weekStartsOn:h})},endOfWeek:function(T){return i.ISOWeek?YLe(T):Wge(T,{locale:v,weekStartsOn:h})}},k=w[n](t,s==="after"?1:-1);s==="before"&&m?k=slt([m,k]):s==="after"&&x&&(k=ilt([x,k]));var C=!0;if(o){var S=xxe(k,o);C=!S.disabled&&!S.hidden}return C?k:a.count>Cmt?a.lastFocused:oDe(k,{moveBy:n,direction:s,context:i,modifiers:o,retry:ki(ki({},a),{count:a.count+1})})}var lDe=P.createContext(void 0);function Mmt(t){var e=_I(),n=aDe(),s=P.useState(),i=s[0],o=s[1],c=P.useState(),a=c[0],h=c[1],m=Smt(e.displayMonths,n),x=i??(a&&e.isDateDisplayed(a))?a:m,v=function(){h(i),o(void 0)},w=function(T){o(T)},k=Zo(),C=function(T,I){if(i){var A=oDe(i,{moveBy:T,direction:I,context:k,modifiers:n});Hl(i,A)||(e.goToDate(A,i),w(A))}},S={focusedDay:i,focusTarget:x,blur:v,focus:w,focusDayAfter:function(){return C("day","after")},focusDayBefore:function(){return C("day","before")},focusWeekAfter:function(){return C("week","after")},focusWeekBefore:function(){return C("week","before")},focusMonthBefore:function(){return C("month","before")},focusMonthAfter:function(){return C("month","after")},focusYearBefore:function(){return C("year","before")},focusYearAfter:function(){return C("year","after")},focusStartOfWeek:function(){return C("startOfWeek","before")},focusEndOfWeek:function(){return C("endOfWeek","after")}};return r.jsx(lDe.Provider,{value:S,children:t.children})}function yxe(){var t=P.useContext(lDe);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function Tmt(t,e){var n=aDe(),s=xxe(t,n,e);return s}var vxe=P.createContext(void 0);function Amt(t){if(!yse(t.initialProps)){var e={selected:void 0};return r.jsx(vxe.Provider,{value:e,children:t.children})}return r.jsx(Emt,{initialProps:t.initialProps,children:t.children})}function Emt(t){var e=t.initialProps,n=t.children,s=function(o,c,a){var h,m,x;if((h=e.onDayClick)===null||h===void 0||h.call(e,o,c,a),c.selected&&!e.required){(m=e.onSelect)===null||m===void 0||m.call(e,void 0,o,c,a);return}(x=e.onSelect)===null||x===void 0||x.call(e,o,o,c,a)},i={selected:e.selected,onDayClick:s};return r.jsx(vxe.Provider,{value:i,children:n})}function cDe(){var t=P.useContext(vxe);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function Imt(t,e){var n=Zo(),s=cDe(),i=pxe(),o=gxe(),c=yxe(),a=c.focusDayAfter,h=c.focusDayBefore,m=c.focusWeekAfter,x=c.focusWeekBefore,v=c.blur,w=c.focus,k=c.focusMonthBefore,C=c.focusMonthAfter,S=c.focusYearBefore,T=c.focusYearAfter,I=c.focusStartOfWeek,A=c.focusEndOfWeek,D=function(me){var fe,ve,Ie,Se;yse(n)?(fe=s.onDayClick)===null||fe===void 0||fe.call(s,t,e,me):yI(n)?(ve=i.onDayClick)===null||ve===void 0||ve.call(i,t,e,me):vI(n)?(Ie=o.onDayClick)===null||Ie===void 0||Ie.call(o,t,e,me):(Se=n.onDayClick)===null||Se===void 0||Se.call(n,t,e,me)},$=function(me){var fe;w(t),(fe=n.onDayFocus)===null||fe===void 0||fe.call(n,t,e,me)},F=function(me){var fe;v(),(fe=n.onDayBlur)===null||fe===void 0||fe.call(n,t,e,me)},q=function(me){var fe;(fe=n.onDayMouseEnter)===null||fe===void 0||fe.call(n,t,e,me)},W=function(me){var fe;(fe=n.onDayMouseLeave)===null||fe===void 0||fe.call(n,t,e,me)},K=function(me){var fe;(fe=n.onDayPointerEnter)===null||fe===void 0||fe.call(n,t,e,me)},Z=function(me){var fe;(fe=n.onDayPointerLeave)===null||fe===void 0||fe.call(n,t,e,me)},re=function(me){var fe;(fe=n.onDayTouchCancel)===null||fe===void 0||fe.call(n,t,e,me)},he=function(me){var fe;(fe=n.onDayTouchEnd)===null||fe===void 0||fe.call(n,t,e,me)},ue=function(me){var fe;(fe=n.onDayTouchMove)===null||fe===void 0||fe.call(n,t,e,me)},je=function(me){var fe;(fe=n.onDayTouchStart)===null||fe===void 0||fe.call(n,t,e,me)},ne=function(me){var fe;(fe=n.onDayKeyUp)===null||fe===void 0||fe.call(n,t,e,me)},ye=function(me){var fe;switch(me.key){case"ArrowLeft":me.preventDefault(),me.stopPropagation(),n.dir==="rtl"?a():h();break;case"ArrowRight":me.preventDefault(),me.stopPropagation(),n.dir==="rtl"?h():a();break;case"ArrowDown":me.preventDefault(),me.stopPropagation(),m();break;case"ArrowUp":me.preventDefault(),me.stopPropagation(),x();break;case"PageUp":me.preventDefault(),me.stopPropagation(),me.shiftKey?S():k();break;case"PageDown":me.preventDefault(),me.stopPropagation(),me.shiftKey?T():C();break;case"Home":me.preventDefault(),me.stopPropagation(),I();break;case"End":me.preventDefault(),me.stopPropagation(),A();break}(fe=n.onDayKeyDown)===null||fe===void 0||fe.call(n,t,e,me)},ie={onClick:D,onFocus:$,onBlur:F,onKeyDown:ye,onKeyUp:ne,onMouseEnter:q,onMouseLeave:W,onPointerEnter:K,onPointerLeave:Z,onTouchCancel:re,onTouchEnd:he,onTouchMove:ue,onTouchStart:je};return ie}function Pmt(){var t=Zo(),e=cDe(),n=pxe(),s=gxe(),i=yse(t)?e.selected:yI(t)?n.selected:vI(t)?s.selected:void 0;return i}function Lmt(t){return Object.values(mm).includes(t)}function Omt(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(s){var i=t.modifiersClassNames[s];if(i)n.push(i);else if(Lmt(s)){var o=t.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Dmt(t,e){var n=ki({},t.styles.day);return Object.keys(e).forEach(function(s){var i;n=ki(ki({},n),(i=t.modifiersStyles)===null||i===void 0?void 0:i[s])}),n}function Rmt(t,e,n){var s,i,o,c=Zo(),a=yxe(),h=Tmt(t,e),m=Imt(t,h),x=Pmt(),v=!!(c.onDayClick||c.mode!=="default");P.useEffect(function(){var q;h.outside||a.focusedDay&&v&&Hl(a.focusedDay,t)&&((q=n.current)===null||q===void 0||q.focus())},[a.focusedDay,t,n,v,h.outside]);var w=Omt(c,h).join(" "),k=Dmt(c,h),C=!!(h.outside&&!c.showOutsideDays||h.hidden),S=(o=(i=c.components)===null||i===void 0?void 0:i.DayContent)!==null&&o!==void 0?o:smt,T=r.jsx(S,{date:t,displayMonth:e,activeModifiers:h}),I={style:k,className:w,children:T,role:"gridcell"},A=a.focusTarget&&Hl(a.focusTarget,t)&&!h.outside,D=a.focusedDay&&Hl(a.focusedDay,t),$=ki(ki(ki({},I),(s={disabled:h.disabled,role:"gridcell"},s["aria-selected"]=h.selected,s.tabIndex=D||A?0:-1,s)),m),F={isButton:v,isHidden:C,activeModifiers:h,selectedDays:x,buttonProps:$,divProps:I};return F}function Fmt(t){var e=P.useRef(null),n=Rmt(t.date,t.displayMonth,e);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(mte,ki({name:"day",ref:e},n.buttonProps)):r.jsx("div",ki({},n.divProps))}function zmt(t){var e=t.number,n=t.dates,s=Zo(),i=s.onWeekNumberClick,o=s.styles,c=s.classNames,a=s.locale,h=s.labels.labelWeekNumber,m=s.formatters.formatWeekNumber,x=m(Number(e),{locale:a});if(!i)return r.jsx("span",{className:c.weeknumber,style:o.weeknumber,children:x});var v=h(Number(e),{locale:a}),w=function(k){i(e,n,k)};return r.jsx(mte,{name:"week-number","aria-label":v,className:c.weeknumber,style:o.weeknumber,onClick:w,children:x})}function Bmt(t){var e,n,s=Zo(),i=s.styles,o=s.classNames,c=s.showWeekNumber,a=s.components,h=(e=a==null?void 0:a.Day)!==null&&e!==void 0?e:Fmt,m=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:zmt,x;return c&&(x=r.jsx("td",{className:o.cell,style:i.cell,children:r.jsx(m,{number:t.weekNumber,dates:t.dates})})),r.jsxs("tr",{className:o.row,style:i.row,children:[x,t.dates.map(function(v){return r.jsx("td",{className:o.cell,style:i.cell,role:"presentation",children:r.jsx(h,{displayMonth:t.displayMonth,date:v})},cct(v))})]})}function pke(t,e,n){for(var s=n!=null&&n.ISOWeek?YLe(e):Wge(e,n),i=n!=null&&n.ISOWeek?Xx(t):Xh(t,n),o=em(s,i),c=[],a=0;a<=o;a++)c.push(zl(i,a));var h=c.reduce(function(m,x){var v=n!=null&&n.ISOWeek?Gge(x):Zge(x,n),w=m.find(function(k){return k.weekNumber===v});return w?(w.dates.push(x),m):(m.push({weekNumber:v,dates:[x]}),m)},[]);return h}function $mt(t,e){var n=pke(fh(t),sse(t),e);if(e!=null&&e.useFixedWeeks){var s=uct(t,e);if(s<6){var i=n[n.length-1],o=i.dates[i.dates.length-1],c=dhe(o,6-s),a=pke(dhe(o,1),c,e);n.push.apply(n,a)}}return n}function Umt(t){var e,n,s,i=Zo(),o=i.locale,c=i.classNames,a=i.styles,h=i.hideHead,m=i.fixedWeeks,x=i.components,v=i.weekStartsOn,w=i.firstWeekContainsDate,k=i.ISOWeek,C=$mt(t.displayMonth,{useFixedWeeks:!!m,ISOWeek:k,locale:o,weekStartsOn:v,firstWeekContainsDate:w}),S=(e=x==null?void 0:x.Head)!==null&&e!==void 0?e:nmt,T=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Bmt,I=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:emt;return r.jsxs("table",{id:t.id,className:c.table,style:a.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!h&&r.jsx(S,{}),r.jsx("tbody",{className:c.tbody,style:a.tbody,children:C.map(function(A){return r.jsx(T,{displayMonth:t.displayMonth,dates:A.dates,weekNumber:A.weekNumber},A.weekNumber)})}),r.jsx(I,{displayMonth:t.displayMonth})]})}function qmt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Vmt=qmt()?P.useLayoutEffect:P.useEffect,Gle=!1,Hmt=0;function mke(){return"react-day-picker-".concat(++Hmt)}function Wmt(t){var e,n=t??(Gle?mke():null),s=P.useState(n),i=s[0],o=s[1];return Vmt(function(){i===null&&o(mke())},[]),P.useEffect(function(){Gle===!1&&(Gle=!0)},[]),(e=t??i)!==null&&e!==void 0?e:void 0}function Gmt(t){var e,n,s=Zo(),i=s.dir,o=s.classNames,c=s.styles,a=s.components,h=_I().displayMonths,m=Wmt(s.id?"".concat(s.id,"-").concat(t.displayIndex):void 0),x=s.id?"".concat(s.id,"-grid-").concat(t.displayIndex):void 0,v=[o.month],w=c.month,k=t.displayIndex===0,C=t.displayIndex===h.length-1,S=!k&&!C;i==="rtl"&&(e=[k,C],C=e[0],k=e[1]),k&&(v.push(o.caption_start),w=ki(ki({},w),c.caption_start)),C&&(v.push(o.caption_end),w=ki(ki({},w),c.caption_end)),S&&(v.push(o.caption_between),w=ki(ki({},w),c.caption_between));var T=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:Jpt;return r.jsxs("div",{className:v.join(" "),style:w,children:[r.jsx(T,{id:m,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(Umt,{id:x,"aria-labelledby":m,displayMonth:t.displayMonth})]},t.displayIndex)}function Kmt(t){var e=Zo(),n=e.classNames,s=e.styles;return r.jsx("div",{className:n.months,style:s.months,children:t.children})}function Zmt(t){var e,n,s=t.initialProps,i=Zo(),o=yxe(),c=_I(),a=P.useState(!1),h=a[0],m=a[1];P.useEffect(function(){i.initialFocus&&o.focusTarget&&(h||(o.focus(o.focusTarget),m(!0)))},[i.initialFocus,h,o.focus,o.focusTarget,o]);var x=[i.classNames.root,i.className];i.numberOfMonths>1&&x.push(i.classNames.multiple_months),i.showWeekNumber&&x.push(i.classNames.with_weeknumber);var v=ki(ki({},i.styles.root),i.style),w=Object.keys(s).filter(function(C){return C.startsWith("data-")}).reduce(function(C,S){var T;return ki(ki({},C),(T={},T[S]=s[S],T))},{}),k=(n=(e=s.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:Kmt;return r.jsx("div",ki({className:x.join(" "),style:v,dir:i.dir,id:i.id,nonce:s.nonce,title:s.title,lang:s.lang},w,{children:r.jsx(k,{children:c.displayMonths.map(function(C,S){return r.jsx(Gmt,{displayIndex:S,displayMonth:C},S)})})}))}function Ymt(t){var e=t.children,n=_pt(t,["children"]);return r.jsx(zpt,{initialProps:n,children:r.jsx(Zpt,{children:r.jsx(Amt,{initialProps:n,children:r.jsx(imt,{initialProps:n,children:r.jsx(lmt,{initialProps:n,children:r.jsx(gmt,{children:r.jsx(Mmt,{children:e})})})})})})})}function Xmt(t){return r.jsx(Ymt,ki({},t,{children:r.jsx(Zmt,{initialProps:t})}))}function Lj({className:t,classNames:e,showOutsideDays:n=!0,...s}){return r.jsx(Xmt,{showOutsideDays:n,className:$t("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:$t(UA({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:$t(UA({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...i})=>r.jsx(id,{className:"h-4 w-4"}),IconRight:({...i})=>r.jsx(Ka,{className:"h-4 w-4"})},...s})}Lj.displayName="Calendar";var vse="Popover",[dDe]=Zl(vse,[Cg]),bI=Cg(),[Qmt,q1]=dDe(vse),uDe=t=>{const{__scopePopover:e,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:c=!1}=t,a=bI(e),h=P.useRef(null),[m,x]=P.useState(!1),[v,w]=Eu({prop:s,defaultProp:i??!1,onChange:o,caller:vse});return r.jsx(tI,{...a,children:r.jsx(Qmt,{scope:e,contentId:zc(),triggerRef:h,open:v,onOpenChange:w,onOpenToggle:P.useCallback(()=>w(k=>!k),[w]),hasCustomAnchor:m,onCustomAnchorAdd:P.useCallback(()=>x(!0),[]),onCustomAnchorRemove:P.useCallback(()=>x(!1),[]),modal:c,children:n})})};uDe.displayName=vse;var hDe="PopoverAnchor",Jmt=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=q1(hDe,n),o=bI(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:a}=i;return P.useEffect(()=>(c(),()=>a()),[c,a]),r.jsx(KC,{...o,...s,ref:e})});Jmt.displayName=hDe;var fDe="PopoverTrigger",pDe=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=q1(fDe,n),o=bI(n),c=Xs(e,i.triggerRef),a=r.jsx(Dn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vDe(i.open),...s,ref:c,onClick:an(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:r.jsx(KC,{asChild:!0,...o,children:a})});pDe.displayName=fDe;var _xe="PopoverPortal",[egt,tgt]=dDe(_xe,{forceMount:void 0}),mDe=t=>{const{__scopePopover:e,forceMount:n,children:s,container:i}=t,o=q1(_xe,e);return r.jsx(egt,{scope:e,forceMount:n,children:r.jsx(lc,{present:n||o.open,children:r.jsx(qC,{asChild:!0,container:i,children:s})})})};mDe.displayName=_xe;var dC="PopoverContent",gDe=P.forwardRef((t,e)=>{const n=tgt(dC,t.__scopePopover),{forceMount:s=n.forceMount,...i}=t,o=q1(dC,t.__scopePopover);return r.jsx(lc,{present:s||o.open,children:o.modal?r.jsx(ngt,{...i,ref:e}):r.jsx(sgt,{...i,ref:e})})});gDe.displayName=dC;var rgt=N1("PopoverContent.RemoveScroll"),ngt=P.forwardRef((t,e)=>{const n=q1(dC,t.__scopePopover),s=P.useRef(null),i=Xs(e,s),o=P.useRef(!1);return P.useEffect(()=>{const c=s.current;if(c)return One(c)},[]),r.jsx(oI,{as:rgt,allowPinchZoom:!0,children:r.jsx(xDe,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:an(t.onCloseAutoFocus,c=>{var a;c.preventDefault(),o.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:an(t.onPointerDownOutside,c=>{const a=c.detail.originalEvent,h=a.button===0&&a.ctrlKey===!0,m=a.button===2||h;o.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:an(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),sgt=P.forwardRef((t,e)=>{const n=q1(dC,t.__scopePopover),s=P.useRef(!1),i=P.useRef(!1);return r.jsx(xDe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,a;(c=t.onCloseAutoFocus)==null||c.call(t,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var h,m;(h=t.onInteractOutside)==null||h.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),xDe=P.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEscapeKeyDown:a,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:x,...v}=t,w=q1(dC,n),k=bI(n);return Pne(),r.jsx(aI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(D1,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:x,onEscapeKeyDown:a,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>w.onOpenChange(!1),children:r.jsx(rI,{"data-state":vDe(w.open),role:"dialog",id:w.contentId,...k,...v,ref:e,style:{...v.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)"}})})})}),yDe="PopoverClose",igt=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=q1(yDe,n);return r.jsx(Dn.button,{type:"button",...s,ref:e,onClick:an(t.onClick,()=>i.onOpenChange(!1))})});igt.displayName=yDe;var agt="PopoverArrow",ogt=P.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,i=bI(n);return r.jsx(nI,{...i,...s,ref:e})});ogt.displayName=agt;function vDe(t){return t?"open":"closed"}var lgt=uDe,cgt=pDe,dgt=mDe,_De=gDe;const Jh=lgt,ef=cgt,gh=P.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},i)=>r.jsx(dgt,{children:r.jsx(_De,{ref:i,align:e,sideOffset:n,className:$t("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));gh.displayName=_De.displayName;const ugt=VC("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"}}),bxe=P.forwardRef(({className:t,variant:e,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:$t(ugt({variant:e}),t),...n}));bxe.displayName="Alert";const hgt=P.forwardRef(({className:t,...e},n)=>r.jsx("h5",{ref:n,className:$t("mb-1 font-medium leading-none tracking-tight",t),...e}));hgt.displayName="AlertTitle";const wxe=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("text-sm [&_p]:leading-relaxed",t),...e}));wxe.displayName="AlertDescription";function fgt({open:t,onOpenChange:e,imageUrl:n,imageId:s,defaultCaption:i="",swagItemId:o,reelId:c}){const a=Qr(),[h,m]=P.useState(i),[x,v]=P.useState([]),[w,k]=P.useState(null),[C,S]=P.useState("now"),[T,I]=P.useState(che(Vje(new Date),1)),[A,D]=P.useState("12"),[$,F]=P.useState("00"),[q,W]=P.useState("PM");P.useEffect(()=>{if(t){m(i),S("now"),v([]);const ae=che(Vje(new Date),1);I(ae);const Ne=ae.getHours();D(String(Ne>12?Ne-12:Ne===0?12:Ne)),F("00"),W(Ne>=12?"PM":"AM")}},[t,i]);const K=()=>{if(!T)return null;let ae=parseInt(A);const Ne=parseInt($);return q==="PM"&&ae!==12&&(ae+=12),q==="AM"&&ae===12&&(ae=0),iOe(sOe(T,ae),Ne)},{data:Z,isLoading:re}=rr({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ae}}=await ee.auth.getUser();if(!ae)return[];const{data:Ne,error:Te}=await ee.from("social_accounts").select("*").eq("user_id",ae.id).eq("is_active",!0).order("platform",{ascending:!0});if(Te)throw Te;return console.log("Fetched social accounts for posting:",Ne),Ne},enabled:t,staleTime:0}),he=dr({mutationFn:async({accountId:ae,platform:Ne})=>{k(ae);const{data:Te,error:Be}=await ee.functions.invoke("social-post",{body:{platform:Ne,accountId:ae,imageUrl:n,caption:h}});if(Be)throw Be;if(Te!=null&&Te.error)throw new Error(Te.error);return Te},onSuccess:ae=>{const Ne=ae.platform==="facebook"?"Facebook":ae.platform==="instagram"?"Instagram":ae.platform==="linkedin"?"LinkedIn":"Google Business";He.success(`Posted to ${Ne}!`)},onError:ae=>{He.error(`Failed to post: ${ae.message}`)},onSettled:()=>{k(null)}}),ue=dr({mutationFn:async({accountId:ae,platform:Ne,scheduledFor:Te})=>{const{data:{user:Be}}=await ee.auth.getUser();if(!Be)throw new Error("Not authenticated");const{error:Le}=await ee.from("scheduled_posts").insert({user_id:Be.id,social_account_id:ae,platform:Ne,image_url:n,caption:h,swag_item_id:o||null,reel_id:c||null,scheduled_for:Te.toISOString(),status:"scheduled"});if(Le)throw Le;return{platform:Ne}},onSuccess:ae=>{const Ne=ae.platform==="facebook"?"Facebook":ae.platform==="instagram"?"Instagram":"LinkedIn";He.success(`Post scheduled for ${Ne}!`)},onError:ae=>{He.error(`Failed to schedule: ${ae.message}`)}}),je=async()=>{if(x.length===0){He.error("Please select at least one account");return}if(C==="schedule"){const ae=K();if(!ae||ae<=new Date){He.error("Please select a future date and time");return}for(const Ne of x){const Te=Z==null?void 0:Z.find(Be=>Be.id===Ne);Te&&await ue.mutateAsync({accountId:Ne,platform:Te.platform,scheduledFor:ae})}a.invalidateQueries({queryKey:["scheduled-posts"]}),He.success(`${x.length} post(s) scheduled for ${un(ae,"PPp")}`)}else for(const ae of x){const Ne=Z==null?void 0:Z.find(Te=>Te.id===ae);Ne&&await he.mutateAsync({accountId:ae,platform:Ne.platform})}a.invalidateQueries({queryKey:["scheduled-posts"]}),m(""),v([]),e(!1)},ne=ae=>{v(Ne=>Ne.includes(ae)?Ne.filter(Te=>Te!==ae):[...Ne,ae])},ye=(Z==null?void 0:Z.filter(ae=>ae.platform==="facebook"))||[],ie=(Z==null?void 0:Z.filter(ae=>ae.platform==="instagram"))||[],me=(Z==null?void 0:Z.filter(ae=>ae.platform==="linkedin"))||[],fe=(Z==null?void 0:Z.filter(ae=>ae.platform==="google_business"))||[],ve=((Z==null?void 0:Z.length)||0)>0,Ie=he.isPending||ue.isPending,Se=Array.from({length:12},(ae,Ne)=>String(Ne+1)),oe=["00","15","30","45"];return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Create Social Post"}),r.jsx(us,{children:"Share this image to your connected social accounts"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:n,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"caption",children:"Caption"}),r.jsx(gs,{id:"caption",placeholder:"Write a caption for your post...",value:h,onChange:ae=>m(ae.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Publish Time"}),r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[r.jsx("button",{type:"button",onClick:()=>S("now"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",C==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),r.jsx("button",{type:"button",onClick:()=>S("schedule"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",C==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),C==="schedule"&&r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Gi,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!T&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),T?un(T,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(gh,{className:"w-auto p-0",align:"start",children:r.jsx(Lj,{mode:"single",selected:T,onSelect:I,disabled:ae=>aer.jsx(tr,{value:ae,children:ae},ae))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(_n,{value:$,onValueChange:F,children:[r.jsx(yn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:oe.map(ae=>r.jsx(tr,{value:ae,children:ae},ae))})]}),r.jsxs(_n,{value:q,onValueChange:ae=>W(ae),children:[r.jsx(yn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"AM",children:"AM"}),r.jsx(tr,{value:"PM",children:"PM"})]})]})]})]}),T&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",un(K()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Post to"}),re&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(sn,{className:"h-6 w-6 animate-spin"})}),!re&&!ve&&r.jsxs(bxe,{children:[r.jsx(Ul,{className:"h-4 w-4"}),r.jsxs(wxe,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(io,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(od,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),ye.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Td,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),ye.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(vc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(Di,{className:"h-8 w-8",children:[r.jsx(Po,{src:ae.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(Td,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.page_name||ae.platform_username}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),ie.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Zd,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),ie.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(vc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(Di,{className:"h-8 w-8",children:[r.jsx(Po,{src:ae.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(Zd,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",ae.platform_username]}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),me.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(am,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),me.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(vc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(Di,{className:"h-8 w-8",children:[r.jsx(Po,{src:ae.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(am,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.platform_username}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(cl,{className:"h-4 w-4 text-red-600"})," Google Business"]}),fe.map(ae=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(vc,{checked:x.includes(ae.id),onCheckedChange:()=>ne(ae.id),disabled:w===ae.id}),r.jsxs(Di,{className:"h-8 w-8",children:[r.jsx(Po,{src:ae.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(cl,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ae.page_name||ae.platform_username}),w===ae.id&&r.jsx(sn,{className:"h-4 w-4 animate-spin"})]},ae.id))]})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{onClick:je,disabled:x.length===0||Ie,className:"gap-2",children:[Ie?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):C==="schedule"?r.jsx(li,{className:"h-4 w-4"}):r.jsx(To,{className:"h-4 w-4"}),C==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}var bDe="AlertDialog",[pgt]=Zl(bDe,[WIe]),sy=WIe(),wDe=t=>{const{__scopeAlertDialog:e,...n}=t,s=sy(e);return r.jsx(Rne,{...s,...n,modal:!0})};wDe.displayName=bDe;var mgt="AlertDialogTrigger",jDe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=sy(n);return r.jsx(fge,{...i,...s,ref:e})});jDe.displayName=mgt;var ggt="AlertDialogPortal",kDe=t=>{const{__scopeAlertDialog:e,...n}=t,s=sy(e);return r.jsx(Fne,{...s,...n})};kDe.displayName=ggt;var xgt="AlertDialogOverlay",NDe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=sy(n);return r.jsx(t5,{...i,...s,ref:e})});NDe.displayName=xgt;var j4="AlertDialogContent",[ygt,vgt]=pgt(j4),_gt=FTe("AlertDialogContent"),SDe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:s,...i}=t,o=sy(n),c=P.useRef(null),a=Xs(e,c),h=P.useRef(null);return r.jsx(Pnt,{contentName:j4,titleName:CDe,docsSlug:"alert-dialog",children:r.jsx(ygt,{scope:n,cancelRef:h,children:r.jsxs(r5,{role:"alertdialog",...o,...i,ref:a,onOpenAutoFocus:an(i.onOpenAutoFocus,m=>{var x;m.preventDefault(),(x=h.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(_gt,{children:s}),r.jsx(wgt,{contentRef:c})]})})})});SDe.displayName=j4;var CDe="AlertDialogTitle",MDe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=sy(n);return r.jsx(lI,{...i,...s,ref:e})});MDe.displayName=CDe;var TDe="AlertDialogDescription",ADe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=sy(n);return r.jsx(cI,{...i,...s,ref:e})});ADe.displayName=TDe;var bgt="AlertDialogAction",EDe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,i=sy(n);return r.jsx(zne,{...i,...s,ref:e})});EDe.displayName=bgt;var IDe="AlertDialogCancel",PDe=P.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,{cancelRef:i}=vgt(IDe,n),o=sy(n),c=Xs(e,i);return r.jsx(zne,{...o,...s,ref:c})});PDe.displayName=IDe;var wgt=({contentRef:t})=>{const e=`\`${j4}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${j4}\` by passing a \`${TDe}\` 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 \`${j4}\`. 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 P.useEffect(()=>{var s;document.getElementById((s=t.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},jgt=wDe,kgt=jDe,Ngt=kDe,LDe=NDe,ODe=SDe,DDe=EDe,RDe=PDe,FDe=MDe,zDe=ADe;const oh=jgt,O0=kgt,Sgt=Ngt,BDe=P.forwardRef(({className:t,...e},n)=>r.jsx(LDe,{className:$t("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));BDe.displayName=LDe.displayName;const vu=P.forwardRef(({className:t,...e},n)=>r.jsxs(Sgt,{children:[r.jsx(BDe,{}),r.jsx(ODe,{ref:n,className:$t("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));vu.displayName=ODe.displayName;const _u=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",t),...e});_u.displayName="AlertDialogHeader";const bu=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});bu.displayName="AlertDialogFooter";const wu=P.forwardRef(({className:t,...e},n)=>r.jsx(FDe,{ref:n,className:$t("text-lg font-semibold",t),...e}));wu.displayName=FDe.displayName;const ju=P.forwardRef(({className:t,...e},n)=>r.jsx(zDe,{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));ju.displayName=zDe.displayName;const Kd=P.forwardRef(({className:t,...e},n)=>r.jsx(DDe,{ref:n,className:$t(UA(),t),...e}));Kd.displayName=DDe.displayName;const ku=P.forwardRef(({className:t,...e},n)=>r.jsx(RDe,{ref:n,className:$t(UA({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));ku.displayName=RDe.displayName;function Cgt(){const t=Qr(),[e,n]=P.useState(void 0),[s,i]=P.useState("all"),[o,c]=P.useState(null),[a,h]=P.useState(""),[m,x]=P.useState(void 0),[v,w]=P.useState("12"),[k,C]=P.useState("00"),[S,T]=P.useState("PM"),{data:I=[],isLoading:A}=rr({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:fe,error:ve}=await ee.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(ve)throw ve;return fe}}),D=I.filter(fe=>{if(s!=="all"&&fe.status!==s)return!1;if(e&&fe.scheduled_for){const ve=new Date(fe.scheduled_for);if(!Hl(ve,e))return!1}return!0}),$=I.filter(fe=>fe.scheduled_for).map(fe=>Qh(new Date(fe.scheduled_for))),F=dr({mutationFn:async fe=>{const{error:ve}=await ee.from("scheduled_posts").update({caption:fe.caption,scheduled_for:fe.scheduled_for}).eq("id",fe.id);if(ve)throw ve},onSuccess:()=>{He.success("Post updated!"),t.invalidateQueries({queryKey:["scheduled-posts"]}),c(null)},onError:fe=>{He.error(`Failed to update: ${fe.message}`)}}),q=dr({mutationFn:async fe=>{const{error:ve}=await ee.from("scheduled_posts").update({status:"cancelled"}).eq("id",fe);if(ve)throw ve},onSuccess:()=>{He.success("Post cancelled"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:fe=>{He.error(`Failed to cancel: ${fe.message}`)}}),W=dr({mutationFn:async fe=>{const{error:ve}=await ee.from("scheduled_posts").delete().eq("id",fe);if(ve)throw ve},onSuccess:()=>{He.success("Post deleted"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:fe=>{He.error(`Failed to delete: ${fe.message}`)}}),K=dr({mutationFn:async fe=>{const{data:ve,error:Ie}=await ee.functions.invoke("social-post",{body:{platform:fe.platform,accountId:fe.social_account_id,imageUrl:fe.image_url,caption:fe.caption}});if(Ie)throw Ie;if(ve!=null&&ve.error)throw new Error(ve.error);return await ee.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:ve.postId}).eq("id",fe.id),ve},onSuccess:fe=>{const ve=fe.platform==="facebook"?"Facebook":fe.platform==="instagram"?"Instagram":"LinkedIn";He.success(`Posted to ${ve}!`),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:fe=>{He.error(`Failed to post: ${fe.message}`)}}),Z=fe=>{if(c(fe),h(fe.caption||""),fe.scheduled_for){const ve=new Date(fe.scheduled_for);x(ve);const Ie=ve.getHours();w(String(Ie>12?Ie-12:Ie===0?12:Ie)),C(String(ve.getMinutes()).padStart(2,"0")),T(Ie>=12?"PM":"AM")}},re=()=>{if(!o||!m)return;let fe=parseInt(v);const ve=parseInt(k);S==="PM"&&fe!==12&&(fe+=12),S==="AM"&&fe===12&&(fe=0);const Ie=iOe(sOe(m,fe),ve);F.mutate({id:o.id,caption:a,scheduled_for:Ie.toISOString()})},he=fe=>{switch(fe){case"facebook":return r.jsx(Td,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(Zd,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(am,{className:"h-4 w-4 text-blue-700"});default:return null}},ue=fe=>{switch(fe){case"scheduled":return r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Gi,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Ft,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(Ba,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Ft,{variant:"destructive",className:"gap-1",children:[r.jsx(Oc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Ft,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(Ul,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Ft,{variant:"outline",children:fe})}},je=Array.from({length:12},(fe,ve)=>String(ve+1)),ne=["00","15","30","45"],ye=I.filter(fe=>fe.status==="scheduled").length,ie=I.filter(fe=>fe.status==="posted").length,me=I.filter(fe=>fe.status==="scheduled"&&fe.scheduled_for&&hct(new Date(fe.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ye}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:me}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ie}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:I.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs(Ze,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(sm,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Lj,{mode:"single",selected:e,onSelect:n,className:$t("pointer-events-auto"),modifiers:{hasPost:$},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),e&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Jw,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(fe=>r.jsx(te,{variant:s===fe?"default":"outline",size:"sm",onClick:()=>i(fe),className:"capitalize",children:fe},fe))})]}),A&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!A&&D.length===0&&r.jsxs(Ze,{className:"p-8 text-center",children:[r.jsx(li,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("h3",{className:"font-medium mb-2",children:"No posts found"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e?`No posts scheduled for ${un(e,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:D.map(fe=>{var ve,Ie;return r.jsx(Ze,{className:"overflow-hidden",children:r.jsxs("div",{className:"flex flex-col sm:flex-row",children:[r.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:r.jsx("img",{src:fe.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(et,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[he(fe.platform),r.jsx("span",{className:"font-medium",children:((ve=fe.social_accounts)==null?void 0:ve.page_name)||((Ie=fe.social_accounts)==null?void 0:Ie.platform_username)||"Unknown"}),ue(fe.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[fe.status==="scheduled"&&r.jsxs(sI,{children:[r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Z(fe),children:r.jsx(ya,{className:"h-4 w-4"})})}),r.jsx(dm,{children:"Edit post"})]}),r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>K.mutate(fe),disabled:K.isPending,children:K.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(To,{className:"h-4 w-4"})})}),r.jsx(dm,{children:"Post now"})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Cancel this scheduled post?"}),r.jsx(ju,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Keep"}),r.jsx(Kd,{onClick:()=>q.mutate(fe.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Kd,{onClick:()=>W.mutate(fe.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(fe.status==="posted"||fe.status==="cancelled"||fe.status==="failed")&&r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Delete this post?"}),r.jsx(ju,{children:"This will permanently remove this post from your history."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>W.mutate(fe.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),fe.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:fe.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Gi,{className:"h-3 w-3"}),fe.status==="posted"&&fe.posted_at?`Posted ${un(new Date(fe.posted_at),"PPp")}`:fe.scheduled_for?`Scheduled for ${un(new Date(fe.scheduled_for),"PPp")}`:"Not scheduled"]}),fe.status==="failed"&&fe.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",fe.error_message]})]})]})},fe.id)})})]})]}),r.jsx(Ur,{open:!!o,onOpenChange:fe=>!fe&&c(null),children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Edit Scheduled Post"}),r.jsx(us,{children:"Update the caption or reschedule this post"})]}),o&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Caption"}),r.jsx(gs,{value:a,onChange:fe=>h(fe.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(Xe,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!m&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),m?un(m,"PPP"):"Pick a date"]})}),r.jsx(gh,{className:"w-auto p-0",align:"start",children:r.jsx(Lj,{mode:"single",selected:m,onSelect:x,disabled:fe=>fer.jsx(tr,{value:fe,children:fe},fe))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(_n,{value:k,onValueChange:C,children:[r.jsx(yn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:ne.map(fe=>r.jsx(tr,{value:fe,children:fe},fe))})]}),r.jsxs(_n,{value:S,onValueChange:fe=>T(fe),children:[r.jsx(yn,{className:"w-[70px]",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"AM",children:"AM"}),r.jsx(tr,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>c(null),children:"Cancel"}),r.jsxs(te,{onClick:re,disabled:F.isPending,children:[F.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function hL(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 $De={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(t,e){(function(n){t.exports=n()})(function(){return function n(s,i,o){function c(m,x){if(!i[m]){if(!s[m]){var v=typeof hL=="function"&&hL;if(!x&&v)return v(m,!0);if(a)return a(m,!0);var w=new Error("Cannot find module '"+m+"'");throw w.code="MODULE_NOT_FOUND",w}var k=i[m]={exports:{}};s[m][0].call(k.exports,function(C){var S=s[m][1][C];return c(S||C)},k,k.exports,n,s,i,o)}return i[m].exports}for(var a=typeof hL=="function"&&hL,h=0;h>2,k=(3&m)<<4|x>>4,C=1>6:64,S=2>4,x=(15&w)<<4|(k=a.indexOf(h.charAt(S++)))>>2,v=(3&k)<<6|(C=a.indexOf(h.charAt(S++))),A[T++]=m,k!==64&&(A[T++]=x),C!==64&&(A[T++]=v);return A}},{"./support":30,"./utils":32}],2:[function(n,s,i){var o=n("./external"),c=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),h=n("./stream/DataLengthProbe");function m(x,v,w,k,C){this.compressedSize=x,this.uncompressedSize=v,this.crc32=w,this.compression=k,this.compressedContent=C}m.prototype={getContentWorker:function(){var x=new c(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),v=this;return x.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new c(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},m.createWorkerFrom=function(x,v,w){return x.pipe(new a).pipe(new h("uncompressedSize")).pipe(v.compressWorker(w)).pipe(new h("compressedSize")).withStreamInfo("compression",v)},s.exports=m},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,i){var o=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,i){var o=n("./utils"),c=function(){for(var a,h=[],m=0;m<256;m++){a=m;for(var x=0;x<8;x++)a=1&a?3988292384^a>>>1:a>>>1;h[m]=a}return h}();s.exports=function(a,h){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(m,x,v,w){var k=c,C=w+v;m^=-1;for(var S=w;S>>8^k[255&(m^x[S])];return-1^m}(0|h,a,a.length,0):function(m,x,v,w){var k=c,C=w+v;m^=-1;for(var S=w;S>>8^k[255&(m^x.charCodeAt(S))];return-1^m}(0|h,a,a.length,0):0}},{"./utils":32}],5:[function(n,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,s,i){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",c=n("pako"),a=n("./utils"),h=n("./stream/GenericWorker"),m=o?"uint8array":"array";function x(v,w){h.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=w,this.meta={}}i.magic="\b\0",a.inherits(x,h),x.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(m,v.data),!1)},x.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new c[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(w){v.push({data:w,meta:v.meta})}},i.compressWorker=function(v){return new x("Deflate",v)},i.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,i){function o(k,C){var S,T="";for(S=0;S>>=8;return T}function c(k,C,S,T,I,A){var D,$,F=k.file,q=k.compression,W=A!==m.utf8encode,K=a.transformTo("string",A(F.name)),Z=a.transformTo("string",m.utf8encode(F.name)),re=F.comment,he=a.transformTo("string",A(re)),ue=a.transformTo("string",m.utf8encode(re)),je=Z.length!==F.name.length,ne=ue.length!==re.length,ye="",ie="",me="",fe=F.dir,ve=F.date,Ie={crc32:0,compressedSize:0,uncompressedSize:0};C&&!S||(Ie.crc32=k.crc32,Ie.compressedSize=k.compressedSize,Ie.uncompressedSize=k.uncompressedSize);var Se=0;C&&(Se|=8),W||!je&&!ne||(Se|=2048);var oe=0,ae=0;fe&&(oe|=16),I==="UNIX"?(ae=798,oe|=function(Te,Be){var Le=Te;return Te||(Le=Be?16893:33204),(65535&Le)<<16}(F.unixPermissions,fe)):(ae=20,oe|=function(Te){return 63&(Te||0)}(F.dosPermissions)),D=ve.getUTCHours(),D<<=6,D|=ve.getUTCMinutes(),D<<=5,D|=ve.getUTCSeconds()/2,$=ve.getUTCFullYear()-1980,$<<=4,$|=ve.getUTCMonth()+1,$<<=5,$|=ve.getUTCDate(),je&&(ie=o(1,1)+o(x(K),4)+Z,ye+="up"+o(ie.length,2)+ie),ne&&(me=o(1,1)+o(x(he),4)+ue,ye+="uc"+o(me.length,2)+me);var Ne="";return Ne+=` \0`,Ne+=o(Se,2),Ne+=q.magic,Ne+=o(D,2),Ne+=o($,2),Ne+=o(Ie.crc32,4),Ne+=o(Ie.compressedSize,4),Ne+=o(Ie.uncompressedSize,4),Ne+=o(K.length,2),Ne+=o(ye.length,2),{fileRecord:v.LOCAL_FILE_HEADER+Ne+K+ye,dirRecord:v.CENTRAL_FILE_HEADER+o(ae,2)+Ne+o(he.length,2)+"\0\0\0\0"+o(oe,4)+o(T,4)+K+ye+he}}var a=n("../utils"),h=n("../stream/GenericWorker"),m=n("../utf8"),x=n("../crc32"),v=n("../signature");function w(k,C,S,T){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=C,this.zipPlatform=S,this.encodeFileName=T,this.streamFiles=k,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(w,h),w.prototype.push=function(k){var C=k.meta.percent||0,S=this.entriesCount,T=this._sources.length;this.accumulate?this.contentBuffer.push(k):(this.bytesWritten+=k.data.length,h.prototype.push.call(this,{data:k.data,meta:{currentFile:this.currentFile,percent:S?(C+100*(S-T-1))/S:100}}))},w.prototype.openedSource=function(k){this.currentSourceOffset=this.bytesWritten,this.currentFile=k.file.name;var C=this.streamFiles&&!k.file.dir;if(C){var S=c(k,C,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:S.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(k){this.accumulate=!1;var C=this.streamFiles&&!k.file.dir,S=c(k,C,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(S.dirRecord),C)this.push({data:function(T){return v.DATA_DESCRIPTOR+o(T.crc32,4)+o(T.compressedSize,4)+o(T.uncompressedSize,4)}(k),meta:{percent:100}});else for(this.push({data:S.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var k=this.bytesWritten,C=0;C=this.index;h--)m=(m<<8)+this.byteAt(h);return this.index+=a,m},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},s.exports=c},{"../utils":32}],19:[function(n,s,i){var o=n("./Uint8ArrayReader");function c(a){o.call(this,a)}n("../utils").inherits(c,o),c.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=c},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,i){var o=n("./DataReader");function c(a){o.call(this,a)}n("../utils").inherits(c,o),c.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},c.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},c.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},c.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=c},{"../utils":32,"./DataReader":18}],21:[function(n,s,i){var o=n("./ArrayReader");function c(a){o.call(this,a)}n("../utils").inherits(c,o),c.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=c},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,i){var o=n("../utils"),c=n("../support"),a=n("./ArrayReader"),h=n("./StringReader"),m=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(v){var w=o.getTypeOf(v);return o.checkSupport(w),w!=="string"||c.uint8array?w==="nodebuffer"?new m(v):c.uint8array?new x(o.transformTo("uint8array",v)):new a(o.transformTo("array",v)):new h(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,i){var o=n("./GenericWorker"),c=n("../utils");function a(h){o.call(this,"ConvertWorker to "+h),this.destType=h}c.inherits(a,o),a.prototype.processChunk=function(h){this.push({data:c.transformTo(this.destType,h.data),meta:h.meta})},s.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,i){var o=n("./GenericWorker"),c=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(h){this.streamInfo.crc32=c(h.data,this.streamInfo.crc32||0),this.push(h)},s.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,i){var o=n("../utils"),c=n("./GenericWorker");function a(h){c.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}o.inherits(a,c),a.prototype.processChunk=function(h){if(h){var m=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=m+h.data.length}c.prototype.processChunk.call(this,h)},s.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,i){var o=n("../utils"),c=n("./GenericWorker");function a(h){c.call(this,"DataWorker");var m=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(x){m.dataIsReady=!0,m.data=x,m.max=x&&x.length||0,m.type=o.getTypeOf(x),m.isPaused||m._tickAndRepeat()},function(x){m.error(x)})}o.inherits(a,c),a.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,m=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,m);break;case"uint8array":h=this.data.subarray(this.index,m);break;case"array":case"nodebuffer":h=this.data.slice(this.index,m)}return this.index=m,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,i){function o(c){this.name=c||"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(c){this.emit("data",c)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(c){this.emit("error",c)}return!0},error:function(c){return!this.isFinished&&(this.isPaused?this.generatedError=c:(this.isFinished=!0,this.emit("error",c),this.previous&&this.previous.error(c),this.cleanUp()),!0)},on:function(c,a){return this._listeners[c].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(c,a){if(this._listeners[c])for(var h=0;h "+c:c}},s.exports=o},{}],29:[function(n,s,i){var o=n("../utils"),c=n("./ConvertWorker"),a=n("./GenericWorker"),h=n("../base64"),m=n("../support"),x=n("../external"),v=null;if(m.nodestream)try{v=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(C,S){return new x.Promise(function(T,I){var A=[],D=C._internalType,$=C._outputType,F=C._mimeType;C.on("data",function(q,W){A.push(q),S&&S(W)}).on("error",function(q){A=[],I(q)}).on("end",function(){try{var q=function(W,K,Z){switch(W){case"blob":return o.newBlob(o.transformTo("arraybuffer",K),Z);case"base64":return h.encode(K);default:return o.transformTo(W,K)}}($,function(W,K){var Z,re=0,he=null,ue=0;for(Z=0;Z"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var c=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);c.append(o),i.blob=c.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,i){for(var o=n("./utils"),c=n("./support"),a=n("./nodejsUtils"),h=n("./stream/GenericWorker"),m=new Array(256),x=0;x<256;x++)m[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;m[254]=m[254]=1;function v(){h.call(this,"utf-8 decode"),this.leftOver=null}function w(){h.call(this,"utf-8 encode")}i.utf8encode=function(k){return c.nodebuffer?a.newBufferFrom(k,"utf-8"):function(C){var S,T,I,A,D,$=C.length,F=0;for(A=0;A<$;A++)(64512&(T=C.charCodeAt(A)))==55296&&A+1<$&&(64512&(I=C.charCodeAt(A+1)))==56320&&(T=65536+(T-55296<<10)+(I-56320),A++),F+=T<128?1:T<2048?2:T<65536?3:4;for(S=c.uint8array?new Uint8Array(F):new Array(F),A=D=0;D>>6:(T<65536?S[D++]=224|T>>>12:(S[D++]=240|T>>>18,S[D++]=128|T>>>12&63),S[D++]=128|T>>>6&63),S[D++]=128|63&T);return S}(k)},i.utf8decode=function(k){return c.nodebuffer?o.transformTo("nodebuffer",k).toString("utf-8"):function(C){var S,T,I,A,D=C.length,$=new Array(2*D);for(S=T=0;S>10&1023,$[T++]=56320|1023&I)}return $.length!==T&&($.subarray?$=$.subarray(0,T):$.length=T),o.applyFromCharCode($)}(k=o.transformTo(c.uint8array?"uint8array":"array",k))},o.inherits(v,h),v.prototype.processChunk=function(k){var C=o.transformTo(c.uint8array?"uint8array":"array",k.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var S=C;(C=new Uint8Array(S.length+this.leftOver.length)).set(this.leftOver,0),C.set(S,this.leftOver.length)}else C=this.leftOver.concat(C);this.leftOver=null}var T=function(A,D){var $;for((D=D||A.length)>A.length&&(D=A.length),$=D-1;0<=$&&(192&A[$])==128;)$--;return $<0||$===0?D:$+m[A[$]]>D?$:D}(C),I=C;T!==C.length&&(c.uint8array?(I=C.subarray(0,T),this.leftOver=C.subarray(T,C.length)):(I=C.slice(0,T),this.leftOver=C.slice(T,C.length))),this.push({data:i.utf8decode(I),meta:k.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=v,o.inherits(w,h),w.prototype.processChunk=function(k){this.push({data:i.utf8encode(k.data),meta:k.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,i){var o=n("./support"),c=n("./base64"),a=n("./nodejsUtils"),h=n("./external");function m(S){return S}function x(S,T){for(var I=0;I>8;this.dir=!!(16&this.externalFileAttributes),k==0&&(this.dosPermissions=63&this.externalFileAttributes),k==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var k=o(this.extraFields[1].value);this.uncompressedSize===c.MAX_VALUE_32BITS&&(this.uncompressedSize=k.readInt(8)),this.compressedSize===c.MAX_VALUE_32BITS&&(this.compressedSize=k.readInt(8)),this.localHeaderOffset===c.MAX_VALUE_32BITS&&(this.localHeaderOffset=k.readInt(8)),this.diskNumberStart===c.MAX_VALUE_32BITS&&(this.diskNumberStart=k.readInt(4))}},readExtraFields:function(k){var C,S,T,I=k.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});k.index+4>>6:(k<65536?w[T++]=224|k>>>12:(w[T++]=240|k>>>18,w[T++]=128|k>>>12&63),w[T++]=128|k>>>6&63),w[T++]=128|63&k);return w},i.buf2binstring=function(v){return x(v,v.length)},i.binstring2buf=function(v){for(var w=new o.Buf8(v.length),k=0,C=w.length;k>10&1023,A[C++]=56320|1023&S)}return x(A,C)},i.utf8border=function(v,w){var k;for((w=w||v.length)>v.length&&(w=v.length),k=w-1;0<=k&&(192&v[k])==128;)k--;return k<0||k===0?w:k+h[v[k]]>w?k:w}},{"./common":41}],43:[function(n,s,i){s.exports=function(o,c,a,h){for(var m=65535&o|0,x=o>>>16&65535|0,v=0;a!==0;){for(a-=v=2e3>>1:c>>>1;a[h]=c}return a}();s.exports=function(c,a,h,m){var x=o,v=m+h;c^=-1;for(var w=m;w>>8^x[255&(c^a[w])];return-1^c}},{}],46:[function(n,s,i){var o,c=n("../utils/common"),a=n("./trees"),h=n("./adler32"),m=n("./crc32"),x=n("./messages"),v=0,w=4,k=0,C=-2,S=-1,T=4,I=2,A=8,D=9,$=286,F=30,q=19,W=2*$+1,K=15,Z=3,re=258,he=re+Z+1,ue=42,je=113,ne=1,ye=2,ie=3,me=4;function fe(ge,ft){return ge.msg=x[ft],ft}function ve(ge){return(ge<<1)-(4ge.avail_out&&(nt=ge.avail_out),nt!==0&&(c.arraySet(ge.output,ft.pending_buf,ft.pending_out,nt,ge.next_out),ge.next_out+=nt,ft.pending_out+=nt,ge.total_out+=nt,ge.avail_out-=nt,ft.pending-=nt,ft.pending===0&&(ft.pending_out=0))}function oe(ge,ft){a._tr_flush_block(ge,0<=ge.block_start?ge.block_start:-1,ge.strstart-ge.block_start,ft),ge.block_start=ge.strstart,Se(ge.strm)}function ae(ge,ft){ge.pending_buf[ge.pending++]=ft}function Ne(ge,ft){ge.pending_buf[ge.pending++]=ft>>>8&255,ge.pending_buf[ge.pending++]=255&ft}function Te(ge,ft){var nt,Ve,Me=ge.max_chain_length,rt=ge.strstart,Re=ge.prev_length,Ge=ge.nice_match,tt=ge.strstart>ge.w_size-he?ge.strstart-(ge.w_size-he):0,Et=ge.window,Lt=ge.w_mask,Ot=ge.prev,Dt=ge.strstart+re,kt=Et[rt+Re-1],sr=Et[rt+Re];ge.prev_length>=ge.good_match&&(Me>>=2),Ge>ge.lookahead&&(Ge=ge.lookahead);do if(Et[(nt=ft)+Re]===sr&&Et[nt+Re-1]===kt&&Et[nt]===Et[rt]&&Et[++nt]===Et[rt+1]){rt+=2,nt++;do;while(Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&Et[++rt]===Et[++nt]&&rttt&&--Me!=0);return Re<=ge.lookahead?Re:ge.lookahead}function Be(ge){var ft,nt,Ve,Me,rt,Re,Ge,tt,Et,Lt,Ot=ge.w_size;do{if(Me=ge.window_size-ge.lookahead-ge.strstart,ge.strstart>=Ot+(Ot-he)){for(c.arraySet(ge.window,ge.window,Ot,Ot,0),ge.match_start-=Ot,ge.strstart-=Ot,ge.block_start-=Ot,ft=nt=ge.hash_size;Ve=ge.head[--ft],ge.head[ft]=Ot<=Ve?Ve-Ot:0,--nt;);for(ft=nt=Ot;Ve=ge.prev[--ft],ge.prev[ft]=Ot<=Ve?Ve-Ot:0,--nt;);Me+=Ot}if(ge.strm.avail_in===0)break;if(Re=ge.strm,Ge=ge.window,tt=ge.strstart+ge.lookahead,Et=Me,Lt=void 0,Lt=Re.avail_in,Et=Z)for(rt=ge.strstart-ge.insert,ge.ins_h=ge.window[rt],ge.ins_h=(ge.ins_h<=Z&&(ge.ins_h=(ge.ins_h<=Z)if(Ve=a._tr_tally(ge,ge.strstart-ge.match_start,ge.match_length-Z),ge.lookahead-=ge.match_length,ge.match_length<=ge.max_lazy_match&&ge.lookahead>=Z){for(ge.match_length--;ge.strstart++,ge.ins_h=(ge.ins_h<=Z&&(ge.ins_h=(ge.ins_h<=Z&&ge.match_length<=ge.prev_length){for(Me=ge.strstart+ge.lookahead-Z,Ve=a._tr_tally(ge,ge.strstart-1-ge.prev_match,ge.prev_length-Z),ge.lookahead-=ge.prev_length-1,ge.prev_length-=2;++ge.strstart<=Me&&(ge.ins_h=(ge.ins_h<ge.pending_buf_size-5&&(nt=ge.pending_buf_size-5);;){if(ge.lookahead<=1){if(Be(ge),ge.lookahead===0&&ft===v)return ne;if(ge.lookahead===0)break}ge.strstart+=ge.lookahead,ge.lookahead=0;var Ve=ge.block_start+nt;if((ge.strstart===0||ge.strstart>=Ve)&&(ge.lookahead=ge.strstart-Ve,ge.strstart=Ve,oe(ge,!1),ge.strm.avail_out===0)||ge.strstart-ge.block_start>=ge.w_size-he&&(oe(ge,!1),ge.strm.avail_out===0))return ne}return ge.insert=0,ft===w?(oe(ge,!0),ge.strm.avail_out===0?ie:me):(ge.strstart>ge.block_start&&(oe(ge,!1),ge.strm.avail_out),ne)}),new Fe(4,4,8,4,Le),new Fe(4,5,16,8,Le),new Fe(4,6,32,32,Le),new Fe(4,4,16,16,Qe),new Fe(8,16,32,32,Qe),new Fe(8,16,128,128,Qe),new Fe(8,32,128,256,Qe),new Fe(32,128,258,1024,Qe),new Fe(32,258,258,4096,Qe)],i.deflateInit=function(ge,ft){return Ye(ge,ft,A,15,8,0)},i.deflateInit2=Ye,i.deflateReset=Ae,i.deflateResetKeep=Je,i.deflateSetHeader=function(ge,ft){return ge&&ge.state?ge.state.wrap!==2?C:(ge.state.gzhead=ft,k):C},i.deflate=function(ge,ft){var nt,Ve,Me,rt;if(!ge||!ge.state||5>8&255),ae(Ve,Ve.gzhead.time>>16&255),ae(Ve,Ve.gzhead.time>>24&255),ae(Ve,Ve.level===9?2:2<=Ve.strategy||Ve.level<2?4:0),ae(Ve,255&Ve.gzhead.os),Ve.gzhead.extra&&Ve.gzhead.extra.length&&(ae(Ve,255&Ve.gzhead.extra.length),ae(Ve,Ve.gzhead.extra.length>>8&255)),Ve.gzhead.hcrc&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending,0)),Ve.gzindex=0,Ve.status=69):(ae(Ve,0),ae(Ve,0),ae(Ve,0),ae(Ve,0),ae(Ve,0),ae(Ve,Ve.level===9?2:2<=Ve.strategy||Ve.level<2?4:0),ae(Ve,3),Ve.status=je);else{var Re=A+(Ve.w_bits-8<<4)<<8;Re|=(2<=Ve.strategy||Ve.level<2?0:Ve.level<6?1:Ve.level===6?2:3)<<6,Ve.strstart!==0&&(Re|=32),Re+=31-Re%31,Ve.status=je,Ne(Ve,Re),Ve.strstart!==0&&(Ne(Ve,ge.adler>>>16),Ne(Ve,65535&ge.adler)),ge.adler=1}if(Ve.status===69)if(Ve.gzhead.extra){for(Me=Ve.pending;Ve.gzindex<(65535&Ve.gzhead.extra.length)&&(Ve.pending!==Ve.pending_buf_size||(Ve.gzhead.hcrc&&Ve.pending>Me&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending-Me,Me)),Se(ge),Me=Ve.pending,Ve.pending!==Ve.pending_buf_size));)ae(Ve,255&Ve.gzhead.extra[Ve.gzindex]),Ve.gzindex++;Ve.gzhead.hcrc&&Ve.pending>Me&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending-Me,Me)),Ve.gzindex===Ve.gzhead.extra.length&&(Ve.gzindex=0,Ve.status=73)}else Ve.status=73;if(Ve.status===73)if(Ve.gzhead.name){Me=Ve.pending;do{if(Ve.pending===Ve.pending_buf_size&&(Ve.gzhead.hcrc&&Ve.pending>Me&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending-Me,Me)),Se(ge),Me=Ve.pending,Ve.pending===Ve.pending_buf_size)){rt=1;break}rt=Ve.gzindexMe&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending-Me,Me)),rt===0&&(Ve.gzindex=0,Ve.status=91)}else Ve.status=91;if(Ve.status===91)if(Ve.gzhead.comment){Me=Ve.pending;do{if(Ve.pending===Ve.pending_buf_size&&(Ve.gzhead.hcrc&&Ve.pending>Me&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending-Me,Me)),Se(ge),Me=Ve.pending,Ve.pending===Ve.pending_buf_size)){rt=1;break}rt=Ve.gzindexMe&&(ge.adler=m(ge.adler,Ve.pending_buf,Ve.pending-Me,Me)),rt===0&&(Ve.status=103)}else Ve.status=103;if(Ve.status===103&&(Ve.gzhead.hcrc?(Ve.pending+2>Ve.pending_buf_size&&Se(ge),Ve.pending+2<=Ve.pending_buf_size&&(ae(Ve,255&ge.adler),ae(Ve,ge.adler>>8&255),ge.adler=0,Ve.status=je)):Ve.status=je),Ve.pending!==0){if(Se(ge),ge.avail_out===0)return Ve.last_flush=-1,k}else if(ge.avail_in===0&&ve(ft)<=ve(nt)&&ft!==w)return fe(ge,-5);if(Ve.status===666&&ge.avail_in!==0)return fe(ge,-5);if(ge.avail_in!==0||Ve.lookahead!==0||ft!==v&&Ve.status!==666){var Ge=Ve.strategy===2?function(tt,Et){for(var Lt;;){if(tt.lookahead===0&&(Be(tt),tt.lookahead===0)){if(Et===v)return ne;break}if(tt.match_length=0,Lt=a._tr_tally(tt,0,tt.window[tt.strstart]),tt.lookahead--,tt.strstart++,Lt&&(oe(tt,!1),tt.strm.avail_out===0))return ne}return tt.insert=0,Et===w?(oe(tt,!0),tt.strm.avail_out===0?ie:me):tt.last_lit&&(oe(tt,!1),tt.strm.avail_out===0)?ne:ye}(Ve,ft):Ve.strategy===3?function(tt,Et){for(var Lt,Ot,Dt,kt,sr=tt.window;;){if(tt.lookahead<=re){if(Be(tt),tt.lookahead<=re&&Et===v)return ne;if(tt.lookahead===0)break}if(tt.match_length=0,tt.lookahead>=Z&&0tt.lookahead&&(tt.match_length=tt.lookahead)}if(tt.match_length>=Z?(Lt=a._tr_tally(tt,1,tt.match_length-Z),tt.lookahead-=tt.match_length,tt.strstart+=tt.match_length,tt.match_length=0):(Lt=a._tr_tally(tt,0,tt.window[tt.strstart]),tt.lookahead--,tt.strstart++),Lt&&(oe(tt,!1),tt.strm.avail_out===0))return ne}return tt.insert=0,Et===w?(oe(tt,!0),tt.strm.avail_out===0?ie:me):tt.last_lit&&(oe(tt,!1),tt.strm.avail_out===0)?ne:ye}(Ve,ft):o[Ve.level].func(Ve,ft);if(Ge!==ie&&Ge!==me||(Ve.status=666),Ge===ne||Ge===ie)return ge.avail_out===0&&(Ve.last_flush=-1),k;if(Ge===ye&&(ft===1?a._tr_align(Ve):ft!==5&&(a._tr_stored_block(Ve,0,0,!1),ft===3&&(Ie(Ve.head),Ve.lookahead===0&&(Ve.strstart=0,Ve.block_start=0,Ve.insert=0))),Se(ge),ge.avail_out===0))return Ve.last_flush=-1,k}return ft!==w?k:Ve.wrap<=0?1:(Ve.wrap===2?(ae(Ve,255&ge.adler),ae(Ve,ge.adler>>8&255),ae(Ve,ge.adler>>16&255),ae(Ve,ge.adler>>24&255),ae(Ve,255&ge.total_in),ae(Ve,ge.total_in>>8&255),ae(Ve,ge.total_in>>16&255),ae(Ve,ge.total_in>>24&255)):(Ne(Ve,ge.adler>>>16),Ne(Ve,65535&ge.adler)),Se(ge),0=nt.w_size&&(rt===0&&(Ie(nt.head),nt.strstart=0,nt.block_start=0,nt.insert=0),Et=new c.Buf8(nt.w_size),c.arraySet(Et,ft,Lt-nt.w_size,nt.w_size,0),ft=Et,Lt=nt.w_size),Re=ge.avail_in,Ge=ge.next_in,tt=ge.input,ge.avail_in=Lt,ge.next_in=0,ge.input=ft,Be(nt);nt.lookahead>=Z;){for(Ve=nt.strstart,Me=nt.lookahead-(Z-1);nt.ins_h=(nt.ins_h<>>=Z=K>>>24,D-=Z,(Z=K>>>16&255)===0)ye[x++]=65535&K;else{if(!(16&Z)){if(!(64&Z)){K=$[(65535&K)+(A&(1<>>=Z,D-=Z),D<15&&(A+=ne[h++]<>>=Z=K>>>24,D-=Z,!(16&(Z=K>>>16&255))){if(!(64&Z)){K=F[(65535&K)+(A&(1<>>=Z,D-=Z,(Z=x-v)>3,A&=(1<<(D-=re<<3))-1,o.next_in=h,o.next_out=x,o.avail_in=h>>24&255)+(ue>>>8&65280)+((65280&ue)<<8)+((255&ue)<<24)}function A(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function D(ue){var je;return ue&&ue.state?(je=ue.state,ue.total_in=ue.total_out=je.total=0,ue.msg="",je.wrap&&(ue.adler=1&je.wrap),je.mode=C,je.last=0,je.havedict=0,je.dmax=32768,je.head=null,je.hold=0,je.bits=0,je.lencode=je.lendyn=new o.Buf32(S),je.distcode=je.distdyn=new o.Buf32(T),je.sane=1,je.back=-1,w):k}function $(ue){var je;return ue&&ue.state?((je=ue.state).wsize=0,je.whave=0,je.wnext=0,D(ue)):k}function F(ue,je){var ne,ye;return ue&&ue.state?(ye=ue.state,je<0?(ne=0,je=-je):(ne=1+(je>>4),je<48&&(je&=15)),je&&(je<8||15=me.wsize?(o.arraySet(me.window,je,ne-me.wsize,me.wsize,0),me.wnext=0,me.whave=me.wsize):(ye<(ie=me.wsize-me.wnext)&&(ie=ye),o.arraySet(me.window,je,ne-ye,ie,me.wnext),(ye-=ie)?(o.arraySet(me.window,je,ne-ye,ye,0),me.wnext=ye,me.whave=me.wsize):(me.wnext+=ie,me.wnext===me.wsize&&(me.wnext=0),me.whave>>8&255,ne.check=a(ne.check,rt,2,0),oe=Se=0,ne.mode=2;break}if(ne.flags=0,ne.head&&(ne.head.done=!1),!(1&ne.wrap)||(((255&Se)<<8)+(Se>>8))%31){ue.msg="incorrect header check",ne.mode=30;break}if((15&Se)!=8){ue.msg="unknown compression method",ne.mode=30;break}if(oe-=4,ge=8+(15&(Se>>>=4)),ne.wbits===0)ne.wbits=ge;else if(ge>ne.wbits){ue.msg="invalid window size",ne.mode=30;break}ne.dmax=1<>8&1),512&ne.flags&&(rt[0]=255&Se,rt[1]=Se>>>8&255,ne.check=a(ne.check,rt,2,0)),oe=Se=0,ne.mode=3;case 3:for(;oe<32;){if(ve===0)break e;ve--,Se+=ye[me++]<>>8&255,rt[2]=Se>>>16&255,rt[3]=Se>>>24&255,ne.check=a(ne.check,rt,4,0)),oe=Se=0,ne.mode=4;case 4:for(;oe<16;){if(ve===0)break e;ve--,Se+=ye[me++]<>8),512&ne.flags&&(rt[0]=255&Se,rt[1]=Se>>>8&255,ne.check=a(ne.check,rt,2,0)),oe=Se=0,ne.mode=5;case 5:if(1024&ne.flags){for(;oe<16;){if(ve===0)break e;ve--,Se+=ye[me++]<>>8&255,ne.check=a(ne.check,rt,2,0)),oe=Se=0}else ne.head&&(ne.head.extra=null);ne.mode=6;case 6:if(1024&ne.flags&&(ve<(Te=ne.length)&&(Te=ve),Te&&(ne.head&&(ge=ne.head.extra_len-ne.length,ne.head.extra||(ne.head.extra=new Array(ne.head.extra_len)),o.arraySet(ne.head.extra,ye,me,Te,ge)),512&ne.flags&&(ne.check=a(ne.check,ye,Te,me)),ve-=Te,me+=Te,ne.length-=Te),ne.length))break e;ne.length=0,ne.mode=7;case 7:if(2048&ne.flags){if(ve===0)break e;for(Te=0;ge=ye[me+Te++],ne.head&&ge&&ne.length<65536&&(ne.head.name+=String.fromCharCode(ge)),ge&&Te>9&1,ne.head.done=!0),ue.adler=ne.check=0,ne.mode=12;break;case 10:for(;oe<32;){if(ve===0)break e;ve--,Se+=ye[me++]<>>=7&oe,oe-=7&oe,ne.mode=27;break}for(;oe<3;){if(ve===0)break e;ve--,Se+=ye[me++]<>>=1)){case 0:ne.mode=14;break;case 1:if(re(ne),ne.mode=20,je!==6)break;Se>>>=2,oe-=2;break e;case 2:ne.mode=17;break;case 3:ue.msg="invalid block type",ne.mode=30}Se>>>=2,oe-=2;break;case 14:for(Se>>>=7&oe,oe-=7&oe;oe<32;){if(ve===0)break e;ve--,Se+=ye[me++]<>>16^65535)){ue.msg="invalid stored block lengths",ne.mode=30;break}if(ne.length=65535&Se,oe=Se=0,ne.mode=15,je===6)break e;case 15:ne.mode=16;case 16:if(Te=ne.length){if(ve>>=5,oe-=5,ne.ndist=1+(31&Se),Se>>>=5,oe-=5,ne.ncode=4+(15&Se),Se>>>=4,oe-=4,286>>=3,oe-=3}for(;ne.have<19;)ne.lens[Re[ne.have++]]=0;if(ne.lencode=ne.lendyn,ne.lenbits=7,nt={bits:ne.lenbits},ft=m(0,ne.lens,0,19,ne.lencode,0,ne.work,nt),ne.lenbits=nt.bits,ft){ue.msg="invalid code lengths set",ne.mode=30;break}ne.have=0,ne.mode=19;case 19:for(;ne.have>>16&255,Ce=65535&Me,!((Qe=Me>>>24)<=oe);){if(ve===0)break e;ve--,Se+=ye[me++]<>>=Qe,oe-=Qe,ne.lens[ne.have++]=Ce;else{if(Ce===16){for(Ve=Qe+2;oe>>=Qe,oe-=Qe,ne.have===0){ue.msg="invalid bit length repeat",ne.mode=30;break}ge=ne.lens[ne.have-1],Te=3+(3&Se),Se>>>=2,oe-=2}else if(Ce===17){for(Ve=Qe+3;oe>>=Qe)),Se>>>=3,oe-=3}else{for(Ve=Qe+7;oe>>=Qe)),Se>>>=7,oe-=7}if(ne.have+Te>ne.nlen+ne.ndist){ue.msg="invalid bit length repeat",ne.mode=30;break}for(;Te--;)ne.lens[ne.have++]=ge}}if(ne.mode===30)break;if(ne.lens[256]===0){ue.msg="invalid code -- missing end-of-block",ne.mode=30;break}if(ne.lenbits=9,nt={bits:ne.lenbits},ft=m(x,ne.lens,0,ne.nlen,ne.lencode,0,ne.work,nt),ne.lenbits=nt.bits,ft){ue.msg="invalid literal/lengths set",ne.mode=30;break}if(ne.distbits=6,ne.distcode=ne.distdyn,nt={bits:ne.distbits},ft=m(v,ne.lens,ne.nlen,ne.ndist,ne.distcode,0,ne.work,nt),ne.distbits=nt.bits,ft){ue.msg="invalid distances set",ne.mode=30;break}if(ne.mode=20,je===6)break e;case 20:ne.mode=21;case 21:if(6<=ve&&258<=Ie){ue.next_out=fe,ue.avail_out=Ie,ue.next_in=me,ue.avail_in=ve,ne.hold=Se,ne.bits=oe,h(ue,Ne),fe=ue.next_out,ie=ue.output,Ie=ue.avail_out,me=ue.next_in,ye=ue.input,ve=ue.avail_in,Se=ne.hold,oe=ne.bits,ne.mode===12&&(ne.back=-1);break}for(ne.back=0;Fe=(Me=ne.lencode[Se&(1<>>16&255,Ce=65535&Me,!((Qe=Me>>>24)<=oe);){if(ve===0)break e;ve--,Se+=ye[me++]<>Je)])>>>16&255,Ce=65535&Me,!(Je+(Qe=Me>>>24)<=oe);){if(ve===0)break e;ve--,Se+=ye[me++]<>>=Je,oe-=Je,ne.back+=Je}if(Se>>>=Qe,oe-=Qe,ne.back+=Qe,ne.length=Ce,Fe===0){ne.mode=26;break}if(32&Fe){ne.back=-1,ne.mode=12;break}if(64&Fe){ue.msg="invalid literal/length code",ne.mode=30;break}ne.extra=15&Fe,ne.mode=22;case 22:if(ne.extra){for(Ve=ne.extra;oe>>=ne.extra,oe-=ne.extra,ne.back+=ne.extra}ne.was=ne.length,ne.mode=23;case 23:for(;Fe=(Me=ne.distcode[Se&(1<>>16&255,Ce=65535&Me,!((Qe=Me>>>24)<=oe);){if(ve===0)break e;ve--,Se+=ye[me++]<>Je)])>>>16&255,Ce=65535&Me,!(Je+(Qe=Me>>>24)<=oe);){if(ve===0)break e;ve--,Se+=ye[me++]<>>=Je,oe-=Je,ne.back+=Je}if(Se>>>=Qe,oe-=Qe,ne.back+=Qe,64&Fe){ue.msg="invalid distance code",ne.mode=30;break}ne.offset=Ce,ne.extra=15&Fe,ne.mode=24;case 24:if(ne.extra){for(Ve=ne.extra;oe>>=ne.extra,oe-=ne.extra,ne.back+=ne.extra}if(ne.offset>ne.dmax){ue.msg="invalid distance too far back",ne.mode=30;break}ne.mode=25;case 25:if(Ie===0)break e;if(Te=Ne-Ie,ne.offset>Te){if((Te=ne.offset-Te)>ne.whave&&ne.sane){ue.msg="invalid distance too far back",ne.mode=30;break}Be=Te>ne.wnext?(Te-=ne.wnext,ne.wsize-Te):ne.wnext-Te,Te>ne.length&&(Te=ne.length),Le=ne.window}else Le=ie,Be=fe-ne.offset,Te=ne.length;for(IeW?(Z=Be[Le+T[je]],oe[ae+T[je]]):(Z=96,0),A=1<>fe)+(D-=A)]=K<<24|Z<<16|re|0,D!==0;);for(A=1<>=1;if(A!==0?(Se&=A-1,Se+=A):Se=0,je++,--Ne[ue]==0){if(ue===ye)break;ue=v[w+T[je]]}if(ie>>7)]}function ae(Me,rt){Me.pending_buf[Me.pending++]=255&rt,Me.pending_buf[Me.pending++]=rt>>>8&255}function Ne(Me,rt,Re){Me.bi_valid>I-Re?(Me.bi_buf|=rt<>I-Me.bi_valid,Me.bi_valid+=Re-I):(Me.bi_buf|=rt<>>=1,Re<<=1,0<--rt;);return Re>>>1}function Le(Me,rt,Re){var Ge,tt,Et=new Array(T+1),Lt=0;for(Ge=1;Ge<=T;Ge++)Et[Ge]=Lt=Lt+Re[Ge-1]<<1;for(tt=0;tt<=rt;tt++){var Ot=Me[2*tt+1];Ot!==0&&(Me[2*tt]=Be(Et[Ot]++,Ot))}}function Qe(Me){var rt;for(rt=0;rt>1;1<=Re;Re--)Je(Me,Et,Re);for(tt=Dt;Re=Me.heap[1],Me.heap[1]=Me.heap[Me.heap_len--],Je(Me,Et,1),Ge=Me.heap[1],Me.heap[--Me.heap_max]=Re,Me.heap[--Me.heap_max]=Ge,Et[2*tt]=Et[2*Re]+Et[2*Ge],Me.depth[tt]=(Me.depth[Re]>=Me.depth[Ge]?Me.depth[Re]:Me.depth[Ge])+1,Et[2*Re+1]=Et[2*Ge+1]=tt,Me.heap[1]=tt++,Je(Me,Et,1),2<=Me.heap_len;);Me.heap[--Me.heap_max]=Me.heap[1],function(sr,Pr){var wn,kn,pn,qn,Fs,_r,js=Pr.dyn_tree,Ii=Pr.max_code,fi=Pr.stat_desc.static_tree,Aa=Pr.stat_desc.has_stree,ca=Pr.stat_desc.extra_bits,Yo=Pr.stat_desc.extra_base,Xo=Pr.stat_desc.max_length,Hs=0;for(qn=0;qn<=T;qn++)sr.bl_count[qn]=0;for(js[2*sr.heap[sr.heap_max]+1]=0,wn=sr.heap_max+1;wn>=7;tt>>=1)if(1&kt&&Ot.dyn_ltree[2*Dt]!==0)return c;if(Ot.dyn_ltree[18]!==0||Ot.dyn_ltree[20]!==0||Ot.dyn_ltree[26]!==0)return a;for(Dt=32;Dt>>3,(Et=Me.static_len+3+7>>>3)<=tt&&(tt=Et)):tt=Et=Re+5,Re+4<=tt&&rt!==-1?Ve(Me,rt,Re,Ge):Me.strategy===4||Et===tt?(Ne(Me,2+(Ge?1:0),3),Ae(Me,he,ue)):(Ne(Me,4+(Ge?1:0),3),function(Ot,Dt,kt,sr){var Pr;for(Ne(Ot,Dt-257,5),Ne(Ot,kt-1,5),Ne(Ot,sr-4,4),Pr=0;Pr>>8&255,Me.pending_buf[Me.d_buf+2*Me.last_lit+1]=255&rt,Me.pending_buf[Me.l_buf+Me.last_lit]=255&Re,Me.last_lit++,rt===0?Me.dyn_ltree[2*Re]++:(Me.matches++,rt--,Me.dyn_ltree[2*(ne[Re]+v+1)]++,Me.dyn_dtree[2*oe(rt)]++),Me.last_lit===Me.lit_bufsize-1},i._tr_align=function(Me){Ne(Me,2,3),Te(Me,D,he),function(rt){rt.bi_valid===16?(ae(rt,rt.bi_buf),rt.bi_buf=0,rt.bi_valid=0):8<=rt.bi_valid&&(rt.pending_buf[rt.pending++]=255&rt.bi_buf,rt.bi_buf>>=8,rt.bi_valid-=8)}(Me)}},{"../utils/common":41}],53:[function(n,s,i){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,s,i){(function(o){(function(c,a){if(!c.setImmediate){var h,m,x,v,w=1,k={},C=!1,S=c.document,T=Object.getPrototypeOf&&Object.getPrototypeOf(c);T=T&&T.setTimeout?T:c,h={}.toString.call(c.process)==="[object process]"?function($){process.nextTick(function(){A($)})}:function(){if(c.postMessage&&!c.importScripts){var $=!0,F=c.onmessage;return c.onmessage=function(){$=!1},c.postMessage("","*"),c.onmessage=F,$}}()?(v="setImmediate$"+Math.random()+"$",c.addEventListener?c.addEventListener("message",D,!1):c.attachEvent("onmessage",D),function($){c.postMessage(v+$,"*")}):c.MessageChannel?((x=new MessageChannel).port1.onmessage=function($){A($.data)},function($){x.port2.postMessage($)}):S&&"onreadystatechange"in S.createElement("script")?(m=S.documentElement,function($){var F=S.createElement("script");F.onreadystatechange=function(){A($),F.onreadystatechange=null,m.removeChild(F),F=null},m.appendChild(F)}):function($){setTimeout(A,0,$)},T.setImmediate=function($){typeof $!="function"&&($=new Function(""+$));for(var F=new Array(arguments.length-1),q=0;q"u"?o===void 0?this:o:self)}).call(this,typeof wx<"u"?wx:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})($De);var Mgt=$De.exports;const Tgt=Da(Mgt),Agt=()=>{const{isAdmin:t}=zr(),[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState("all"),[a,h]=P.useState(new Set),[m,x]=P.useState(!1),[v,w]=P.useState(!1),[k,C]=P.useState("images"),[S,T]=P.useState(null),{data:I=[],isLoading:A}=rr({queryKey:["social-swag-2"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ie)throw Ie;return ve}}),{data:D=[]}=rr({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ie)throw Ie;return ve}}),{data:$=[]}=rr({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ie)throw Ie;return ve}}),{data:F=[]}=rr({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:ve,error:Ie}=await ee.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ie)throw Ie;return ve||[]}}),q=F.length>0,W=P.useMemo(()=>o==="all"?null:$.find(ve=>ve.month===o)||null,[o,$]),K=P.useMemo(()=>[...new Set(I.map(Ie=>Ie.month))].sort((Ie,Se)=>Se.localeCompare(Ie)),[I]);P.useEffect(()=>{K.length>0&&o==="all"&&c(K[0])},[K,o]);const Z=ve=>{try{const Ie=Qge(ve,"yyyy-MM",new Date);return un(Ie,"MMMM yyyy")}catch{return ve}},re=P.useMemo(()=>o==="all"?I:I.filter(ve=>ve.month===o),[o,I]),he=P.useMemo(()=>{var ve;return o==="all"?null:((ve=D.find(Ie=>Ie.month===o))==null?void 0:ve.canva_link)||null},[o,D]),ue=async ve=>{try{await navigator.clipboard.writeText(ve),He.success("Caption copied to clipboard!")}catch{He.error("Failed to copy caption")}},je=async(ve,Ie)=>{try{const oe=await(await fetch(ve)).blob(),ae=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),Ne=navigator.canShare&&navigator.canShare({files:[new File([oe],"test.jpg",{type:"image/jpeg"})]});if(ae&&Ne){const Te=new File([oe],`social-swag-${Ie}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Te],title:"Social Swag Image"}),He.success("Image ready to save!")}else{const Te=window.URL.createObjectURL(oe),Be=document.createElement("a");Be.href=Te,Be.download=`social-swag-${Ie}.jpg`,document.body.appendChild(Be),Be.click(),document.body.removeChild(Be),window.URL.revokeObjectURL(Te),He.success("Image downloaded!")}}catch(Se){Se.name!=="AbortError"&&He.error("Failed to download image")}},ne=ve=>{h(Ie=>{const Se=new Set(Ie);return Se.has(ve)?Se.delete(ve):Se.add(ve),Se})},ye=()=>{h(new Set(re.map(ve=>ve.id)))},ie=()=>{h(new Set),x(!1)},me=async()=>{const ve=re.filter(Ie=>a.has(Ie.id));if(ve.length===0){He.error("No images selected");return}w(!0),He.info(`Preparing ${ve.length} images for download...`);try{const Ie=new Tgt,Se=[...ve].sort((Be,Le)=>Be.sort_order-Le.sort_order);for(let Be=0;Be{m?ne(ve.id):n(ve)};return r.jsx(Dr,{title:"Social Swag 2.0",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/80 to-info p-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[r.jsxs(Ft,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Ft,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Wo,{className:"h-3 w-3 mr-1"}),I.length," images"]})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),r.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),t?r.jsxs(Oa,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(Ta,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(xn,{value:"gallery",className:"gap-2",children:[r.jsx(Wo,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(xn,{value:"scheduled",className:"gap-2",children:[r.jsx(sm,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Un,{value:"gallery",className:"space-y-6",children:[t?q?r.jsx(Ze,{className:"border rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(io,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(Ze,{className:"border-2 border-dashed border-primary/30 bg-gradient-to-r from-pink-500/5 via-purple-500/5 to-blue-500/5 rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Td,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(Zd,{className:"h-5 w-5 text-pink-600"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),r.jsx(te,{asChild:!0,className:"gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600",children:r.jsxs(io,{to:"/social-connections",children:[r.jsx(Bf,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(Ze,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Gi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Td,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(Zd,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(ve=>r.jsx("button",{onClick:()=>c(ve),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ve?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(ve)},ve))}),o!=="all"&&(he?r.jsxs("a",{href:he,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{C("images"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Wo,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(kd,{className:"h-4 w-4"}),"Reels"]})]}),k==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:ye,className:"gap-2",children:["Select All (",re.length,")"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(Es,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(te,{size:"sm",onClick:me,disabled:v,className:"gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),v?"Downloading...":`Download ${a.size} Selected`]}),r.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:"Please ensure your browser allows downloads from the LevelUp Dashboard."})]})]}):r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx($a,{className:"h-4 w-4"}),"Select Images"]})})]}),A&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!A&&k==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:re.map(ve=>{const Ie=a.has(ve.id);return r.jsx(Ze,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Ie&&"ring-2 ring-primary ring-offset-2"),onClick:()=>fe(ve),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ve.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),m&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ie?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ie&&r.jsx($a,{className:"h-4 w-4"})}),!m&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ve.id)})}),re.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wo,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!A&&k==="reels"&&r.jsx(r.Fragment,{children:W?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ze,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(W),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:W.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Ft,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(kd,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(kd,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Ur,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Br,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:e&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:e.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[t&&r.jsxs(te,{onClick:()=>{T({imageUrl:e.image_url,imageId:e.id,caption:e.caption})},className:"w-full gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600 text-white",children:[r.jsx(To,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(te,{variant:"outline",onClick:()=>ue(e.caption),className:"flex-1 gap-2",children:[r.jsx(Vl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(te,{variant:"outline",onClick:()=>je(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Ur,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(Br,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(kd,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(te,{onClick:()=>ue(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Vl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(te,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx($s,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(fgt,{open:!!S,onOpenChange:ve=>!ve&&T(null),imageUrl:(S==null?void 0:S.imageUrl)||"",imageId:(S==null?void 0:S.imageId)||"",defaultCaption:(S==null?void 0:S.caption)||"",swagItemId:S==null?void 0:S.imageId})]}),r.jsx(Un,{value:"scheduled",children:r.jsx(Cgt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ze,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Gi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Td,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(Zd,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(ve=>r.jsx("button",{onClick:()=>c(ve),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ve?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(ve)},ve))}),o!=="all"&&(he?r.jsxs("a",{href:he,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{C("images"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Wo,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",k==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(kd,{className:"h-4 w-4"}),"Reels"]})]}),k==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:ye,className:"gap-2",children:["Select All (",re.length,")"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(Es,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs(te,{size:"sm",onClick:me,disabled:v,className:"gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),v?"Downloading...":`Download ${a.size} Selected`]})]}):r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx($a,{className:"h-4 w-4"}),"Select Images"]})})]}),A&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!A&&k==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:re.map(ve=>{const Ie=a.has(ve.id);return r.jsx(Ze,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Ie&&"ring-2 ring-primary ring-offset-2"),onClick:()=>fe(ve),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ve.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),m&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ie?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ie&&r.jsx($a,{className:"h-4 w-4"})}),!m&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ve.id)})}),re.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wo,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!A&&k==="reels"&&r.jsx(r.Fragment,{children:W?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ze,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(W),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:W.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Ft,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(kd,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(kd,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Ur,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Br,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:e&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:e.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(te,{variant:"outline",onClick:()=>ue(e.caption),className:"flex-1 gap-2",children:[r.jsx(Vl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(te,{variant:"outline",onClick:()=>je(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(Mo,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Ur,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(Br,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(kd,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(te,{onClick:()=>ue(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Vl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(te,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx($s,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},Egt=()=>{const{swagId:t}=hd(),{user:e}=zr(),{toast:n}=ua(),s=Qr(),{trackEngagement:i}=xI(),[o,c]=P.useState(""),{data:a,isLoading:h}=rr({queryKey:["social-swag-detail",t],queryFn:async()=>{const{data:I,error:A}=await ee.from("social_swag").select("*").eq("id",t).single();if(A)throw A;const{data:D}=await ee.from("social_swag_links").select("*").eq("swag_id",t).order("sort_order");return{...I,links:D||[]}},enabled:!!t});P.useEffect(()=>{a&&i("social_swag",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:m=[]}=rr({queryKey:["social-swag-likes",t],queryFn:async()=>{const{data:I,error:A}=await ee.from("social_swag_likes").select("*").eq("swag_id",t);if(A)throw A;return I},enabled:!!t}),{data:x=[]}=rr({queryKey:["social-swag-comments",t],queryFn:async()=>{const{data:I,error:A}=await ee.from("social_swag_comments").select("*").eq("swag_id",t).order("created_at",{ascending:!1});if(A)throw A;const D=[...new Set(I.map(q=>q.user_id))],{data:$}=await ee.from("profiles").select("id, name").in("id",D),F=new Map(($==null?void 0:$.map(q=>[q.id,q.name]))||[]);return I.map(q=>({...q,user_name:F.get(q.user_id)||"Unknown User"}))},enabled:!!t}),v=dr({mutationFn:async I=>{const{error:A}=await ee.from("social_swag_comments").insert({swag_id:t,user_id:e.id,content:I});if(A)throw A},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),c(""),n({title:"Comment added!"})},onError:I=>{n({title:"Error adding comment",description:I.message,variant:"destructive"})}}),w=dr({mutationFn:async I=>{const{error:A}=await ee.from("social_swag_comments").delete().eq("id",I);if(A)throw A},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),n({title:"Comment deleted"})}}),k=dr({mutationFn:async()=>{const I=m.find(A=>A.user_id===(e==null?void 0:e.id));if(I){const{error:A}=await ee.from("social_swag_likes").delete().eq("id",I.id);if(A)throw A}else{const{error:A}=await ee.from("social_swag_likes").insert({swag_id:t,user_id:e.id});if(A)throw A}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",t]})}}),C=m.some(I=>I.user_id===(e==null?void 0:e.id)),S=I=>I.split(" ").map(A=>A[0]).join("").toUpperCase().slice(0,2),T=I=>{I.preventDefault(),!(!o.trim()||!e)&&v.mutate(o.trim())};return h?r.jsx(Dr,{title:"Social Swag",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Dr,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(io,{to:"/social-swag",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Social Swag"]})}),a.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:a.preview_image_url,alt:a.title,className:"w-full max-h-[500px] object-contain"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(o5,{resourceType:"social_swag",resourceId:a.id,resourceTitle:a.title}),r.jsxs(te,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>k.mutate(),disabled:!e||k.isPending,children:[r.jsx(Ad,{className:`h-4 w-4 ${C?"fill-current":""}`}),m.length," ",m.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.links.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(bo,{className:"h-4 w-4"}),a.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:a.links.map(I=>r.jsxs(te,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{i("social_swag",a.id,a.title,"click_canva"),window.open(I.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:I.title}),r.jsx($s,{className:"h-4 w-4 text-muted-foreground"})]},I.id))})]})}),r.jsx(Gd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Wl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(gs,{placeholder:"Add a comment...",value:o,onChange:I=>c(I.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(te,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||v.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(I=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Di,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Ri,{className:"text-sm",children:S(I.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:I.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Qd(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(e==null?void 0:e.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>w.mutate(I.id),children:r.jsx(es,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):r.jsx(Dr,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(bo,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(io,{to:"/social-swag",children:"Back to Social Swag"})})]})})},Igt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,c]=P.useState(!0),[a,h]=P.useState(!0),[m,x]=P.useState(!0),v=w=>w.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2);return r.jsx("aside",{className:"w-64 shrink-0 hidden lg:block relative z-0",children:r.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto overscroll-contain",children:r.jsxs("div",{className:"space-y-2 pr-4",children:[r.jsxs(te,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(KS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(y4,{open:o,onOpenChange:c,children:[r.jsx(v4,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?r.jsx(Tu,{className:"h-4 w-4"}):r.jsx(Ka,{className:"h-4 w-4"})]})}),r.jsx(_4,{className:"space-y-1 pl-2",children:t.map(w=>r.jsxs(te,{variant:n===w.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(w.id),children:[r.jsx("span",{className:"mr-2",children:w.icon||"📂"}),r.jsx("span",{className:"truncate",children:w.name})]},w.id))})]}),e.length>0&&r.jsxs(y4,{open:a,onOpenChange:h,children:[r.jsx(v4,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Uf,{className:"h-3 w-3"}),"Your Groups"]}),a?r.jsx(Tu,{className:"h-4 w-4"}):r.jsx(Ka,{className:"h-4 w-4"})]})}),r.jsx(_4,{className:"space-y-1 pl-2",children:e.map(w=>r.jsxs(te,{variant:n===`group:${w.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${w.id}`),children:[r.jsx("span",{className:"mr-2",children:w.icon||"🔒"}),r.jsx("span",{className:"truncate",children:w.name})]},w.id))})]}),r.jsxs(y4,{open:m,onOpenChange:x,children:[r.jsx(v4,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(fs,{className:"h-3 w-3"}),"Online Now",i.length>0&&r.jsx("span",{className:"ml-1 bg-green-500 text-white text-xs rounded-full px-1.5 py-0.5 min-w-[20px] text-center",children:i.length})]}),m?r.jsx(Tu,{className:"h-4 w-4"}):r.jsx(Ka,{className:"h-4 w-4"})]})}),r.jsx(_4,{className:"pl-2 space-y-1",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):i.map(w=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Di,{className:"h-7 w-7",children:[r.jsx(Po,{src:w.avatarUrl}),r.jsx(Ri,{className:"text-xs",children:v(w.name)})]}),r.jsx(Au,{className:"h-2.5 w-2.5 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"text-sm truncate",children:w.name})]},w.id))})]})]})})})},Pgt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,c]=P.useState(!1),a=m=>m.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),h=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),v=e.find(w=>w.id===x);return v?`🔒 ${v.name}`:"Private Group"}const m=t.find(x=>x.id===n);return m?`${m.icon||"📂"} ${m.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:h()}),r.jsx(Tu,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(ep,{className:"w-56 bg-background border",children:[r.jsxs(co,{onClick:()=>s("all"),children:[r.jsx(KS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(oC,{}),r.jsx(ahe,{className:"text-xs text-muted-foreground",children:"Categories"}),t.map(m=>r.jsxs(co,{onClick:()=>s(m.id),children:[r.jsx("span",{className:"mr-2",children:m.icon||"📂"}),m.name]},m.id)),e.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(oC,{}),r.jsxs(ahe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Uf,{className:"h-3 w-3"}),"Your Groups"]}),e.map(m=>r.jsxs(co,{onClick:()=>s(`group:${m.id}`),children:[r.jsx("span",{className:"mr-2",children:m.icon||"🔒"}),m.name]},m.id))]})]})]}),r.jsxs(qne,{open:o,onOpenChange:c,children:[r.jsx(vge,{asChild:!0,children:r.jsxs(te,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(fs,{className:"h-4 w-4"}),i.length>0&&r.jsx("span",{className:"absolute -top-1 -right-1 bg-green-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:i.length})]})}),r.jsxs(uI,{children:[r.jsx(Vne,{children:r.jsxs(Hne,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),"Online Now (",i.length,")"]})}),r.jsx(_l,{className:"h-[calc(100vh-8rem)] mt-4",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No one else online right now"}):r.jsx("div",{className:"space-y-2",children:i.map(m=>r.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:m.avatarUrl}),r.jsx(Ri,{children:a(m.name)})]}),r.jsx(Au,{className:"h-3 w-3 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"font-medium",children:m.name})]},m.id))})})]})]})]})};var Kle,_se="HoverCard",[UDe]=Zl(_se,[Cg]),bse=Cg(),[Lgt,jxe]=UDe(_se),qDe=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:o,openDelay:c=700,closeDelay:a=300}=t,h=bse(e),m=P.useRef(0),x=P.useRef(0),v=P.useRef(!1),w=P.useRef(!1),[k,C]=Eu({prop:s,defaultProp:i??!1,onChange:o,caller:_se}),S=P.useCallback(()=>{clearTimeout(x.current),m.current=window.setTimeout(()=>C(!0),c)},[c,C]),T=P.useCallback(()=>{clearTimeout(m.current),!v.current&&!w.current&&(x.current=window.setTimeout(()=>C(!1),a))},[a,C]),I=P.useCallback(()=>C(!1),[C]);return P.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(x.current)},[]),r.jsx(Lgt,{scope:e,open:k,onOpenChange:C,onOpen:S,onClose:T,onDismiss:I,hasSelectionRef:v,isPointerDownOnContentRef:w,children:r.jsx(tI,{...h,children:n})})};qDe.displayName=_se;var VDe="HoverCardTrigger",HDe=P.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=jxe(VDe,n),o=bse(n);return r.jsx(KC,{asChild:!0,...o,children:r.jsx(Dn.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:an(t.onPointerEnter,xte(i.onOpen)),onPointerLeave:an(t.onPointerLeave,xte(i.onClose)),onFocus:an(t.onFocus,i.onOpen),onBlur:an(t.onBlur,i.onClose),onTouchStart:an(t.onTouchStart,c=>c.preventDefault())})})});HDe.displayName=VDe;var Ogt="HoverCardPortal",[iKt,Dgt]=UDe(Ogt,{forceMount:void 0}),gte="HoverCardContent",WDe=P.forwardRef((t,e)=>{const n=Dgt(gte,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,o=jxe(gte,t.__scopeHoverCard);return r.jsx(lc,{present:s||o.open,children:r.jsx(Rgt,{"data-state":o.open?"open":"closed",...i,onPointerEnter:an(t.onPointerEnter,xte(o.onOpen)),onPointerLeave:an(t.onPointerLeave,xte(o.onClose)),ref:e})})});WDe.displayName=gte;var Rgt=P.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:c,...a}=t,h=jxe(gte,n),m=bse(n),x=P.useRef(null),v=Xs(e,x),[w,k]=P.useState(!1);return P.useEffect(()=>{if(w){const C=document.body;return Kle=C.style.userSelect||C.style.webkitUserSelect,C.style.userSelect="none",C.style.webkitUserSelect="none",()=>{C.style.userSelect=Kle,C.style.webkitUserSelect=Kle}}},[w]),P.useEffect(()=>{if(x.current){const C=()=>{k(!1),h.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var T;((T=document.getSelection())==null?void 0:T.toString())!==""&&(h.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",C),()=>{document.removeEventListener("pointerup",C),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!1}}},[h.isPointerDownOnContentRef,h.hasSelectionRef]),P.useEffect(()=>{x.current&&Bgt(x.current).forEach(S=>S.setAttribute("tabindex","-1"))}),r.jsx(D1,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:an(o,C=>{C.preventDefault()}),onDismiss:h.onDismiss,children:r.jsx(rI,{...m,...a,onPointerDown:an(a.onPointerDown,C=>{C.currentTarget.contains(C.target)&&k(!0),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!0}),ref:v,style:{...a.style,userSelect:w?"text":void 0,WebkitUserSelect:w?"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)"}})})}),Fgt="HoverCardArrow",zgt=P.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=bse(n);return r.jsx(nI,{...i,...s,ref:e})});zgt.displayName=Fgt;function xte(t){return e=>e.pointerType==="touch"?void 0:t()}function Bgt(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var $gt=qDe,Ugt=HDe,GDe=WDe;const qgt=$gt,Vgt=Ugt,KDe=P.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},i)=>r.jsx(GDe,{ref:i,align:e,sideOffset:n,className:$t("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));KDe.displayName=GDe.displayName;const Hgt=[{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"}],Wgt=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),ZDe=({reactions:t,children:e})=>{if(t.length===0)return r.jsx(r.Fragment,{children:e});const n={};return t.forEach(s=>{n[s.reaction_type]||(n[s.reaction_type]=[]),n[s.reaction_type].push(s)}),r.jsxs(qgt,{openDelay:200,closeDelay:100,children:[r.jsx(Vgt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:e})}),r.jsx(KDe,{className:"w-64 p-3 bg-popover border shadow-lg z-50",side:"top",align:"start",children:r.jsx("div",{className:"space-y-3",children:Object.entries(n).map(([s,i])=>{const o=Hgt.find(c=>c.type===s);return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("span",{className:"text-lg",children:o==null?void 0:o.emoji}),r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o==null?void 0:o.label," (",i.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[i.slice(0,10).map(c=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Di,{className:"h-6 w-6",children:[r.jsx(Po,{src:c.user_avatar||void 0}),r.jsx(Ri,{className:"text-[10px]",children:Wgt(c.user_name||"U")})]}),r.jsx("span",{className:"text-sm text-foreground truncate",children:c.user_name||"Unknown User"})]},c.id)),i.length>10&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",i.length-10," more"]})]})]},s)})})})]})};function Ggt({images:t,initialIndex:e=0,open:n,onOpenChange:s}){const[i,o]=P.useState(e),[c,a]=P.useState(!1);P.useEffect(()=>{n&&(o(e),a(!1))},[n,e]);const h=()=>{o(w=>w>0?w-1:t.length-1),a(!1)},m=()=>{o(w=>w{n&&(w.key==="ArrowLeft"&&h(),w.key==="ArrowRight"&&m(),w.key==="Escape"&&s(!1))},[n,t.length]);P.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const v=t[i];return r.jsx(Ur,{open:n,onOpenChange:s,children:r.jsxs(Br,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>s(!1),children:r.jsx(Es,{className:"h-6 w-6"})}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:h,children:r.jsx(id,{className:"h-8 w-8"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:m,children:r.jsx(Ka,{className:"h-8 w-8"})})]}),t.length>1&&r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 text-white text-sm bg-black/50 px-3 py-1 rounded-full",children:[i+1," / ",t.length]}),(v==null?void 0:v.type)==="image"&&r.jsx(te,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>a(!c),children:c?r.jsx(u4,{className:"h-5 w-5"}):r.jsx(d4,{className:"h-5 w-5"})}),r.jsx("div",{className:$t("flex items-center justify-center w-full h-full min-h-[50vh] p-4",c?"cursor-zoom-out overflow-auto":"cursor-zoom-in"),onClick:()=>(v==null?void 0:v.type)==="image"&&a(!c),children:(v==null?void 0:v.type)==="video"?r.jsx("video",{src:v.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:w=>w.stopPropagation()}):r.jsx("img",{src:v==null?void 0:v.url,alt:"",className:$t("object-contain transition-transform duration-200",c?"max-w-none max-h-none scale-150":"max-w-full max-h-[85vh]")})}),t.length>1&&r.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 flex gap-2 bg-black/50 p-2 rounded-lg max-w-[90vw] overflow-x-auto",children:t.map((w,k)=>r.jsx("button",{onClick:()=>{o(k),a(!1)},className:$t("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",i===k?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:w.type==="video"?r.jsx("video",{src:w.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:w.url,alt:"",className:"w-full h-full object-cover"})},k))})]})})}const fL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],Kgt=({commentId:t,reactions:e,currentUserId:n})=>{var m,x;const s=Qr(),[i,o]=P.useState(!1),c=e.find(v=>v.user_id===n),a=dr({mutationFn:async v=>{c?c.reaction_type===v?await ee.from("community_comment_reactions").delete().eq("id",c.id):await ee.from("community_comment_reactions").update({reaction_type:v}).eq("id",c.id):await ee.from("community_comment_reactions").insert({comment_id:t,user_id:n,reaction_type:v})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),h={};return e.forEach(v=>{h[v.reaction_type]=(h[v.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.length>0&&r.jsx(ZDe,{reactions:e,children:r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(h).slice(0,2).map(v=>{var w;return r.jsx("span",{className:"text-sm",children:(w=fL.find(k=>k.type===v))==null?void 0:w.emoji},v)})}),r.jsx("span",{children:e.length})]})}),n&&r.jsxs(Jh,{open:i,onOpenChange:o,children:[r.jsx(ef,{asChild:!0,children:r.jsx("button",{className:`text-xs hover:text-primary transition-colors ${c?"text-primary font-medium":"text-muted-foreground"}`,children:c?r.jsxs("span",{children:[(m=fL.find(v=>v.type===c.reaction_type))==null?void 0:m.emoji," ",(x=fL.find(v=>v.type===c.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(gh,{className:"w-auto p-1.5 bg-popover border shadow-lg z-50",side:"top",children:r.jsx("div",{className:"flex gap-0.5",children:fL.map(v=>r.jsx("button",{onClick:()=>a.mutate(v.type),className:"text-xl hover:scale-125 transition-transform p-1",title:v.label,children:v.emoji},v.type))})})]})]})};function kxe({content:t,className:e}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let i=0,o,c=0;for(;(o=n.exec(t))!==null;){if(o.index>i&&s.push(t.substring(i,o.index)),o[1]){const a=o[1],h=o[2],m=o[3],x=a==="#";s.push(r.jsx(io,{to:x?`/templates/${m}`:`/profile?user=${m}`,className:$t("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:v=>v.stopPropagation(),children:x?h:`@${h}`},`mention-${c++}`))}else if(o[4]){const a=o[4],h=a.replace(/[.,;:!?)]+$/,""),m=a.slice(h.length);let x;try{const v=new URL(h);x=v.hostname+(v.pathname!=="/"?v.pathname.slice(0,20)+(v.pathname.length>20?"...":""):"")}catch{x=h.length>40?h.slice(0,40)+"...":h}s.push(r.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:v=>v.stopPropagation(),children:x},`url-${c++}`)),m&&s.push(m)}i=o.index+o[0].length}return ir.jsx(P.Fragment,{children:a},h))})}function yte({value:t,onChange:e,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:i="80px",onMentionsChange:o,onTemplatesChange:c,onKeyDown:a,mentionFormat:h="encoded",enableTemplateMentions:m=!1}){const x=P.useRef(null),v=P.useRef(null),[w,k]=P.useState(!1),[C,S]=P.useState("user"),[T,I]=P.useState(""),[A,D]=P.useState(null),[$,F]=P.useState(0),[q,W]=P.useState({top:0,left:0,width:0}),K=P.useRef(new Map),Z=P.useRef(new Map),re=oe=>{if(h==="plain"){const Be=[];return K.current.forEach((Qe,Fe)=>{oe.includes(`@${Fe}`)&&Be.push(Qe)}),[...new Set(Be)]}const ae=/@\[([^\]]+)\]\(([^)]+)\)/g,Ne=[];let Te;for(;(Te=ae.exec(oe))!==null;)Ne.push(Te[2]);return[...new Set(Ne)]},he=oe=>{if(h==="plain"){const Be=[];return Z.current.forEach((Qe,Fe)=>{oe.includes(`#${Fe}`)&&Be.push(Qe)}),[...new Set(Be)]}const ae=/#\[([^\]]+)\]\(([^)]+)\)/g,Ne=[];let Te;for(;(Te=ae.exec(oe))!==null;)Ne.push(Te[2]);return[...new Set(Ne)]};P.useEffect(()=>{if(o){const oe=re(t);o(oe)}if(c){const oe=he(t);c(oe)}},[t,o,c,h]);const{data:ue=[],isLoading:je}=rr({queryKey:["mention-users",T],queryFn:async()=>{const oe=ee.from("profiles").select("id, name").limit(8),ae=T.length>=1?oe.ilike("name",`%${T}%`):oe.order("name"),{data:Ne,error:Te}=await ae;if(Te)throw Te;const Be=Ne.map(Qe=>Qe.id),Le=await t6e(Be);return Ne.map(Qe=>({id:Qe.id,name:Qe.name||"Unknown",avatar_url:Le.get(Qe.id)}))},enabled:w&&C==="user",staleTime:3e4}),{data:ne=[],isLoading:ye}=rr({queryKey:["mention-templates",T],queryFn:async()=>{let oe=ee.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);T.length>=1&&(oe=oe.ilike("name",`%${T}%`));const{data:ae,error:Ne}=await oe;if(Ne)throw Ne;return ae||[]},enabled:w&&C==="template"&&m,staleTime:3e4}),ie=C==="user"?je:ye,me=C==="user"?ue:ne,fe=oe=>oe.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),ve=oe=>{const ae=oe.target.value,Ne=oe.target.selectionStart;e(ae);const Te=ae.substring(0,Ne),Be=Te.lastIndexOf("@"),Le=m?Te.lastIndexOf("#"):-1;let Qe=-1,Fe="user";if(Be>Le?(Qe=Be,Fe="user"):Le>Be&&m&&(Qe=Le,Fe="template"),Qe!==-1){const Ce=Te.substring(Qe+1),Je=Ce.includes(" "),Ae=Ce.includes(` `);if(!Je&&!Ae&&Ce.length<=30){D(Qe),I(Ce),S(Fe),k(!0),F(0);return}}k(!1),D(null)},Ie=oe=>{if(A===null)return;const ae=t.substring(0,A),Ne=t.substring(A+T.length+1),Te=C==="user"?"@":"#",Be=h==="plain"?`${Te}${oe.name} `:`${Te}[${oe.name}](${oe.id}) `;h==="plain"&&(C==="user"?K.current.set(oe.name,oe.id):Z.current.set(oe.name,oe.id));const Le=ae+Be+Ne;e(Le),k(!1),D(null),I(""),setTimeout(()=>{if(x.current){const Qe=ae.length+Be.length;x.current.focus(),x.current.setSelectionRange(Qe,Qe)}},0)},Se=oe=>{if(!(!w||me.length===0))switch(oe.key){case"ArrowDown":oe.preventDefault(),F(ae=>(ae+1)%me.length);break;case"ArrowUp":oe.preventDefault(),F(ae=>(ae-1+me.length)%me.length);break;case"Enter":me[$]&&(oe.preventDefault(),Ie(me[$]));break;case"Escape":oe.preventDefault(),k(!1);break;case"Tab":me[$]&&(oe.preventDefault(),Ie(me[$]));break}};return P.useEffect(()=>{const oe=ae=>{v.current&&!v.current.contains(ae.target)&&x.current&&!x.current.contains(ae.target)&&k(!1)};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]),P.useEffect(()=>{if(!w)return;const oe=()=>{const ae=x.current;if(!ae)return;const Ne=ae.getBoundingClientRect();W({top:Ne.bottom+4,left:Ne.left,width:Ne.width})};return oe(),window.addEventListener("resize",oe),window.addEventListener("scroll",oe,!0),()=>{window.removeEventListener("resize",oe),window.removeEventListener("scroll",oe,!0)}},[w,t]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(gs,{ref:x,value:t,onChange:ve,onKeyDown:oe=>{Se(oe),oe.defaultPrevented||a==null||a(oe)},placeholder:n,className:$t("resize-none",s),style:{minHeight:i}}),w&&ny.createPortal(r.jsxs("div",{ref:v,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:q.top,left:q.left,width:q.width,maxWidth:"320px"},children:[r.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:C==="user"?"👤 Mention a person":"📋 Link a template"}),ie?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):me.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:T.length<1?`Type to search ${C==="user"?"people":"templates"}...`:`No ${C==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:me.map((oe,ae)=>r.jsx("li",{className:$t("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",ae===$?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ie(oe),onMouseEnter:()=>F(ae),children:C==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Di,{className:"h-6 w-6",children:[r.jsx(Po,{src:oe.avatar_url}),r.jsx(Ri,{className:"text-xs",children:fe(oe.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:oe.name})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center overflow-hidden flex-shrink-0",children:oe.preview_image_url?r.jsx("img",{src:oe.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(Yd,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:oe.name})]})},oe.id))})]}),document.body)]})}function Zgt(t){const e=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=e.exec(t))!==null;)n.push(s[2]);return[...new Set(n)]}const gke=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2);function YDe({comment:t,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:c=0}){const a=Qr(),[h,m]=P.useState(!1),[x,v]=P.useState(""),[w,k]=P.useState([]),C=dr({mutationFn:async({content:A,parentCommentId:D})=>{const{data:$,error:F}=await ee.from("community_comments").insert({post_id:e,user_id:n,content:A,parent_comment_id:D}).select("id").single();if(F)throw F;const q=w;if(q.length>0&&$){const W=q.filter(K=>K!==n).map(K=>({comment_id:$.id,mentioned_user_id:K,mentioned_by_user_id:n}));W.length>0&&await ee.from("community_comment_mentions").insert(W)}},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),v(""),k([]),m(!1)}}),S=dr({mutationFn:async A=>{const{error:D}=await ee.from("community_comments").delete().eq("id",A);if(D)throw D},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),T=()=>{x.trim()&&C.mutate({content:x,parentCommentId:t.id})};return r.jsxs("div",{className:c>0?"ml-8 border-l-2 border-muted pl-3":"",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Di,{className:"h-8 w-8 shrink-0",children:[r.jsx(Po,{src:t.user_avatar||void 0}),r.jsx(Ri,{className:"text-xs",children:gke(t.user_name||"U")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"bg-muted rounded-lg px-3 py-2",children:[r.jsx("div",{className:"font-medium text-sm",children:t.user_name}),r.jsx(kxe,{content:t.content,className:"text-sm break-words"})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground flex-wrap",children:[r.jsx("span",{children:Qd(new Date(t.created_at),{addSuffix:!0})}),r.jsx(Kgt,{commentId:t.id,reactions:t.reactions,currentUserId:n}),n&&c<2&&r.jsxs("button",{onClick:()=>m(!h),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(LT,{className:"h-3 w-3"}),"Reply"]}),(t.user_id===n||o)&&r.jsx("button",{onClick:()=>S.mutate(t.id),className:"hover:text-destructive",children:t.user_id!==n?"Remove":"Delete"})]}),h&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Di,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Po,{src:s||void 0}),r.jsx(Ri,{className:"text-xs",children:gke((i==null?void 0:i.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(yte,{placeholder:`Reply to ${t.user_name}...`,value:x,onChange:v,onMentionsChange:k,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(te,{size:"sm",variant:"ghost",onClick:T,disabled:!x.trim()||C.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(To,{className:"h-3 w-3"})})]})]})]})]}),t.replies&&t.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:t.replies.map(A=>r.jsx(YDe,{comment:A,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:c+1},A.id))})]})}const pL=[{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"}],Ygt=()=>{const{user:t,isBrokerageManager:e,managedBrokerages:n,isAdmin:s}=zr(),{avatarUrl:i}=xge(t==null?void 0:t.id),{onlineUsers:o}=BOe(),{toast:c}=ua(),a=Qr(),h=P.useRef(null),[m,x]=P.useState("all"),[v,w]=P.useState(""),[k,C]=P.useState(""),[S,T]=P.useState(""),[I,A]=P.useState([]),[D,$]=P.useState([]),[F,q]=P.useState(""),[W,K]=P.useState(!1),[Z,re]=P.useState(null),[he,ue]=P.useState(""),[je,ne]=P.useState(new Set),[ye,ie]=P.useState({}),[me,fe]=P.useState({}),[ve,Ie]=P.useState([]),[Se,oe]=P.useState([]),[ae,Ne]=P.useState({open:!1,images:[],index:0});P.useEffect(()=>{if(m.startsWith("group:")){const kt=m.replace("group:","");T(kt),C("")}else m!=="all"?(C(m),T("")):(C(""),T(""))},[m]);const{data:Te=[]}=rr({queryKey:["community-categories"],queryFn:async()=>{const{data:kt,error:sr}=await ee.from("community_categories").select("*").order("sort_order");if(sr)throw sr;return kt}}),{data:Be=[]}=rr({queryKey:["community-private-groups"],queryFn:async()=>{const{data:kt,error:sr}=await ee.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(sr)throw sr;return kt}}),Le=20,{data:Qe,isLoading:Fe,hasNextPage:Ce,fetchNextPage:Je,isFetchingNextPage:Ae}=bQe({queryKey:["community-posts",m],initialPageParam:0,queryFn:async({pageParam:kt})=>{var De;const sr=kt*Le,Pr=sr+Le;let wn=ee.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(sr,Pr);if(m.startsWith("group:")){const We=m.replace("group:","");wn=wn.eq("private_group_id",We)}else m==="all"||(wn=wn.eq("category_id",m).is("private_group_id",null));const{data:kn,error:pn}=await wn;if(pn)throw pn;const qn=((kn==null?void 0:kn.length)||0)>Le,Fs=(kn||[]).slice(0,Le);if(Fs.length===0)return{posts:[],hasMore:!1,nextPage:kt+1};const _r=Fs.map(We=>We.id),js=[...new Set(Fs.filter(We=>We.category_id).map(We=>We.category_id))].filter(Boolean),[Ii,fi,Aa,ca,Yo]=await Promise.all([js.length?ee.from("community_categories").select("*").in("id",js):Promise.resolve({data:[]}),ee.from("community_post_media").select("*").in("post_id",_r).order("sort_order"),ee.from("community_reactions").select("*").in("post_id",_r),ee.from("community_comments").select("*").in("post_id",_r).order("created_at",{ascending:!0}),ee.from("community_post_resources").select("*").in("post_id",_r)]),Xo=Ii==null?void 0:Ii.data,Hs=fi==null?void 0:fi.data,Ki=Aa==null?void 0:Aa.data,bs=ca==null?void 0:ca.data,Ci=Yo==null?void 0:Yo.data,Mi=(bs||[]).map(We=>We.id),[Eo,ir]=await Promise.all([Mi.length?ee.from("community_comment_reactions").select("*").in("comment_id",Mi):Promise.resolve({data:[]}),(()=>{const We=(Ci||[]).filter(vt=>vt.resource_type==="template").map(vt=>vt.resource_id);return We.length===0?Promise.resolve({data:[]}):ee.from("canva_templates").select("id, name, preview_image_url").in("id",We)})()]),ho=(Eo==null?void 0:Eo.data)||[],Nc=(ir==null?void 0:ir.data)||[],fo=new Map(Nc.map(We=>[We.id,{name:We.name,preview_image_url:We.preview_image_url}])),rs=Array.from(new Set([...Fs.map(We=>We.user_id),...(Ki||[]).map(We=>We.user_id),...(bs||[]).map(We=>We.user_id),...ho.map(We=>We.user_id)])),[po,Od]=await Promise.all([rs.length?ee.from("profiles").select("id, name").in("id",rs):Promise.resolve({data:[]}),t6e(rs)]),vr=new Map(((De=po==null?void 0:po.data)==null?void 0:De.map(We=>[We.id,We.name]))||[]),Vn=new Map((Xo||[]).map(We=>[We.id,We])),bt=We=>{const vt=new Map,gt=[];return We.forEach(Ct=>{vt.set(Ct.id,{...Ct,user_name:vr.get(Ct.user_id)||"Unknown User",user_avatar:Od.get(Ct.user_id),reactions:ho.filter(Bt=>Bt.comment_id===Ct.id).map(Bt=>({...Bt,user_name:vr.get(Bt.user_id)||"Unknown User",user_avatar:Od.get(Bt.user_id)})),replies:[]})}),We.forEach(Ct=>{const Bt=vt.get(Ct.id);if(Ct.parent_comment_id&&vt.has(Ct.parent_comment_id)){const At=vt.get(Ct.parent_comment_id);At.replies=At.replies||[],At.replies.push(Bt)}else gt.push(Bt)}),gt};return{posts:Fs.map(We=>{const vt=(Ci||[]).filter(gt=>gt.post_id===We.id).map(gt=>{let Ct="",Bt=null;if(gt.resource_type==="template"){const At=fo.get(gt.resource_id);Ct=(At==null?void 0:At.name)||"Unknown Template",Bt=(At==null?void 0:At.preview_image_url)||null}return{id:gt.id,resource_type:gt.resource_type,resource_id:gt.resource_id,resource_name:Ct,resource_preview_url:Bt}});return{...We,user_name:vr.get(We.user_id)||"Unknown User",user_avatar:Od.get(We.user_id),category:We.category_id?Vn.get(We.category_id):null,media:(Hs||[]).filter(gt=>gt.post_id===We.id),reactions:((Ki||[]).filter(gt=>gt.post_id===We.id)||[]).map(gt=>({...gt,user_name:vr.get(gt.user_id)||"Unknown User",user_avatar:Od.get(gt.user_id)})),comments:bt((bs||[]).filter(gt=>gt.post_id===We.id)),resources:vt}}),hasMore:qn,nextPage:kt+1}},getNextPageParam:kt=>kt.hasMore?kt.nextPage:void 0}),Ye=P.useMemo(()=>(Qe==null?void 0:Qe.pages.flatMap(kt=>kt.posts))??[],[Qe]),ge=dr({mutationFn:async()=>{K(!0);const{data:kt,error:sr}=await ee.from("community_posts").insert({user_id:t.id,category_id:S?null:k||null,private_group_id:S||null,content:v,link_url:F||null}).select().single();if(sr)throw sr;for(let wn=0;wn0){const wn=ve.filter(kn=>kn!==t.id).map(kn=>({post_id:kt.id,mentioned_user_id:kn,mentioned_by_user_id:t.id}));wn.length>0&&await ee.from("community_post_mentions").insert(wn)}const Pr=Zgt(v);if(Pr.length>0){const wn=Pr.map(kn=>({post_id:kt.id,resource_type:"template",resource_id:kn}));await ee.from("community_post_resources").insert(wn)}return kt},onSuccess:async kt=>{var sr;a.invalidateQueries({queryKey:["community-posts"]}),w(""),Ie([]),oe([]),C(""),T(""),A([]),$([]),q(""),c({title:"Post created!"});try{const Pr=((sr=t==null?void 0:t.user_metadata)==null?void 0:sr.name)||"Someone",wn=v.length>50?v.substring(0,50)+"...":v;await ee.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Pr}: ${wn}`,url:"/community"}})}catch(Pr){console.error("Failed to send push notification:",Pr)}},onError:kt=>{c({title:"Error creating post",description:kt.message,variant:"destructive"})},onSettled:()=>K(!1)}),ft=dr({mutationFn:async({postId:kt,content:sr})=>{const{error:Pr}=await ee.from("community_posts").update({content:sr}).eq("id",kt);if(Pr)throw Pr},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),re(null),ue(""),c({title:"Post updated!"})}}),nt=dr({mutationFn:async kt=>{const{error:sr}=await ee.from("community_posts").delete().eq("id",kt);if(sr)throw sr},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),c({title:"Post deleted"})}}),Ve=dr({mutationFn:async({postId:kt,isPinned:sr})=>{const{error:Pr}=await ee.from("community_posts").update({is_pinned:!sr,pinned_at:sr?null:new Date().toISOString(),pinned_by:sr?null:t==null?void 0:t.id}).eq("id",kt);if(Pr)throw Pr},onSuccess:(kt,{isPinned:sr})=>{a.invalidateQueries({queryKey:["community-posts"]}),c({title:sr?"Post unpinned":"Post pinned to top"})}}),Me=dr({mutationFn:async({postId:kt,reactionType:sr})=>{var wn;const Pr=(wn=Ye.find(kn=>kn.id===kt))==null?void 0:wn.reactions.find(kn=>kn.user_id===(t==null?void 0:t.id));Pr?Pr.reaction_type===sr?await ee.from("community_reactions").delete().eq("id",Pr.id):await ee.from("community_reactions").update({reaction_type:sr}).eq("id",Pr.id):await ee.from("community_reactions").insert({post_id:kt,user_id:t.id,reaction_type:sr})},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),rt=dr({mutationFn:async({postId:kt,content:sr})=>{const{data:Pr,error:wn}=await ee.from("community_comments").insert({post_id:kt,user_id:t.id,content:sr}).select("id").single();if(wn)throw wn;const kn=me[kt]||[];if(kn.length>0&&Pr){const pn=kn.filter(qn=>qn!==t.id).map(qn=>({comment_id:Pr.id,mentioned_user_id:qn,mentioned_by_user_id:t.id}));pn.length>0&&await ee.from("community_comment_mentions").insert(pn)}},onSuccess:(kt,{postId:sr})=>{a.invalidateQueries({queryKey:["community-posts"]}),ie(Pr=>({...Pr,[sr]:""})),fe(Pr=>({...Pr,[sr]:[]}))}});dr({mutationFn:async kt=>{const{error:sr}=await ee.from("community_comments").delete().eq("id",kt);if(sr)throw sr},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})});const Re=kt=>{const sr=Array.from(kt.target.files||[]);if(sr.length+I.length>10){c({title:"Maximum 10 files allowed",variant:"destructive"});return}A(Pr=>[...Pr,...sr]),sr.forEach(Pr=>{const wn=new FileReader;wn.onloadend=()=>{$(kn=>[...kn,wn.result])},wn.readAsDataURL(Pr)})},Ge=kt=>{A(sr=>sr.filter((Pr,wn)=>wn!==kt)),$(sr=>sr.filter((Pr,wn)=>wn!==kt))},tt=kt=>kt.split(" ").map(sr=>sr[0]).join("").toUpperCase().slice(0,2),Et=kt=>{const sr={};return kt.forEach(Pr=>{sr[Pr.reaction_type]=(sr[Pr.reaction_type]||0)+1}),sr},Lt=kt=>{var sr;return(sr=kt.find(Pr=>Pr.user_id===(t==null?void 0:t.id)))==null?void 0:sr.reaction_type},Ot=kt=>kt.reduce((sr,Pr)=>sr+1+(Pr.replies?Ot(Pr.replies):0),0),Dt=kt=>{if(s)return!0;if(!e||!kt.private_group_id)return!1;const sr=Be.find(Pr=>Pr.id===kt.private_group_id);return sr!=null&&sr.brokerage_id?n.some(Pr=>Pr.id===sr.brokerage_id):!1};return r.jsx(Dr,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(Igt,{categories:Te,privateGroups:Be,selectedFilter:m,onFilterChange:x,onlineUsers:o}),r.jsxs("div",{className:"flex-1 min-w-0 max-w-2xl mx-auto lg:mx-0 space-y-6",children:[r.jsxs("div",{className:"px-1",children:[r.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-foreground",children:"Community"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect and share with fellow agents"})]}),r.jsx(Pgt,{categories:Te,privateGroups:Be,selectedFilter:m,onFilterChange:x,onlineUsers:o}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:i||void 0}),r.jsx(Ri,{children:t!=null&&t.email?tt(t.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(yte,{placeholder:s?"What's on your mind? Use @ to mention someone, # to link a template":"What's on your mind? Use @ to mention someone",value:v,onChange:w,onMentionsChange:Ie,onTemplatesChange:oe,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),D.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:D.map((kt,sr)=>{var Pr;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Pr=I[sr])!=null&&Pr.type.startsWith("video/")?r.jsx("video",{src:kt,className:"w-full h-full object-cover"}):r.jsx("img",{src:kt,alt:"",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Ge(sr),children:r.jsx(Es,{className:"h-3 w-3"})})]},sr)})}),F&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(xt,{value:F,onChange:kt=>q(kt.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>q(""),children:r.jsx(Es,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("input",{type:"file",ref:h,onChange:Re,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>{var kt;return(kt=h.current)==null?void 0:kt.click()},children:[r.jsx(Wo,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>{var kt;return(kt=h.current)==null?void 0:kt.click()},children:[r.jsx(Wi,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>q("https://"),children:[r.jsx(bo,{className:"h-4 w-4 mr-1"}),"Link"]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[Be.length>0?r.jsxs(_n,{value:S||k||"none",onValueChange:kt=>{kt==="none"?(C(""),T("")):kt.startsWith("group:")?(T(kt.replace("group:","")),C("")):(C(kt),T(""))},children:[r.jsx(yn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(bn,{placeholder:"Select..."})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"No category"}),Te.map(kt=>r.jsxs(tr,{value:kt.id,children:[kt.icon," ",kt.name]},kt.id)),Be.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground border-t mt-1 pt-1",children:"🔒 Private Groups"}),Be.map(kt=>r.jsxs(tr,{value:`group:${kt.id}`,children:[kt.icon||"🔒"," ",kt.name]},kt.id))]})]})]}):r.jsxs(_n,{value:k,onValueChange:C,children:[r.jsx(yn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(bn,{placeholder:"Category"})}),r.jsx(vn,{children:Te.map(kt=>r.jsxs(tr,{value:kt.id,children:[kt.icon," ",kt.name]},kt.id))})]}),r.jsxs(te,{size:"sm",onClick:()=>ge.mutate(),disabled:!v.trim()||W,children:[r.jsx(To,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Fe?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((kt,sr)=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Kr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Kr,{className:"h-4 w-32"}),r.jsx(Kr,{className:"h-4 w-full"}),r.jsx(Kr,{className:"h-4 w-3/4"})]})]})})},sr))}):Ye.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Wl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No posts yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Be the first to start a conversation!"})]})}):r.jsxs("div",{className:"space-y-4",children:[Ye.map(kt=>{var sr,Pr,wn,kn;return r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:kt.user_avatar||void 0}),r.jsx(Ri,{children:tt(kt.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:kt.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:Qd(new Date(kt.created_at),{addSuffix:!0})}),kt.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:[kt.category.icon," ",kt.category.name]})]})]})]})]}),(kt.user_id===(t==null?void 0:t.id)||Dt(kt))&&r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(Jm,{className:"h-4 w-4"})})}),r.jsxs(ep,{align:"end",children:[Dt(kt)&&kt.private_group_id&&r.jsx(co,{onClick:()=>Ve.mutate({postId:kt.id,isPinned:kt.is_pinned}),children:kt.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(PT,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(i1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),kt.user_id===(t==null?void 0:t.id)&&r.jsxs(co,{onClick:()=>{re(kt),ue(kt.content)},children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(co,{className:"text-destructive",onClick:()=>nt.mutate(kt.id),children:[r.jsx(es,{className:"h-4 w-4 mr-2"}),kt.user_id!==(t==null?void 0:t.id)?"Remove (Moderate)":"Delete"]})]})]})]}),kt.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(i1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(kxe,{content:kt.content})}),kt.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${kt.media.length===1?"grid-cols-1":kt.media.length===2?"grid-cols-2":kt.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:kt.media.slice(0,4).map((pn,qn)=>{const Fs=qn===3&&kt.media.length>4,_r=kt.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${kt.media.length===1?"max-h-[500px]":kt.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>Ne({open:!0,images:kt.media.map(js=>({url:js.media_url,type:js.media_type==="video"?"video":"image"})),index:qn}),children:[pn.media_type==="video"?r.jsx("video",{src:pn.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:pn.media_url,alt:"",className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-white",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})})})}),Fs&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsxs("span",{className:"text-white text-2xl font-bold",children:["+",_r]})})]},pn.id)})}),kt.link_url&&r.jsxs("a",{href:kt.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[kt.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:kt.link_image,alt:kt.link_title||"Link preview",className:"w-full h-full object-cover",onError:pn=>{pn.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:kt.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:kt.link_title}),kt.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:kt.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(kt.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(bo,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:kt.link_url})]})})]}),kt.reactions.length>0&&r.jsx(ZDe,{reactions:kt.reactions,children:r.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[r.jsx("div",{className:"flex -space-x-1",children:Object.entries(Et(kt.reactions)).slice(0,3).map(([pn])=>{var qn;return r.jsx("span",{className:"text-base",children:(qn=pL.find(Fs=>Fs.type===pn))==null?void 0:qn.emoji},pn)})}),r.jsx("span",{children:kt.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"ghost",size:"sm",className:"flex-1",children:[Lt(kt.reactions)?r.jsx("span",{className:"mr-1",children:(sr=pL.find(pn=>pn.type===Lt(kt.reactions)))==null?void 0:sr.emoji}):r.jsx(Ad,{className:"h-4 w-4 mr-1"}),Lt(kt.reactions)?(Pr=pL.find(pn=>pn.type===Lt(kt.reactions)))==null?void 0:Pr.label:"Like"]})}),r.jsx(gh,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:pL.map(pn=>r.jsx("button",{onClick:()=>Me.mutate({postId:kt.id,reactionType:pn.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:pn.label,children:pn.emoji},pn.type))})})]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ne(pn=>{const qn=new Set(pn);return qn.has(kt.id)?qn.delete(kt.id):qn.add(kt.id),qn}),children:[r.jsx(Wl,{className:"h-4 w-4 mr-1"}),(()=>{const pn=Ot(kt.comments);return pn>0?`Comment (${pn})`:"Comment"})()]})]}),je.has(kt.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[kt.comments.map(pn=>r.jsx(YDe,{comment:pn,postId:kt.id,currentUserId:t==null?void 0:t.id,currentUserAvatar:i,currentUserEmail:t==null?void 0:t.email,canModerate:Dt(kt)},pn.id)),t&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Di,{className:"h-8 w-8",children:[r.jsx(Po,{src:i||void 0}),r.jsx(Ri,{className:"text-xs",children:tt(((wn=t.email)==null?void 0:wn.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(yte,{placeholder:"Write a comment... (use @ to mention)",value:ye[kt.id]||"",onChange:pn=>ie(qn=>({...qn,[kt.id]:pn})),onMentionsChange:pn=>fe(qn=>({...qn,[kt.id]:pn})),mentionFormat:"plain",onKeyDown:pn=>{var qn;pn.defaultPrevented||pn.key==="Enter"&&!pn.shiftKey&&((qn=ye[kt.id])!=null&&qn.trim())&&(pn.preventDefault(),rt.mutate({postId:kt.id,content:ye[kt.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{var pn;(pn=ye[kt.id])!=null&&pn.trim()&&rt.mutate({postId:kt.id,content:ye[kt.id]})},disabled:!((kn=ye[kt.id])!=null&&kn.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(To,{className:"h-4 w-4"})})]})]})]})]})},kt.id)}),Ce&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(te,{variant:"outline",onClick:()=>Je(),disabled:Ae,children:Ae?"Loading…":"Load more posts"})})]}),r.jsx(Ur,{open:!!Z,onOpenChange:()=>re(null),children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Edit Post"})}),r.jsx(gs,{value:he,onChange:kt=>ue(kt.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>re(null),children:"Cancel"}),r.jsx(te,{onClick:()=>{Z&&ft.mutate({postId:Z.id,content:he})},disabled:!he.trim(),children:"Save Changes"})]})]})}),r.jsx(Ggt,{images:ae.images,initialIndex:ae.index,open:ae.open,onOpenChange:kt=>Ne(sr=>({...sr,open:kt}))})]})]})})},JN={open:{label:"Open",icon:Gi,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Wl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Ba,color:"bg-green-500"},closed:{label:"Closed",icon:Oc,color:"bg-muted-foreground"}},xke={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Xgt(){const{user:t}=zr(),e=Qr(),[n,s]=P.useState(null),[i,o]=P.useState(""),{data:c=[],isLoading:a}=rr({queryKey:["support-tickets"],queryFn:async()=>{const{data:v,error:w}=await ee.from("support_tickets").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(w)throw w;return v},enabled:!!t}),{data:h=[]}=rr({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:v,error:w}=await ee.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(w)throw w;return v},enabled:!!n}),m=dr({mutationFn:async v=>{if(!n||!t)throw new Error("Missing data");const{error:w}=await ee.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:v,is_admin_reply:!1});if(w)throw w},onSuccess:()=>{e.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),He.success("Reply sent!")},onError:()=>{He.error("Failed to send reply")}}),x=()=>{i.trim()&&m.mutate(i)};if(n){const v=JN[n.status].icon;return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Ga,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ft,{variant:"secondary",children:xke[n.category]}),r.jsxs(Ft,{className:JN[n.status].color,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),JN[n.status].label]})]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(In,{children:["Created on ",un(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(_l,{className:"h-[300px] pr-4",children:h.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:h.map(w=>{var k;return r.jsxs("div",{className:`p-4 rounded-lg ${w.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:w.is_admin_reply?"Support Team":((k=w.profiles)==null?void 0:k.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(w.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:w.content})]},w.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(Gd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(gs,{placeholder:"Type your reply...",value:i,onChange:w=>o(w.target.value),className:"min-h-[80px]"}),r.jsx(te,{onClick:x,disabled:!i.trim()||m.isPending,className:"self-end",children:r.jsx(To,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ze,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(et,{className:"p-6 sm:p-8",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[r.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:r.jsx(xx,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Need Help?"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Submit a support ticket and our team will get back to you as soon as possible."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(lhe,{trigger:r.jsxs(te,{size:"lg",className:"gap-2",children:[r.jsx(Mn,{className:"h-5 w-5"}),"Submit a Ticket"]})}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted rounded-lg",children:[r.jsx(Ma,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Or text us: ",r.jsx("span",{className:"font-semibold text-foreground",children:"1-866-527-8668"})]})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Your Tickets"}),r.jsx(lhe,{trigger:r.jsxs(te,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"New Ticket"]})})]}),a?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):c.length===0?r.jsx(Ze,{className:"border-dashed",children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Wl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets yet"}),r.jsx("p",{className:"text-muted-foreground",children:"You haven't submitted any support tickets. Use the button above to get started!"})]})}):r.jsx("div",{className:"space-y-3",children:c.map(v=>{const w=JN[v.status].icon;return r.jsx(Ze,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(v),children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:v.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ft,{variant:"outline",className:"text-xs",children:xke[v.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(v.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Ft,{className:JN[v.status].color,children:[r.jsx(w,{className:"h-3 w-3 mr-1"}),JN[v.status].label]})]})})},v.id)})})]})})}function Qgt({open:t,onOpenChange:e}){return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Yr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(li,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zr,{children:"Schedule Agent Onboarding"}),r.jsx(us,{children:"Book a one-on-one onboarding session with LevelUp"})]})]})}),t&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/new-agent-onboarding",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Agent Onboarding"})]})})}function Jgt({open:t,onOpenChange:e}){const{brokerageId:n}=zr(),[s,i]=P.useState(""),[o,c]=P.useState([]),[a,h]=P.useState(!1),{data:m,isLoading:x}=rr({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:S,error:T}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(T)throw T;return S},enabled:t&&!!n}),v=m==null?void 0:m.filter(S=>S.name.toLowerCase().includes(s.toLowerCase())||S.email.toLowerCase().includes(s.toLowerCase())),w=S=>{c(T=>T.includes(S)?T.filter(I=>I!==S):[...T,S])},k=async()=>{if(o.length===0){He.error("Please select at least one agent");return}h(!0);try{const{data:S,error:T}=await ee.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(T)throw T;He.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),c([]),e(!1)}catch(S){console.error("Error sending onboarding link:",S),He.error(S.message||"Failed to send onboarding link")}finally{h(!1)}},C=S=>{S||(c([]),i("")),e(S)};return r.jsx(Ur,{open:t,onOpenChange:C,children:r.jsxs(Br,{className:"max-w-md",children:[r.jsx(Yr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(To,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zr,{children:"Send Onboarding Link"}),r.jsx(us,{children:"Select agents to receive the onboarding booking link"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search agents...",value:s,onChange:S=>i(S.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(v==null?void 0:v.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(fs,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(_l,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:v==null?void 0:v.map(S=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>w(S.id),children:[r.jsx(vc,{checked:o.includes(S.id),onCheckedChange:()=>w(S.id)}),r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{className:"text-xs",children:S.name.split(" ").map(T=>T[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:S.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.email})]})]},S.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(te,{onClick:k,disabled:o.length===0||a,children:a?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function ext(){const[t,e]=P.useState(!1),[n,s]=P.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{className:"mb-8",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(fs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{children:"Agent Onboarding"}),r.jsx(In,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(te,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(te,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(To,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(Qgt,{open:t,onOpenChange:e}),r.jsx(Jgt,{open:n,onOpenChange:s})]})}function txt({open:t,onOpenChange:e}){return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Yr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(ug,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zr,{children:"Schedule Launch Meeting"}),r.jsx(us,{children:"Book a private LevelUp information session for your brokerage"})]})]})}),t&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/levelup-launch-call",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Launch Meeting"})]})})}function rxt(){const[t,e]=P.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{className:"mb-8",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(ug,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{children:"Launch or ReLaunch Meeting"}),r.jsx(In,{children:"Schedule a private LevelUp information session for your brokerage. Have one of our staff host a meeting to help your team get the most out of all our trainings, tools, and resources."})]})]})}),r.jsx(et,{children:r.jsxs(te,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(ug,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(txt,{open:t,onOpenChange:e})]})}function nxt(){const t=ts(),[e,n]=P.useState(""),[s,i]=P.useState(null),{data:o,isLoading:c}=rr({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(T)throw T;return S}}),{data:a}=rr({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(T)throw T;return S}}),{data:h}=rr({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_pdfs").select("resource_id");if(T)throw T;return S}}),{data:m}=rr({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_videos").select("resource_id");if(T)throw T;return S}}),{data:x}=rr({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:S,error:T}=await ee.from("brokerage_resource_links").select("resource_id");if(T)throw T;return S}}),v=o==null?void 0:o.filter(S=>{var A;const T=S.title.toLowerCase().includes(e.toLowerCase())||((A=S.description)==null?void 0:A.toLowerCase().includes(e.toLowerCase())),I=!s||S.category_id===s;return T&&I}),w=a==null?void 0:a.filter(S=>o==null?void 0:o.some(T=>T.category_id===S.id)),k=S=>{const T=(h==null?void 0:h.filter(D=>D.resource_id===S).length)||0,I=(m==null?void 0:m.filter(D=>D.resource_id===S).length)||0,A=(x==null?void 0:x.filter(D=>D.resource_id===S).length)||0;return{pdfCount:T,videoCount:I,linkCount:A}},C=S=>{t(`/brokerage-resources/${S}`)};return r.jsx(Dr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(ext,{}),r.jsx(rxt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search resources...",value:e,onChange:S=>n(S.target.value),className:"pl-10"})]}),w&&w.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Ft,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>i(null),children:"All"}),w.map(S=>r.jsx(Ft,{variant:s===S.id?"default":"outline",className:"cursor-pointer",onClick:()=>i(S.id),children:S.name},S.id))]}),!c&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(v==null?void 0:v.length)||0," resource",(v==null?void 0:v.length)!==1?"s":""," available"]}),c?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((S,T)=>r.jsxs(Ze,{children:[r.jsx(Kr,{className:"h-40 w-full"}),r.jsx(Wt,{children:r.jsx(Kr,{className:"h-5 w-3/4"})}),r.jsxs(et,{children:[r.jsx(Kr,{className:"h-4 w-full mb-2"}),r.jsx(Kr,{className:"h-4 w-2/3"})]})]},T))}):(v==null?void 0:v.length)===0?r.jsxs(Ze,{className:"p-12 text-center",children:[r.jsx(hh,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resources found"}),r.jsx("p",{className:"text-muted-foreground",children:e||s?"Try adjusting your filters":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:v==null?void 0:v.map(S=>{const{pdfCount:T,videoCount:I,linkCount:A}=k(S.id),D=a==null?void 0:a.find($=>$.id===S.category_id);return r.jsxs(Ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>C(S.id),children:[S.preview_image_url?r.jsx("img",{src:S.preview_image_url,alt:S.title,className:"w-full h-40 object-cover"}):r.jsx("div",{className:"w-full h-40 bg-muted flex items-center justify-center",children:r.jsx(hh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Xt,{className:"text-lg line-clamp-1",children:S.title}),D&&r.jsx(Ft,{variant:"secondary",className:"shrink-0 text-xs",children:D.name})]})}),r.jsxs(et,{children:[S.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:S.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Si,{className:"h-4 w-4"}),T]}),I>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wi,{className:"h-4 w-4"}),I]}),A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(bo,{className:"h-4 w-4"}),A]})]})]})]},S.id)})})]})})}const sxt=()=>{const{resourceId:t}=hd(),{data:e,isLoading:n}=rr({queryKey:["brokerage-resource-detail",t],queryFn:async()=>{const{data:i,error:o}=await ee.from("brokerage_resources").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;const{data:c}=await ee.from("brokerage_resource_pdfs").select("*").eq("resource_id",t).order("sort_order"),{data:a}=await ee.from("brokerage_resource_videos").select("*").eq("resource_id",t).order("sort_order"),{data:h}=await ee.from("brokerage_resource_links").select("*").eq("resource_id",t).order("sort_order");return{...i,pdfs:c||[],videos:a||[],links:h||[]}},enabled:!!t}),s=i=>i?i<1024?i+" B":i<1024*1024?(i/1024).toFixed(1)+" KB":(i/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Dr,{title:"Brokerage Resources",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e?r.jsx(Dr,{title:e.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(io,{to:"/brokerage-resources",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Resources"]})}),e.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:e.preview_image_url,alt:e.title,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e.title}),e.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:e.description}})]}),e.videos&&e.videos.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Videos (",e.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:e.videos.map(i=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:i.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:i.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})})]},i.id))})]})}),e.pdfs&&e.pdfs.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Si,{className:"h-4 w-4"}),"Documents (",e.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.pdfs.map(i=>r.jsxs("a",{href:i.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Si,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:i.name}),i.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(i.file_size)})]})]}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})}),e.links&&e.links.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx($s,{className:"h-4 w-4"}),"Canva Templates (",e.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.links.map(i=>r.jsxs("a",{href:i.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx($s,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:i.title})]}),r.jsx($s,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})})]})}):r.jsx(Dr,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(hh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),r.jsx(te,{asChild:!0,className:"mt-4",children:r.jsx(io,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function ixt(){const{onlineUsers:t,totalOnline:e}=BOe();return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xt,{className:"text-base flex items-center gap-2",children:[r.jsx(fs,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Ft,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Au,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),e," online"]})]})}),r.jsx(et,{children:t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):r.jsx(_l,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:t.map(n=>{var s;return r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Di,{className:"h-9 w-9",children:[r.jsx(Po,{src:n.avatarUrl,alt:n.name}),r.jsx(Ri,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(i=>i[0]).join("").slice(0,2).toUpperCase()})]}),r.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-green-500 ring-2 ring-background"})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:n.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",Qd(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const yke={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:fs,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:$T,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:Z0,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:aj,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:Xd,path:"/admin/referrals",color:"bg-teal-500/10 text-teal-600"}]},content:{label:"Content",sections:[{title:"Manage Templates",description:"Upload and organize Canva templates",icon:Yd,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:e1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:Fx,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:As,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:As,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:Dx,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:sm,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:hh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:hh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:QS,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Ah,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:oi,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:om,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:jT,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:fg,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:Ua,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:qa,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Facebook & Instagram for social posting",icon:Bf,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Notification Settings",description:"Test and manage push notifications",icon:om,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:vl,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:e4,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:r1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:Bs,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:oi,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:oa,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:ui,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function axt(){const t=ts();return r.jsx(Dr,{title:"Admin Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Admin Dashboard"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage all aspects of your platform"})]}),r.jsx("div",{className:"w-full lg:w-80",children:r.jsx(ixt,{})})]}),r.jsxs(Oa,{defaultValue:"users",className:"w-full",children:[r.jsx(Ta,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(yke).map(([e,n])=>r.jsx(xn,{value:e,className:"data-[state=active]:bg-background",children:n.label},e))}),Object.entries(yke).map(([e,n])=>r.jsx(Un,{value:e,className:"mt-6",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.sections.map(s=>r.jsxs(Ze,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>t(s.path),children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Xt,{className:"text-base",children:s.title})]}),r.jsx(et,{className:"pt-0",children:r.jsx(In,{className:"text-sm",children:s.description})})]},s.path))})},e))]})]})})}const Us=P.forwardRef(({className:t,...e},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:$t("w-full caption-bottom text-sm",t),...e})}));Us.displayName="Table";const qs=P.forwardRef(({className:t,...e},n)=>r.jsx("thead",{ref:n,className:$t("[&_tr]:border-b",t),...e}));qs.displayName="TableHeader";const Vs=P.forwardRef(({className:t,...e},n)=>r.jsx("tbody",{ref:n,className:$t("[&_tr:last-child]:border-0",t),...e}));Vs.displayName="TableBody";const oxt=P.forwardRef(({className:t,...e},n)=>r.jsx("tfoot",{ref:n,className:$t("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));oxt.displayName="TableFooter";const Er=P.forwardRef(({className:t,...e},n)=>r.jsx("tr",{ref:n,className:$t("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",t),...e}));Er.displayName="TableRow";const Mt=P.forwardRef(({className:t,...e},n)=>r.jsx("th",{ref:n,className:$t("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Mt.displayName="TableHead";const yt=P.forwardRef(({className:t,...e},n)=>r.jsx("td",{ref:n,className:$t("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));yt.displayName="TableCell";const lxt=P.forwardRef(({className:t,...e},n)=>r.jsx("caption",{ref:n,className:$t("mt-4 text-sm text-muted-foreground",t),...e}));lxt.displayName="TableCaption";const cxt=()=>{const{isAdmin:t}=zr(),e=ts(),[n,s]=P.useState([]),[i,o]=P.useState(!0),[c,a]=P.useState(!1),[h,m]=P.useState(null);P.useEffect(()=>{if(!t){e("/dashboard");return}x()},[t]);const x=async()=>{try{const{data:S,error:T}=await ee.from("app_tiles").select("*").order("name");if(T)throw T;s(S||[])}catch(S){console.error("Error loading apps:",S),He.error("Failed to load apps")}finally{o(!1)}},v=async S=>{S.preventDefault();const T=new FormData(S.currentTarget),I={name:T.get("name"),description:T.get("description"),icon:T.get("icon"),app_id:T.get("app_id"),target_url:T.get("target_url"),required_tags:T.get("required_tags").split(",").map(A=>A.trim()).filter(Boolean)};try{if(h){const{error:A}=await ee.from("app_tiles").update(I).eq("id",h.id);if(A)throw A;He.success("App updated successfully")}else{const{error:A}=await ee.from("app_tiles").insert([I]);if(A)throw A;He.success("App created successfully")}a(!1),m(null),x()}catch(A){console.error("Error saving app:",A),He.error("Failed to save app")}},w=async S=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:T}=await ee.from("app_tiles").delete().eq("id",S);if(T)throw T;He.success("App deleted successfully"),x()}catch(T){console.error("Error deleting app:",T),He.error("Failed to delete app")}},k=S=>{m(S),a(!0)},C=()=>{m(null),a(!0)};return i?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/dashboard"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Manage Apps"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Create and configure application tiles"})]})]}),r.jsxs(Ur,{open:c,onOpenChange:a,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{onClick:C,children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Br,{className:"max-w-2xl",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:h?"Edit App":"Create New App"}),r.jsx(us,{children:"Configure the application tile settings"})]}),r.jsxs("form",{onSubmit:v,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"App Name"}),r.jsx(xt,{id:"name",name:"name",defaultValue:h==null?void 0:h.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"app_id",children:"App ID"}),r.jsx(xt,{id:"app_id",name:"app_id",defaultValue:h==null?void 0:h.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",name:"description",defaultValue:h==null?void 0:h.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(xt,{id:"icon",name:"icon",defaultValue:h==null?void 0:h.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"target_url",children:"Target URL"}),r.jsx(xt,{id:"target_url",name:"target_url",type:"url",defaultValue:h==null?void 0:h.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(xt,{id:"required_tags",name:"required_tags",defaultValue:h==null?void 0:h.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{type:"submit",children:h?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Application Tiles"}),r.jsx(In,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(et,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(te,{onClick:C,children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Icon"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"App ID"}),r.jsx(Mt,{children:"Target URL"}),r.jsx(Mt,{children:"Tags"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:n.map(S=>r.jsxs(Er,{children:[r.jsx(yt,{className:"text-2xl",children:S.icon}),r.jsx(yt,{className:"font-medium",children:S.name}),r.jsx(yt,{className:"font-mono text-sm",children:S.app_id}),r.jsx(yt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:S.target_url}),r.jsx(yt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:S.required_tags.map(T=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:T},T))})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>k(S),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>w(S.id),children:r.jsx(es,{className:"h-4 w-4"})})]})})]},S.id))})]})})]})})]})};function Ru({title:t,description:e,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(io,{to:"/admin",children:r.jsxs(te,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Admin Dashboard"]})}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:t}),e&&r.jsx("p",{className:"text-muted-foreground",children:e})]}),n]})]})}const vke=({expiresAt:t,className:e})=>{const n=new Date().getTime(),s=new Date(t).getTime(),i=Math.ceil((s-n)/(1e3*60*60*24));return i<=0?r.jsxs(Ft,{variant:"destructive",className:$t("gap-1",e),children:[r.jsx(Lh,{className:"h-3 w-3"}),"Trial Expired"]}):i<=1?r.jsxs(Ft,{variant:"destructive",className:$t("gap-1",e),children:[r.jsx(Gi,{className:"h-3 w-3"}),"Trial: <1 day left"]}):i<=3?r.jsxs(Ft,{className:$t("gap-1 bg-amber-500 hover:bg-amber-600",e),children:[r.jsx(Gi,{className:"h-3 w-3"}),"Trial: ",i," days left"]}):r.jsxs(Ft,{variant:"secondary",className:$t("gap-1",e),children:[r.jsx(Gi,{className:"h-3 w-3"}),"Trial: ",i," days left"]})},XDe=({open:t,onOpenChange:e,brokerages:n,fixedBrokerageId:s,onSuccess:i})=>{const{toast:o}=ua(),c=P.useRef(null),[a,h]=P.useState([]),[m,x]=P.useState(""),[v,w]=P.useState(!1),[k,C]=P.useState("upload"),[S,T]=P.useState(null),I=()=>{h([]),x(""),C("upload"),T(null),c.current&&(c.current.value="")},A=()=>{I(),e(!1)},D=K=>{const Z=K.split(` `).map(ne=>ne.trim()).filter(ne=>ne);if(Z.length===0)return[];const re=Z[0].toLowerCase(),ue=re.includes("first")||re.includes("last")||re.includes("email")||re.includes("name")||re.includes("phone")||re.includes("sms")||re.includes("consent")?Z.slice(1):Z,je=[];for(const ne of ue){const ie=(ne.includes(" ")?ne.split(" "):ne.split(",")).map(me=>me.trim().replace(/^["']|["']$/g,""));if(ie.length>=2){let me="",fe="",ve="",Ie="",Se;if(ie.length===2){const Ne=ie[0].split(" ");me=Ne[0]||"",fe=Ne.slice(1).join(" ")||"",ve=ie[1]}else if(ie.length===3)me=ie[0],fe=ie[1],ve=ie[2];else if(ie.length===4)me=ie[0],fe=ie[1],ve=ie[2],Ie=ie[3];else if(ie.length>=5){me=ie[0],fe=ie[1],ve=ie[2],Ie=ie[3];const Ne=ie[4].toLowerCase();Se=Ne==="true"||Ne==="yes"||Ne==="1"||Ne==="y"}const ae=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ve);je.push({firstName:me.trim(),lastName:fe.trim(),email:ve.trim().toLowerCase(),phone:Ie.trim()||void 0,smsConsent:Se,isValid:ae&&me.trim().length>0,error:ae?me.trim()?void 0:"Missing name":"Invalid email"})}}return je},$=K=>{var he;const Z=(he=K.target.files)==null?void 0:he[0];if(!Z)return;const re=new FileReader;re.onload=ue=>{var ye;const je=(ye=ue.target)==null?void 0:ye.result,ne=D(je);if(ne.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}h(ne),C("preview")},re.readAsText(Z)},F=async()=>{const K=a.filter(re=>re.isValid);if(K.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const Z=s||m||null;w(!0);try{const{data:{session:re}}=await ee.auth.getSession(),he=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${re==null?void 0:re.access_token}`},body:JSON.stringify({users:K.map(je=>({firstName:je.firstName,lastName:je.lastName,email:je.email,phone:je.phone,smsConsent:je.smsConsent})),brokerageId:Z})}),ue=await he.json();if(!he.ok)throw new Error(ue.error||"Failed to import users");T(ue),C("result"),ue.created>0&&i(),o({title:"Import Complete",description:`${ue.created} user(s) created successfully.${ue.failed>0?` ${ue.failed} failed.`:""}`})}catch(re){console.error("Import error:",re),o({title:"Import Failed",description:re.message||"Failed to import users",variant:"destructive"})}finally{w(!1)}},q=a.filter(K=>K.isValid).length,W=a.filter(K=>!K.isValid).length;return r.jsx(Ur,{open:t,onOpenChange:A,children:r.jsxs(Br,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(J0,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(us,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),k==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:c,onChange:$,className:"hidden"}),r.jsx(Ao,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(te,{onClick:()=>{var K;return(K=c.current)==null?void 0:K.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Expected CSV Format:"}),r.jsxs("code",{className:"text-xs block bg-background p-2 rounded",children:["First Name, Last Name, Email, Phone, SMS Consent",r.jsx("br",{}),"John, Doe, john@example.com, 555-123-4567, yes",r.jsx("br",{}),"Jane, Smith, jane@example.com, 555-987-6543, true"]}),r.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Phone and SMS Consent columns are optional. SMS Consent accepts: yes/no, true/false, 1/0, y/n."})]})]}),k==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!s&&n&&n.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Assign to Brokerage (optional)"}),r.jsxs(_n,{value:m||"none",onValueChange:K=>x(K==="none"?"":K),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select a brokerage..."})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"No brokerage"}),n.map(K=>r.jsx(tr,{value:K.id,children:K.name},K.id))]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[q," valid"]})]}),W>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Ul,{className:"h-4 w-4"}),r.jsxs("span",{children:[W," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/30",children:[r.jsx(Mt,{children:"First Name"}),r.jsx(Mt,{children:"Last Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Phone"}),r.jsx(Mt,{children:"SMS"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Vs,{children:a.slice(0,100).map((K,Z)=>r.jsxs(Er,{children:[r.jsx(yt,{children:K.firstName}),r.jsx(yt,{children:K.lastName}),r.jsx(yt,{children:K.email}),r.jsx(yt,{className:"text-muted-foreground",children:K.phone||"-"}),r.jsx(yt,{className:"text-muted-foreground",children:K.smsConsent===!0?"✓":K.smsConsent===!1?"✗":"-"}),r.jsx(yt,{children:K.isValid?r.jsx(Ft,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ft,{variant:"destructive",children:K.error||"Invalid"})})]},Z))})]}),a.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",a.length," users"]})]})]}),k==="result"&&S&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto text-green-500 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground mt-2",children:[S.created," agent(s) created and invited"]}),S.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[S.failed," failed to create"]})]}),S.errors.length>0&&r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 max-h-40 overflow-auto",children:[r.jsx("p",{className:"font-medium text-destructive text-sm mb-2",children:"Errors:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[S.errors.slice(0,10).map((K,Z)=>r.jsxs("li",{children:["• ",K]},Z)),S.errors.length>10&&r.jsxs("li",{children:["...and ",S.errors.length-10," more"]})]})]})]}),r.jsxs(ai,{children:[k==="upload"&&r.jsx(te,{variant:"outline",onClick:A,children:"Cancel"}),k==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:I,children:"Back"}),r.jsx(te,{onClick:F,disabled:v||q===0,children:v?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${q} Agent${q!==1?"s":""}`})]}),k==="result"&&r.jsx(te,{onClick:A,children:"Done"})]})]})})},dxt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:Bs},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:qa},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:bc}];function QDe({open:t,onOpenChange:e,userId:n,userName:s}){const[i,o]=P.useState("custom"),[c,a]=P.useState(""),[h,m]=P.useState(""),x=Ort(),v=k=>{o(k.type),a(k.title),m(k.message)},w=async k=>{if(k.preventDefault(),!c.trim()){Yi({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:i,title:c.trim(),message:h.trim()||void 0}),Yi({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),e(!1),a(""),m(""),o("custom")}catch{Yi({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(bc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(us,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(Xe,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:dxt.map((k,C)=>r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>v(k),className:"text-xs",children:[r.jsx(k.icon,{className:"h-3 w-3 mr-1"}),k.title]},C))})]}),r.jsxs("form",{onSubmit:w,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(_n,{value:i,onValueChange:k=>o(k),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bs,{className:"h-4 w-4"})," Custom"]})}),r.jsx(tr,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(tr,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(tr,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ad,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",value:c,onChange:k=>a(k.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"message",children:"Message (optional)"}),r.jsx(gs,{id:"message",value:h,onChange:k=>m(k.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:x.isPending,children:[r.jsx(bc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Zle={points_earned:{label:"Points Earned",icon:qa,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:ui,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:ad,color:"bg-green-500"},custom:{label:"Custom",icon:As,color:"bg-purple-500"}};function uxt(){const[t,e]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState("all"),{data:c=[],isLoading:a}=rr({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:v}=await ee.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(v)throw v;const w=[...new Set([...x.map(S=>S.user_id),...x.map(S=>S.created_by).filter(Boolean)])],{data:k}=await ee.from("profiles").select("id, name, email").in("id",w),C=new Map((k==null?void 0:k.map(S=>[S.id,S]))||[]);return x.map(S=>{var T,I,A;return{...S,user_name:((T=C.get(S.user_id))==null?void 0:T.name)||"Unknown",user_email:((I=C.get(S.user_id))==null?void 0:I.email)||"",creator_name:S.created_by?((A=C.get(S.created_by))==null?void 0:A.name)||"System":"Auto-triggered"}})}}),h=c.filter(x=>{var C,S;const v=((C=x.user_name)==null?void 0:C.toLowerCase().includes(t.toLowerCase()))||((S=x.user_email)==null?void 0:S.toLowerCase().includes(t.toLowerCase()))||x.title.toLowerCase().includes(t.toLowerCase()),w=n==="all"||x.celebration_type===n,k=i==="all"||i==="seen"&&x.seen_at||i==="unseen"&&!x.seen_at;return v&&w&&k}),m={total:c.length,seen:c.filter(x=>x.seen_at).length,unseen:c.filter(x=>!x.seen_at).length,byType:Object.keys(Zle).reduce((x,v)=>(x[v]=c.filter(w=>w.celebration_type===v).length,x),{})};return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:m.total})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:m.seen})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:m.unseen})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:m.byType.custom||0})})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(bc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(In,{children:"View all celebrations awarded to agents"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by agent name, email, or title...",value:t,onChange:x=>e(x.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:n,onValueChange:s,children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Filter by type"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Types"}),Object.entries(Zle).map(([x,v])=>r.jsx(tr,{value:x,children:v.label},x))]})]}),r.jsxs(_n,{value:i,onValueChange:o,children:[r.jsx(yn,{className:"w-[140px]",children:r.jsx(bn,{placeholder:"Status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Status"}),r.jsx(tr,{value:"seen",children:"Seen"}),r.jsx(tr,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Points"}),r.jsx(Mt,{children:"Created By"}),r.jsx(Mt,{children:"Created"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Vs,{children:h.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):h.map(x=>{const v=Zle[x.celebration_type],w=v.icon;return r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(w,{className:"h-3 w-3"}),v.label]})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.user_name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:x.user_email})]})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.title}),x.message&&r.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:x.message})]})}),r.jsx(yt,{children:x.points_amount?r.jsxs(Ft,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:un(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(yt,{children:x.seen_at?r.jsx(Ft,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Ft,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),h.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",h.length," of ",c.length," celebrations"]})]})]})]})}const hxt=()=>{const t=ts(),{user:e,isAdmin:n}=zr(),{startImpersonation:s,isLoading:i}=DIe(),{toast:o}=ua(),[c,a]=P.useState([]),[h,m]=P.useState([]),[x,v]=P.useState([]),[w,k]=P.useState({}),[C,S]=P.useState(!0),[T,I]=P.useState({}),[A,D]=P.useState(!1),[$,F]=P.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[q,W]=P.useState(!1),[K,Z]=P.useState(""),[re,he]=P.useState(1),[ue,je]=P.useState(50),[ne,ye]=P.useState("all"),[ie,me]=P.useState("all"),[fe,ve]=P.useState("all"),[Ie,Se]=P.useState("all"),[oe,ae]=P.useState(!1),[Ne,Te]=P.useState(!1),[Be,Le]=P.useState(null),[Qe,Fe]=P.useState(null),[Ce,Je]=P.useState(!1),[Ae,Ye]=P.useState({name:"",email:"",brokerage_id:"",phone:""}),[ge,ft]=P.useState(null),[nt,Ve]=P.useState(!1),[Me,rt]=P.useState(""),[Re,Ge]=P.useState(!1),[tt,Et]=P.useState(!1),[Lt,Ot]=P.useState(null),[Dt,kt]=P.useState(""),[sr,Pr]=P.useState(!1),[wn,kn]=P.useState(!1),[pn,qn]=P.useState(null),[Fs,_r]=P.useState(!1),[js,Ii]=P.useState(!1),[fi,Aa]=P.useState(null),[ca,Yo]=P.useState(""),[Xo,Hs]=P.useState(!1),[Ki,bs]=P.useState({email:"",name:"",password:"",phone:""}),[Ci,Mi]=P.useState(!1),[Eo,ir]=P.useState(!1),[ho,Nc]=P.useState(""),[fo,rs]=P.useState(!1),[po,Od]=P.useState(!1),[vr,Vn]=P.useState(""),[bt,_e]=P.useState(new Set),[De,We]=P.useState(!1),[vt,gt]=P.useState(!1),[Ct,Bt]=P.useState(null),[At,Ut]=P.useState(!1),[mr,ar]=P.useState(null);P.useEffect(()=>{!e||!n||(en(),$r())},[e,n]);const Gr=async()=>{try{const{data:jt,error:Cr}=await ee.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(Cr)throw Cr;const cr={};for(const vs of jt??[])cr[vs.brokerage_id]||(cr[vs.brokerage_id]=[]),cr[vs.brokerage_id].push(vs.user_id);k(cr)}catch(jt){console.error("Error loading brokerage manager assignments:",jt)}},en=async()=>{try{S(!0);const{data:jt,error:Cr}=await ee.functions.invoke("get-user-details");if(Cr)throw Cr;a(jt.users||[]),v(jt.brokerages||[]),await Gr()}catch(jt){console.error("Error loading members:",jt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{S(!1)}},$r=async()=>{try{const{data:jt,error:Cr}=await ee.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(Cr)throw Cr;m(jt||[])}catch(jt){console.error("Error loading apps:",jt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Qn=async jt=>{if(!Ae.name.trim()||!Ae.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Ae.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:cr}=await ee.from("profiles").update({name:Ae.name.trim(),email:Ae.email.trim(),brokerage_id:Ae.brokerage_id||null,phone:Ae.phone.trim()||null}).eq("id",jt);if(cr)throw cr;o({title:"Success",description:"Member details updated successfully"}),Le(null),en()}catch(cr){console.error("Error updating member:",cr),o({title:"Error",description:cr.message||"Failed to update member",variant:"destructive"})}},Zn=async jt=>{try{const{data:{session:Cr}}=await ee.auth.getSession(),cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Cr==null?void 0:Cr.access_token}`},body:JSON.stringify({userId:jt})}),vs=await cr.json();if(!cr.ok)throw new Error(vs.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(Cr){console.error("Error resending welcome email:",Cr),o({title:"Error",description:Cr.message||"Failed to resend welcome email",variant:"destructive"})}},Yn=async(jt,Cr)=>{try{const{error:cr}=await ee.functions.invoke("send-password-reset",{body:{email:jt,redirectTo:window.location.origin}});if(cr)throw cr;o({title:"Password Reset Sent",description:`Password reset email sent to ${Cr}`})}catch(cr){console.error("Error sending password reset:",cr),o({title:"Error",description:cr.message||"Failed to send password reset email",variant:"destructive"})}},Os=async(jt,Cr)=>{if(confirm(`Are you sure you want to delete ${Cr}? This action cannot be undone.`))try{const{data:{session:cr}}=await ee.auth.getSession(),vs=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${cr==null?void 0:cr.access_token}`},body:JSON.stringify({userId:jt})}),Ds=await vs.json();if(!vs.ok)throw new Error(Ds.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),en()}catch(cr){console.error("Error deleting user:",cr),o({title:"Error",description:cr.message||"Failed to delete user",variant:"destructive"})}},ja=async()=>{if(!$.email||!$.name||!$.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if($.role==="brokerage_manager"&&!$.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}D(!0);try{const{data:{session:jt}}=await ee.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`},body:JSON.stringify($)}),cr=await Cr.json();if(!Cr.ok)throw new Error(cr.error||"Failed to create user");if($.role&&$.role!=="user"&&cr.userId){const vs=$.role==="brokerage_manager"?$.brokerage_id:void 0;await Va(cr.userId,$.role,"add",vs)}o({title:"Success",description:`User ${$.email} created successfully`}),F({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),W(!1),en()}catch(jt){console.error("Error creating user:",jt),o({title:"Error",description:jt.message||"Failed to create user",variant:"destructive"})}finally{D(!1)}},Va=async(jt,Cr,cr,vs)=>{try{const{data:{session:Ds}}=await ee.auth.getSession(),jo={userId:jt,role:Cr,action:cr};if(Cr==="brokerage_manager"){if(!vs){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}jo.brokerageId=vs}const eo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ds==null?void 0:Ds.access_token}`},body:JSON.stringify(jo)}),to=await eo.json();if(!eo.ok)throw new Error(to.error||"Failed to manage user role");o({title:"Success",description:`Role ${cr==="add"?"added":"removed"} successfully`}),en()}catch(Ds){console.error("Error managing user role:",Ds),o({title:"Error",description:Ds.message||"Failed to manage user role",variant:"destructive"})}},Ea=(jt,Cr)=>Cr.length===0?!0:Cr.some(cr=>jt.includes(cr)),oo=async(jt,Cr,cr)=>{const vs=`${jt}-${Cr.id}`;ft(vs);try{if(cr){const Ds=c.find(eo=>eo.id===jt),jo=Cr.required_tags.filter(eo=>Ds==null?void 0:Ds.tags.includes(eo));for(const eo of jo){const{error:to}=await ee.from("user_tags").delete().eq("user_id",jt).eq("tag",eo);if(to)throw to}o({title:"Access Removed",description:`Removed access to ${Cr.name}`})}else if(Cr.required_tags.length>0){const{error:Ds}=await ee.from("user_tags").insert({user_id:jt,tag:Cr.required_tags[0]});if(Ds)throw Ds;o({title:"Access Granted",description:`Granted access to ${Cr.name}`})}await en()}catch(Ds){console.error("Error toggling access:",Ds),o({title:"Error",description:Ds.message||"Failed to update access",variant:"destructive"})}finally{ft(null)}},va=async()=>{const jt=Me.trim();if(!jt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(jt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(cr=>cr.name.toLowerCase()===jt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Ge(!0);try{const{error:cr}=await ee.from("brokerages").insert({name:jt});if(cr)throw cr;o({title:"Success",description:`Brokerage "${jt}" created successfully`}),rt(""),Ve(!1),en()}catch(cr){console.error("Error creating brokerage:",cr),o({title:"Error",description:cr.message||"Failed to create brokerage",variant:"destructive"})}finally{Ge(!1)}},Ws=jt=>{Ot(jt),kt(jt.name),Et(!0)},ha=()=>{Ot(null),kt(""),Et(!1)},Fi=async()=>{if(!Lt)return;const jt=Dt.trim();if(!jt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(jt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Pr(!0);try{const{error:Cr}=await ee.from("brokerages").update({name:jt}).eq("id",Lt.id);if(Cr)throw Cr;o({title:"Success",description:"Brokerage updated successfully"}),ha(),en()}catch(Cr){console.error("Error updating brokerage:",Cr),o({title:"Error",description:Cr.message||"Failed to update brokerage",variant:"destructive"})}finally{Pr(!1)}},ks=async(jt,Cr)=>{var cr;if(!Cr||typeof Cr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const vs={userId:jt,role:"brokerage_manager",action:"add",brokerageId:Cr};console.debug("[assignManagerToBrokerage] payload",vs);const{data:{session:Ds}}=await ee.auth.getSession(),jo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ds==null?void 0:Ds.access_token}`},body:JSON.stringify(vs)}),eo=await jo.json();if(!jo.ok&&!((cr=eo.error)!=null&&cr.includes("duplicate")))throw new Error(eo.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await en()}catch(vs){console.error("Error assigning manager:",vs),o({title:"Error",description:vs.message||"Failed to assign manager",variant:"destructive"})}},Ra=jt=>{qn(jt),kn(!0)},bl=async()=>{if(pn){_r(!0);try{const jt=c.filter(vs=>vs.brokerage_id===pn.id),{data:{session:Cr}}=await ee.auth.getSession();for(const vs of jt){const Ds=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Cr==null?void 0:Cr.access_token}`},body:JSON.stringify({userId:vs.id})});if(!Ds.ok){const jo=await Ds.json();console.error(`Failed to delete user ${vs.email}:`,jo.error)}}const{error:cr}=await ee.from("brokerages").delete().eq("id",pn.id);if(cr)throw cr;o({title:"Success",description:`Brokerage "${pn.name}" and ${jt.length} member(s) deleted`}),kn(!1),qn(null),en()}catch(jt){console.error("Error deleting brokerage:",jt),o({title:"Error",description:jt.message||"Failed to delete brokerage",variant:"destructive"})}finally{_r(!1)}}},Pl=jt=>{Aa(jt),Yo(""),Ii(!0)},Sc=()=>{Aa(null),Yo(""),Ii(!1)},np=async jt=>{try{const{error:Cr}=await ee.from("profiles").update({brokerage_id:null}).eq("id",jt);if(Cr)throw Cr;o({title:"Success",description:"User removed from brokerage"}),en()}catch(Cr){console.error("Error removing user from brokerage:",Cr),o({title:"Error",description:Cr.message||"Failed to remove user",variant:"destructive"})}},Qo=async(jt,Cr)=>{try{const{error:cr}=await ee.from("profiles").update({brokerage_id:Cr}).eq("id",jt);if(cr)throw cr;o({title:"Success",description:"User added to brokerage"}),en()}catch(cr){console.error("Error adding user to brokerage:",cr),o({title:"Error",description:cr.message||"Failed to add user",variant:"destructive"})}},pd=async()=>{if(!fi||!Ki.email||!Ki.name||!Ki.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Mi(!0);try{const{data:{session:jt}}=await ee.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`},body:JSON.stringify({...Ki,brokerage_id:fi.id,role:"user"})}),cr=await Cr.json();if(!Cr.ok)throw new Error(cr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Ki.email} created successfully`}),bs({email:"",name:"",password:"",phone:""}),Hs(!1),en()}catch(jt){console.error("Error creating agent:",jt),o({title:"Error",description:jt.message||"Failed to create agent",variant:"destructive"})}finally{Mi(!1)}},Jo=jt=>c.filter(Cr=>Cr.brokerage_id===jt),ru=jt=>{const Cr=Jo(jt);if(!ca)return Cr;const cr=ca.toLowerCase();return Cr.filter(vs=>vs.name.toLowerCase().includes(cr)||vs.email.toLowerCase().includes(cr))},Do=jt=>c.filter(Cr=>Cr.brokerage_id!==jt),sf=c.filter(jt=>{var Cr;if(K){const cr=K.toLowerCase();if(!(jt.name.toLowerCase().includes(cr)||jt.email.toLowerCase().includes(cr)||((Cr=jt.brokerage_name)==null?void 0:Cr.toLowerCase().includes(cr))))return!1}return!(ne==="claimed"&&!jt.claimed||ne==="unclaimed"&&jt.claimed||ie!=="all"&&!jt.roles.includes(ie)||fe==="trial"&&!jt.is_trial||fe==="non-trial"&&jt.is_trial||Ie==="none"&&jt.brokerage_id||Ie!=="all"&&Ie!=="none"&&jt.brokerage_id!==Ie)}),Fu=sf.length,Yl=Math.ceil(Fu/ue),sp=(re-1)*ue,wm=sp+ue,Uc=sf.slice(sp,wm),zu=jt=>{Z(jt),he(1)},Cc=jt=>{je(jt),he(1)},qc=(jt,Cr)=>{jt(Cr),he(1)},md=async(jt,Cr)=>{ae(!0);try{const cr=c.find(eo=>eo.id===jt);if(!cr)return;const vs=cr.trial_expires_at?new Date(cr.trial_expires_at):new Date,Ds=new Date(vs.getTime()+Cr*24*60*60*1e3),{error:jo}=await ee.from("profiles").update({trial_expires_at:Ds.toISOString()}).eq("id",jt);if(jo)throw jo;o({title:"Trial Extended",description:`Trial extended by ${Cr} days`}),en()}catch(cr){console.error("Error extending trial:",cr),o({title:"Error",description:cr.message||"Failed to extend trial",variant:"destructive"})}finally{ae(!1)}},Dd=async jt=>{Te(!0);try{const{error:Cr}=await ee.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",jt);if(Cr)throw Cr;o({title:"Account Converted",description:"User has been converted to a full account"}),en(),Bu()}catch(Cr){console.error("Error converting trial:",Cr),o({title:"Error",description:Cr.message||"Failed to convert account",variant:"destructive"})}finally{Te(!1)}},nu=jt=>{Fe(jt),Ye({name:jt.name,email:jt.email,brokerage_id:jt.brokerage_id||"",phone:jt.phone||""}),Je(!0)},Bu=()=>{Fe(null),Je(!1),Ye({name:"",email:"",brokerage_id:"",phone:""})},ip=async()=>{Qe&&(await Qn(Qe.id),Bu())},dy=jt=>{_e(Cr=>{const cr=new Set(Cr);return cr.has(jt)?cr.delete(jt):cr.add(jt),cr})},ap=()=>{if(bt.size===Uc.length&&Uc.every(jt=>bt.has(jt.id))){const jt=new Set(bt);Uc.forEach(Cr=>jt.delete(Cr.id)),_e(jt)}else{const jt=new Set(bt);Uc.forEach(Cr=>jt.add(Cr.id)),_e(jt)}},op=()=>{_e(new Set)},sk=async()=>{if(bt.size===0)return;We(!0);let jt=0,Cr=0;try{const{data:{session:cr}}=await ee.auth.getSession();for(const vs of bt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${cr==null?void 0:cr.access_token}`},body:JSON.stringify({userId:vs})})).ok?jt++:Cr++}catch{Cr++}o({title:"Bulk Email Complete",description:`Sent ${jt} emails${Cr>0?`, ${Cr} failed`:""}`}),op()}catch(cr){o({title:"Error",description:cr.message||"Failed to send emails",variant:"destructive"})}finally{We(!1)}},Og=async()=>{if(bt.size===0)return;We(!0);let jt=0,Cr=0;try{const{data:{session:cr}}=await ee.auth.getSession();for(const vs of bt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${cr==null?void 0:cr.access_token}`},body:JSON.stringify({userId:vs})})).ok?jt++:Cr++}catch{Cr++}o({title:"Bulk Password Reset Complete",description:`Sent ${jt} reset emails${Cr>0?`, ${Cr} failed`:""}`}),op()}catch(cr){o({title:"Error",description:cr.message||"Failed to send password reset emails",variant:"destructive"})}finally{We(!1)}},Vc=async()=>{if(bt.size===0)return;const jt=c.filter(Ds=>bt.has(Ds.id)).map(Ds=>Ds.name).slice(0,5).join(", "),Cr=bt.size>5?` and ${bt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${bt.size} users (${jt}${Cr})? This action cannot be undone.`))return;We(!0);let cr=0,vs=0;try{const{data:{session:Ds}}=await ee.auth.getSession();for(const jo of bt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ds==null?void 0:Ds.access_token}`},body:JSON.stringify({userId:jo})})).ok?cr++:vs++}catch{vs++}o({title:"Bulk Delete Complete",description:`Deleted ${cr} users${vs>0?`, ${vs} failed`:""}`}),op(),en()}catch(Ds){o({title:"Error",description:Ds.message||"Failed to delete users",variant:"destructive"})}finally{We(!1)}},uy=async()=>{gt(!0);try{const{data:{session:jt}}=await ee.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`}});if(!Cr.ok){const vs=await Cr.json();throw new Error(vs.error||"Failed to sync phones")}const cr=await Cr.json();o({title:"Phone Sync Complete",description:`Pulled ${cr.summary.pulledFromGHL} from GHL, pushed ${cr.summary.pushedToGHL} to GHL, ${cr.summary.alreadySynced} already synced`}),en()}catch(jt){o({title:"Error",description:jt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{gt(!1)}},lp=async(jt,Cr)=>{Bt(jt);try{const{data:{session:cr}}=await ee.auth.getSession(),{data:vs}=await ee.from("profiles").select("phone").eq("id",jt).single(),Ds=(vs==null?void 0:vs.phone)||"",jo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${cr==null?void 0:cr.access_token}`},body:JSON.stringify({email:Cr,action:"update",phone:Ds||void 0})});if(!jo.ok){const to=await jo.json();throw new Error(to.error||"Failed to sync with GHL")}const eo=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(Cr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:Ds?`Phone ${Ds} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),en()}catch(cr){o({title:"Error",description:cr.message||"Failed to sync phone",variant:"destructive"})}finally{Bt(null)}},$u=async jt=>{await s(jt)},w5=()=>{if(bt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const jt=c.filter(to=>bt.has(to.id)),Cr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],cr=jt.map(to=>[to.name,to.email,to.phone||"",to.brokerage_name||"",to.roles.join("; "),to.claimed?"Claimed":"Unclaimed",new Date(to.created_at).toLocaleDateString()]),vs=[Cr.join(","),...cr.map(to=>to.map(Dg=>`"${(Dg||"").replace(/"/g,'""')}"`).join(","))].join(` `),Ds=new Blob([vs],{type:"text/csv"}),jo=URL.createObjectURL(Ds),eo=document.createElement("a");eo.href=jo,eo.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,eo.click(),URL.revokeObjectURL(jo),o({title:"Export complete",description:`Exported ${jt.length} member(s)`})};return C?r.jsx(Dr,{title:"Members",children:r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(Dr,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Member Management",description:"Manage users, roles, and permissions"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:uy,disabled:vt,children:[vt?r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ma,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:vt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:vt?"Syncing...":"Sync GHL"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(J0,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Import CSV"}),r.jsx("span",{className:"sm:hidden",children:"Import"})]}),r.jsxs(Ur,{open:q,onOpenChange:W,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(d1,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Add Member"}),r.jsx("span",{className:"sm:hidden",children:"Add"})]})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Create New User"}),r.jsx(us,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",placeholder:"John Doe",value:$.name,onChange:jt=>F({...$,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"email",children:"Email"}),r.jsx(xt,{id:"email",type:"email",placeholder:"john@example.com",value:$.email,onChange:jt=>F({...$,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"password",children:"Password"}),r.jsx(xt,{id:"password",type:"password",placeholder:"Min 6 characters",value:$.password,onChange:jt=>F({...$,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(xt,{id:"phone",type:"tel",placeholder:"555-123-4567",value:$.phone,onChange:jt=>F({...$,phone:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"brokerage",children:["Brokerage",$.role==="brokerage_manager"?" (required)":""]}),r.jsxs(_n,{value:$.brokerage_id||"none",onValueChange:jt=>F({...$,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(yn,{id:"brokerage",children:r.jsx(bn,{placeholder:$.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"None"}),x.map(jt=>r.jsx(tr,{value:jt.id,children:jt.name},jt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"role",children:"Role"}),r.jsxs(_n,{value:$.role,onValueChange:jt=>F({...$,role:jt}),children:[r.jsx(yn,{id:"role",children:r.jsx(bn,{placeholder:"Select role"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"user",children:"User"}),r.jsx(tr,{value:"moderator",children:"Moderator"}),r.jsx(tr,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(tr,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(_n,{value:$.trial_days||"none",onValueChange:jt=>F({...$,trial_days:jt==="none"?"":jt}),children:[r.jsx(yn,{id:"trial_days",children:r.jsx(bn,{placeholder:"No trial (full access)"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"No trial (full access)"}),r.jsx(tr,{value:"7",children:"7-day trial"}),r.jsx(tr,{value:"30",children:"30-day trial"}),r.jsx(tr,{value:"60",children:"60-day trial"}),r.jsx(tr,{value:"90",children:"90-day trial"}),r.jsx(tr,{value:"365",children:"1-year trial"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>W(!1),children:"Cancel"}),r.jsx(te,{onClick:ja,disabled:A,children:A?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(Oa,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"members",children:"Members"}),r.jsx(xn,{value:"brokerages",children:"Brokerages"}),r.jsx(xn,{value:"access",children:"Access Matrix"}),r.jsx(xn,{value:"celebrations",children:"Celebrations"})]}),r.jsxs(Un,{value:"members",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search members...",value:K,onChange:jt=>zu(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(_n,{value:ne,onValueChange:jt=>qc(ye,jt),children:[r.jsx(yn,{className:"w-[130px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Status"}),r.jsx(tr,{value:"claimed",children:"Active"}),r.jsx(tr,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(_n,{value:ie,onValueChange:jt=>qc(me,jt),children:[r.jsx(yn,{className:"w-[130px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Roles"}),r.jsx(tr,{value:"admin",children:"Admin"}),r.jsx(tr,{value:"brokerage_manager",children:"Manager"}),r.jsx(tr,{value:"user",children:"User"})]})]}),r.jsxs(_n,{value:fe,onValueChange:jt=>qc(ve,jt),children:[r.jsx(yn,{className:"w-[130px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Users"}),r.jsx(tr,{value:"trial",children:"Trial Only"}),r.jsx(tr,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(_n,{value:Ie,onValueChange:jt=>qc(Se,jt),children:[r.jsx(yn,{className:"w-[150px] h-9",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Brokerages"}),r.jsx(tr,{value:"none",children:"No Brokerage"}),x.map(jt=>r.jsx(tr,{value:jt.id,children:jt.name},jt.id))]})]}),(K||ne!=="all"||ie!=="all"||fe!=="all"||Ie!=="all")&&r.jsxs(te,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{Z(""),ye("all"),me("all"),ve("all"),Se("all"),he(1)},children:[r.jsx(Es,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",sp+1,"-",Math.min(wm,Fu)," of ",Fu," members"]}),r.jsxs(_n,{value:ue.toString(),onValueChange:jt=>Cc(Number(jt)),children:[r.jsx(yn,{className:"h-9 w-[110px]",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"50",children:"50 / page"}),r.jsx(tr,{value:"100",children:"100 / page"}),r.jsx(tr,{value:"250",children:"250 / page"})]})]})]})]}),bt.size>0&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(i0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[bt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:sk,disabled:De,children:[De?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(oi,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),r.jsx("span",{className:"sm:hidden",children:"Invite"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:Og,disabled:De,children:[De?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Vh,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),r.jsx("span",{className:"sm:hidden",children:"Reset"})]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:w5,children:[r.jsx(Mo,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Export"}),r.jsx("span",{className:"sm:hidden",children:"CSV"})]}),r.jsxs(te,{size:"sm",variant:"destructive",onClick:Vc,disabled:De,children:[De?r.jsx(sn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(es,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Delete"}),r.jsx("span",{className:"sm:hidden",children:"Del"})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:op,disabled:De,children:r.jsx(Es,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"w-[50px]",children:r.jsx(vc,{checked:Uc.length>0&&Uc.every(jt=>bt.has(jt.id)),onCheckedChange:ap,"aria-label":"Select all on page"})}),r.jsx(Mt,{className:"font-semibold",children:"Name"}),r.jsx(Mt,{className:"font-semibold",children:"Brokerage"}),r.jsx(Mt,{className:"font-semibold",children:"Status"}),r.jsx(Mt,{className:"font-semibold",children:"Role"}),r.jsx(Mt,{className:"font-semibold",children:"Last Login"}),r.jsx(Mt,{className:"w-[100px]"})]})}),r.jsx(Vs,{children:Uc.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Uc.map(jt=>r.jsxs(Er,{className:`hover:bg-muted/30 ${bt.has(jt.id)?"bg-primary/5":""}`,children:[r.jsx(yt,{children:r.jsx(vc,{checked:bt.has(jt.id),onCheckedChange:()=>dy(jt.id),"aria-label":`Select ${jt.name}`})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>nu(jt),className:"text-primary hover:underline font-medium text-left",children:jt.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:jt.email})]})}),r.jsx(yt,{className:"text-muted-foreground",children:jt.brokerage_name||"—"}),r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ft,{variant:jt.claimed?"default":"secondary",className:jt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:jt.claimed?"Active":"Pending"}),jt.is_trial&&jt.trial_expires_at&&r.jsx(vke,{expiresAt:jt.trial_expires_at,className:"w-fit"})]})}),r.jsx(yt,{children:jt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:jt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-muted-foreground",children:jt.last_sign_in_at?new Date(jt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ar(jt),Ut(!0)},title:"Send celebration",children:r.jsx(bc,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>nu(jt),title:"Edit member",children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>lp(jt.id,jt.email),disabled:Ct===jt.id,title:"Sync phone with GHL",children:Ct===jt.id?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(Ma,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Zn(jt.id),title:"Resend welcome email",children:r.jsx(oi,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Yn(jt.email,jt.name),title:"Send password reset",children:r.jsx(nj,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>$u(jt.id),disabled:i||jt.id===(e==null?void 0:e.id),title:jt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:i?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(r4,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Os(jt.id,jt.name),title:"Delete user",children:r.jsx(es,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),Yl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",re," of ",Yl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"sm",onClick:()=>he(1),disabled:re===1,children:"First"}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.max(1,jt-1)),disabled:re===1,children:r.jsx(id,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Yl)},(jt,Cr)=>{let cr;return Yl<=5||re<=3?cr=Cr+1:re>=Yl-2?cr=Yl-4+Cr:cr=re-2+Cr,r.jsx(te,{variant:re===cr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>he(cr),children:cr},cr)})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.min(Yl,jt+1)),disabled:re===Yl,children:r.jsx(Ka,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"sm",onClick:()=>he(Yl),disabled:re===Yl,children:"Last"})]})]})]}),r.jsx(Ur,{open:Ce,onOpenChange:Je,children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Edit Member"}),r.jsx(us,{children:"Update member details, roles, and app access"})]}),Qe&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"edit-name",children:"Name"}),r.jsx(xt,{id:"edit-name",value:Ae.name,onChange:jt=>Ye({...Ae,name:jt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"edit-email",children:"Email"}),r.jsx(xt,{id:"edit-email",type:"email",value:Ae.email,onChange:jt=>Ye({...Ae,email:jt.target.value}),maxLength:255})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(xt,{id:"edit-phone",type:"tel",value:Ae.phone,onChange:jt=>Ye({...Ae,phone:jt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(_n,{value:Ae.brokerage_id||"none",onValueChange:jt=>Ye({...Ae,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(yn,{id:"edit-brokerage",children:r.jsx(bn,{placeholder:"Select brokerage"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"None"}),x.map(jt=>r.jsx(tr,{value:jt.id,children:jt.name},jt.id))]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Qe.roles.map(jt=>r.jsxs(Ft,{variant:"default",className:"gap-1",children:[r.jsx(lm,{className:"h-3 w-3"}),jt,jt==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Va(Qe.id,jt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(Es,{className:"h-3 w-3"})})]},jt)),Qe.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(_n,{onValueChange:jt=>Va(Qe.id,jt,"add"),children:[r.jsx(yn,{className:"w-[200px]",children:r.jsx(bn,{placeholder:"Add role..."})}),r.jsxs(vn,{children:[!Qe.roles.includes("admin")&&r.jsx(tr,{value:"admin",children:"Admin"}),!Qe.roles.includes("user")&&r.jsx(tr,{value:"user",children:"User"})]})]}),!Qe.roles.includes("brokerage_manager")&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"To add as brokerage manager, use Brokerages tab → Manage"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"App Access"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which apps this member can access"}),r.jsx("div",{className:"grid gap-3",children:h.map(jt=>{const Cr=Ea(Qe.tags,jt.required_tags),cr=`${Qe.id}-${jt.id}`,vs=ge===cr,Ds=jt.required_tags.length===0;return r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xl",children:jt.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:jt.name}),Ds&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:vs?r.jsx(sn,{className:"h-4 w-4 animate-spin text-muted-foreground"}):Ds?r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Js,{checked:Cr,onCheckedChange:()=>oo(Qe.id,jt,Cr)})})]},jt.id)})})]}),Qe.is_trial&&r.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Gi,{className:"h-4 w-4"}),"Trial Status"]}),r.jsxs("div",{className:"p-4 rounded-lg border bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("div",{children:Qe.trial_expires_at&&r.jsx(vke,{expiresAt:Qe.trial_expires_at})}),Qe.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Qe.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>md(Qe.id,7),disabled:oe,children:[r.jsx(Gw,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>md(Qe.id,14),disabled:oe,children:[r.jsx(Gw,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>md(Qe.id,30),disabled:oe,children:[r.jsx(Gw,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(te,{size:"sm",variant:"default",onClick:()=>Dd(Qe.id),disabled:Ne,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(oj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Qe.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Qe.trial_started_at).toLocaleDateString(),Qe.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Qe.trial_claimed_at).toLocaleDateString()]})]})]})]}),r.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Account Information"}),r.jsxs("div",{className:"text-sm space-y-1 text-muted-foreground",children:[Qe.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Qe.email_confirmed_at).toLocaleString()]}),Qe.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Qe.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Qe.created_at).toLocaleString()]})]})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:Bu,children:"Cancel"}),r.jsx(te,{onClick:ip,children:"Save Changes"})]})]})}),r.jsxs(Un,{value:"access",children:[h.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(te,{onClick:()=>t("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Member Access Matrix"}),r.jsx(In,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),h.map(jt=>r.jsx("th",{className:"text-center p-4 font-semibold min-w-[120px]",children:r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx("span",{className:"text-2xl",children:jt.icon}),r.jsx("span",{className:"text-sm",children:jt.name})]})},jt.id))]})}),r.jsxs("tbody",{children:[Uc.map(jt=>r.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[r.jsx("td",{className:"p-4 sticky left-0 bg-card z-10",children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:jt.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:jt.email})]})}),h.map(Cr=>{const cr=Ea(jt.tags,Cr.required_tags),vs=`${jt.id}-${Cr.id}`,Ds=ge===vs;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:Ds?r.jsx(sn,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Js,{checked:cr,onCheckedChange:()=>oo(jt.id,Cr,cr),disabled:Cr.required_tags.length===0})})},Cr.id)})]},jt.id)),Uc.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:h.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Yl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",sp+1,"-",Math.min(wm,Fu)," of ",Fu," • Page ",re," of ",Yl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.max(1,jt-1)),disabled:re===1,children:r.jsx(id,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>he(jt=>Math.min(Yl,jt+1)),disabled:re===Yl,children:r.jsx(Ka,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(te,{variant:"outline",onClick:()=>t("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(Un,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search brokerages...",value:ho,onChange:jt=>Nc(jt.target.value),className:"pl-10"})]}),r.jsxs(Ur,{open:nt,onOpenChange:Ve,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(na,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Create New Brokerage"}),r.jsx(us,{children:"Add a new brokerage to the system."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(xt,{id:"brokerage-name",placeholder:"Enter brokerage name",value:Me,onChange:jt=>rt(jt.target.value),maxLength:100})]})}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>Ve(!1),children:"Cancel"}),r.jsx(te,{onClick:va,disabled:Re,children:Re?"Creating...":"Create Brokerage"})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(Mt,{className:"font-semibold",children:"Manager(s)"}),r.jsx(Mt,{className:"font-semibold",children:"Agents"}),r.jsx(Mt,{className:"w-[150px]"})]})}),r.jsx(Vs,{children:(()=>{const jt=x.filter(Cr=>Cr.name.toLowerCase().includes(ho.toLowerCase()));return jt.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:ho?"No brokerages match your search":"No brokerages found"})}):jt.map(Cr=>{const cr=c.filter(eo=>eo.brokerage_id===Cr.id),Ds=(w[Cr.id]??[]).map(eo=>c.find(to=>to.id===eo)).filter(Boolean),jo=cr.length;return r.jsxs(Er,{className:"hover:bg-muted/30",children:[r.jsx(yt,{children:r.jsx("button",{onClick:()=>Ws(Cr),className:"text-primary hover:underline font-medium",children:Cr.name})}),r.jsx(yt,{children:Ds.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:Ds.map(eo=>r.jsx(Ft,{variant:"secondary",className:"text-xs",children:eo.name},eo.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(yt,{children:[jo," member",jo!==1?"s":""]}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Pl(Cr),children:[r.jsx(fs,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ws(Cr),title:"Edit brokerage",children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ra(Cr),title:"Delete brokerage",children:r.jsx(es,{className:"h-4 w-4"})})]})})]},Cr.id)})})()})]})}),r.jsx(Ur,{open:tt,onOpenChange:Et,children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Edit Brokerage"}),r.jsx(us,{children:"Update brokerage details and manage managers"})]}),Lt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(xt,{id:"edit-brokerage-name",value:Dt,onChange:jt=>kt(jt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Managers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const Cr=(w[Lt.id]??[]).map(cr=>c.find(vs=>vs.id===cr)).filter(Boolean);return Cr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):Cr.map(cr=>r.jsxs(Ft,{variant:"default",className:"gap-1",children:[r.jsx(lm,{className:"h-3 w-3"}),cr.name,r.jsx("button",{onClick:()=>Va(cr.id,"brokerage_manager","remove",Lt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(Es,{className:"h-3 w-3"})})]},cr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(Jh,{open:fo,onOpenChange:rs,children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":fo,className:"w-full justify-between",children:["Search for a member...",r.jsx(Ei,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(gh,{className:"w-full p-0",align:"start",children:r.jsxs(Mj,{children:[r.jsx(Tj,{placeholder:"Search by name or email..."}),r.jsxs(Aj,{className:"max-h-[200px]",children:[r.jsx(Ej,{children:"No members found."}),r.jsx(Ij,{children:(()=>{const jt=new Set(w[Lt.id]??[]);return c.filter(Cr=>!jt.has(Cr.id)&&(n||Cr.brokerage_id===Lt.id)).map(Cr=>r.jsxs(Pj,{value:`${Cr.name} ${Cr.email}`,onSelect:()=>{ks(Cr.id,Lt.id),rs(!1)},children:[Cr.name," (",Cr.email,")"]},Cr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:c.filter(jt=>jt.brokerage_id===Lt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):c.filter(jt=>jt.brokerage_id===Lt.id).map(jt=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:jt.name}),jt.roles.includes("brokerage_manager")&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Manager"})]},jt.id))})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:ha,children:"Cancel"}),r.jsx(te,{onClick:Fi,disabled:sr,children:sr?"Saving...":"Save Changes"})]})]})}),r.jsx(Ur,{open:wn,onOpenChange:kn,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(us,{children:['Are you sure you want to delete "',pn==null?void 0:pn.name,'"?']})]}),r.jsx("div",{className:"py-4",children:r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-destructive",children:"Warning: This action cannot be undone!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"This will permanently delete:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground list-disc list-inside",children:[r.jsxs("li",{children:['The brokerage "',pn==null?void 0:pn.name,'"']}),r.jsxs("li",{children:["All ",c.filter(jt=>jt.brokerage_id===(pn==null?void 0:pn.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>kn(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:bl,disabled:Fs,children:Fs?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Ur,{open:js,onOpenChange:Ii,children:r.jsxs(Br,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-5 w-5"}),"Manage ",fi==null?void 0:fi.name]}),r.jsx(us,{children:"Add, remove, or manage users in this brokerage"})]}),fi&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search members...",value:ca,onChange:jt=>Yo(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Ur,{open:Xo,onOpenChange:Hs,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(d1,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Add New Agent"}),r.jsxs(us,{children:["Create a new agent for ",fi.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"agent-name",children:"Name"}),r.jsx(xt,{id:"agent-name",placeholder:"John Doe",value:Ki.name,onChange:jt=>bs({...Ki,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"agent-email",children:"Email"}),r.jsx(xt,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Ki.email,onChange:jt=>bs({...Ki,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"agent-password",children:"Password"}),r.jsx(xt,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Ki.password,onChange:jt=>bs({...Ki,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(xt,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Ki.phone,onChange:jt=>bs({...Ki,phone:jt.target.value})})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>Hs(!1),children:"Cancel"}),r.jsx(te,{onClick:pd,disabled:Ci,children:Ci?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xe,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(Jh,{open:po,onOpenChange:Od,children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":po,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(Ei,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(gh,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Mj,{children:[r.jsx(Tj,{placeholder:"Search users...",value:vr,onValueChange:Vn}),r.jsxs(Aj,{children:[r.jsx(Ej,{children:"No users found."}),r.jsx(Ij,{children:Do(fi.id).filter(jt=>vr===""||jt.name.toLowerCase().includes(vr.toLowerCase())||jt.email.toLowerCase().includes(vr.toLowerCase())).map(jt=>r.jsxs(Pj,{value:`${jt.name} ${jt.email}`,onSelect:()=>{Qo(jt.id,fi.id),Od(!1),Vn("")},children:[jt.name," (",jt.email,")"]},jt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"font-semibold",children:"Name"}),r.jsx(Mt,{className:"font-semibold",children:"Email"}),r.jsx(Mt,{className:"font-semibold",children:"Status"}),r.jsx(Mt,{className:"font-semibold",children:"Role"}),r.jsx(Mt,{className:"w-[120px]"})]})}),r.jsx(Vs,{children:ru(fi.id).length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:ca?"No matching members found":"No members in this brokerage"})}):ru(fi.id).map(jt=>r.jsxs(Er,{className:"hover:bg-muted/30",children:[r.jsx(yt,{className:"font-medium",children:jt.name}),r.jsx(yt,{className:"text-muted-foreground",children:jt.email}),r.jsx(yt,{children:jt.claimed?r.jsx(Ft,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Ft,{variant:"secondary",children:"Pending"})}),r.jsx(yt,{children:jt.roles.includes("brokerage_manager")?r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(lm,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!jt.claimed&&r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Zn(jt.id),title:"Resend welcome email",children:r.jsx(oi,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>np(jt.id),title:"Remove from brokerage",children:r.jsx(Es,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>$u(jt.id),disabled:i||jt.id===(e==null?void 0:e.id),title:jt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:i?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(r4,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Os(jt.id,jt.name),title:"Delete user",children:r.jsx(es,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Jo(fi.id).length," total member",Jo(fi.id).length!==1?"s":""," •",Jo(fi.id).filter(jt=>jt.roles.includes("brokerage_manager")).length," manager",Jo(fi.id).filter(jt=>jt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(ai,{children:r.jsx(te,{variant:"outline",onClick:Sc,children:"Close"})})]})})]}),r.jsx(Un,{value:"celebrations",children:r.jsx(uxt,{})})]})]}),r.jsx(XDe,{open:Eo,onOpenChange:ir,brokerages:x,onSuccess:en}),mr&&r.jsx(QDe,{open:At,onOpenChange:jt=>{Ut(jt),jt||ar(null)},userId:mr.id,userName:mr.name})]})},fxt=()=>{const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[c,a]=P.useState(""),[h,m]=P.useState(""),[x,v]=P.useState(""),[w,k]=P.useState("");P.useEffect(()=>{C()},[]);const C=async()=>{const{data:F,error:q}=await ee.from("invite_codes").select("*").order("created_at",{ascending:!1});q?(He.error("Failed to load invite codes"),console.error(q)):e(F||[]),s(!1)},S=async F=>{if(F.preventDefault(),!c.trim()){He.error("Please enter a code");return}o(!0);const{error:q}=await ee.from("invite_codes").insert({code:c.trim().toUpperCase(),description:h.trim()||null,max_uses:x?parseInt(x):null,trial_days:w?parseInt(w):null});q?q.code==="23505"?He.error("This code already exists"):(He.error("Failed to create invite code"),console.error(q)):(He.success("Invite code created"),a(""),m(""),v(""),k(""),C()),o(!1)},T=async(F,q)=>{const{error:W}=await ee.from("invite_codes").update({is_active:!q}).eq("id",F);W?He.error("Failed to update code"):e(t.map(K=>K.id===F?{...K,is_active:!q}:K))},I=async F=>{const{error:q}=await ee.from("invite_codes").delete().eq("id",F);q?He.error("Failed to delete code"):(He.success("Code deleted"),e(t.filter(W=>W.id!==F)))},A="https://dashboard.relevelup.com",D=F=>{const q=`${A}/join?code=${F}`;navigator.clipboard.writeText(q),He.success("Link copied to clipboard")},$=`${A}/join`;return r.jsx(Dr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Create New Code"}),r.jsxs(In,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:$})]})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:S,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"code",children:"Code"}),r.jsx(xt,{id:"code",placeholder:"WELCOME2024",value:c,onChange:F=>a(F.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(Xe,{htmlFor:"description",children:"Description (optional)"}),r.jsx(xt,{id:"description",placeholder:"For marketing campaign",value:h,onChange:F=>m(F.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(xt,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:F=>v(F.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(xt,{id:"trialDays",type:"number",placeholder:"None",value:w,onChange:F=>k(F.target.value),className:"w-28"})]}),r.jsxs(te,{type:"submit",disabled:i,children:[i?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Active Codes"})}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t.length===0?r.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Code"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Uses"}),r.jsx(Mt,{children:"Trial"}),r.jsx(Mt,{children:"Created"}),r.jsx(Mt,{children:"Active"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(F=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-mono font-medium",children:F.code}),r.jsx(yt,{className:"text-muted-foreground",children:F.description||"—"}),r.jsxs(yt,{children:[F.uses_count,F.max_uses&&` / ${F.max_uses}`]}),r.jsx(yt,{children:F.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[F.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-muted-foreground",children:un(new Date(F.created_at),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx(Js,{checked:F.is_active,onCheckedChange:()=>T(F.id,F.is_active)})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>D(F.code),title:"Copy invite link",children:r.jsx(Vl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>I(F.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(es,{className:"h-4 w-4"})})]})})]},F.id))})]})})]})]})})};function jd(t){this.content=t}jd.prototype={constructor:jd,find:function(t){for(var e=0;e>1}};jd.from=function(t){if(t instanceof jd)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new jd(e)};function JDe(t,e,n){for(let s=0;;s++){if(s==t.childCount||s==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(s),o=e.child(s);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let c=0;i.text[c]==o.text[c];c++)n++;return n}if(i.content.size||o.content.size){let c=JDe(i.content,o.content,n+1);if(c!=null)return c}n+=i.nodeSize}}function eRe(t,e,n,s){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:s};let c=t.child(--i),a=e.child(--o),h=c.nodeSize;if(c==a){n-=h,s-=h;continue}if(!c.sameMarkup(a))return{a:n,b:s};if(c.isText&&c.text!=a.text){let m=0,x=Math.min(c.text.length,a.text.length);for(;me&&s(h,i+a,o||null,c)!==!1&&h.content.size){let x=a+1;h.nodesBetween(Math.max(0,e-x),Math.min(h.content.size,n-x),s,i+x)}a=m}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,s,i){let o="",c=!0;return this.nodesBetween(e,n,(a,h)=>{let m=a.isText?a.text.slice(Math.max(e,h)-h,n-h):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&m||a.isTextblock)&&s&&(c?c=!1:o+=s),o+=m},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,s=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(i[i.length-1]=n.withText(n.text+s.text),o=1);oe)for(let o=0,c=0;ce&&((cn)&&(a.isText?a=a.cut(Math.max(0,e-c),Math.min(a.text.length,n-c)):a=a.cut(Math.max(0,e-c-1),Math.min(a.content.size,n-c-1))),s.push(a),i+=a.nodeSize),c=h}return new gn(s,i)}cutByIndex(e,n){return e==n?gn.empty:e==0&&n==this.content.length?this:new gn(this.content.slice(e,n))}replaceChild(e,n){let s=this.content[e];if(s==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return i[e]=n,new gn(i,o)}addToStart(e){return new gn([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new gn(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,s=0;;n++){let i=this.child(n),o=s+i.nodeSize;if(o>=e)return o==e?mL(n+1,o):mL(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return gn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new gn(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return gn.empty;let n,s=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=e.slice()),s||n.push(this),n}removeFromSet(e){for(let n=0;ns.type.rank-i.type.rank),n}};Io.none=[];class _te extends Error{}class hs{constructor(e,n,s){this.content=e,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let s=rRe(this.content,e+this.openStart,n);return s&&new hs(s,this.openStart,this.openEnd)}removeBetween(e,n){return new hs(tRe(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return hs.empty;let s=n.openStart||0,i=n.openEnd||0;if(typeof s!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new hs(gn.fromJSON(e,n.content),s,i)}static maxOpen(e,n=!0){let s=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new hs(e,s,i)}}hs.empty=new hs(gn.empty,0,0);function tRe(t,e,n){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s),{index:c,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(c).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(s!=c)throw new RangeError("Removing non-flat range");return t.replaceChild(s,o.copy(tRe(o.content,e-i-1,n-i-1)))}function rRe(t,e,n,s){let{index:i,offset:o}=t.findIndex(e),c=t.maybeChild(i);if(o==e||c.isText)return s&&!s.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=rRe(c.content,e-o-1,n,c);return a&&t.replaceChild(i,c.copy(a))}function pxt(t,e,n){if(n.openStart>t.depth)throw new _te("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _te("Inconsistent open depths");return nRe(t,e,n,0)}function nRe(t,e,n,s){let i=t.index(s),o=t.node(s);if(i==e.index(s)&&s=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function JT(t,e,n,s){let i=(e||t).node(n),o=0,c=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(lj(t.nodeAfter,s),o++));for(let a=o;ai&&whe(t,e,i+1),c=s.depth>i&&whe(n,s,i+1),a=[];return JT(null,t,i,a),o&&c&&e.index(i)==n.index(i)?(sRe(o,c),lj(cj(o,iRe(t,e,n,s,i+1)),a)):(o&&lj(cj(o,bte(t,e,i+1)),a),JT(e,n,i,a),c&&lj(cj(c,bte(n,s,i+1)),a)),JT(s,null,i,a),new gn(a)}function bte(t,e,n){let s=[];if(JT(null,t,n,s),t.depth>n){let i=whe(t,e,n+1);lj(cj(i,bte(t,e,n+1)),s)}return JT(e,null,n,s),new gn(s)}function mxt(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(gn.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class ZA{constructor(e,n,s){this.pos=e,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],i=e.child(n);return s?e.child(n).cut(s):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let s=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;s--)if(e.pos<=this.end(s)&&(!n||n(this.node(s))))return new wte(this,e,s);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let s=[],i=0,o=n;for(let c=e;;){let{index:a,offset:h}=c.content.findIndex(o),m=o-h;if(s.push(c,a,i+h),!m||(c=c.child(a),c.isText))break;o=m-1,i+=h+1}return new ZA(n,s,o)}static resolveCached(e,n){let s=_ke.get(e);if(s)for(let o=0;oe&&this.nodesBetween(e,n,o=>(s.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),aRe(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,s=gn.empty,i=0,o=s.childCount){let c=this.contentMatchAt(e).matchFragment(s,i,o),a=c&&c.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let h=i;hn.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,s)}let i=gn.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,s);return o.type.checkAttrs(o.attrs),o}};g1.prototype.text=void 0;class jte extends g1{constructor(e,n,s,i){if(super(e,n,null,i),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):aRe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new jte(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new jte(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function aRe(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Oj{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let s=new vxt(e,n);if(s.next==null)return Oj.empty;let i=oRe(s);s.next&&s.err("Unexpected trailing text");let o=Sxt(Nxt(i));return Cxt(o,s),o}matchType(e){for(let n=0;nm.createAndFill()));for(let m=0;m=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(s){e.push(s);for(let i=0;i{let o=i+(s.validEnd?"*":" ")+" ";for(let c=0;c"+e.indexOf(s.next[c].next);return o}).join(` `)}}Oj.empty=new Oj(!0);class vxt{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function oRe(t){let e=[];do e.push(_xt(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function _xt(t){let e=[];do e.push(bxt(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function bxt(t){let e=kxt(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=wxt(t,e);else break;return e}function bke(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function wxt(t,e){let n=bke(t),s=n;return t.eat(",")&&(t.next!="}"?s=bke(t):s=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:e}}function jxt(t,e){let n=t.nodeTypes,s=n[e];if(s)return[s];let i=[];for(let o in n){let c=n[o];c.isInGroup(e)&&i.push(c)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function kxt(t){if(t.eat("(")){let e=oRe(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=jxt(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Nxt(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function s(c,a,h){let m={term:h,to:a};return e[c].push(m),m}function i(c,a){c.forEach(h=>h.to=a)}function o(c,a){if(c.type=="choice")return c.exprs.reduce((h,m)=>h.concat(o(m,a)),[]);if(c.type=="seq")for(let h=0;;h++){let m=o(c.exprs[h],a);if(h==c.exprs.length-1)return m;i(m,a=n())}else if(c.type=="star"){let h=n();return s(a,h),i(o(c.expr,h),h),[s(h)]}else if(c.type=="plus"){let h=n();return i(o(c.expr,a),h),i(o(c.expr,h),h),[s(h)]}else{if(c.type=="opt")return[s(a)].concat(o(c.expr,a));if(c.type=="range"){let h=a;for(let m=0;m{t[c].forEach(({term:a,to:h})=>{if(!a)return;let m;for(let x=0;x{m||i.push([a,m=[]]),m.indexOf(x)==-1&&m.push(x)})})});let o=e[s.join(",")]=new Oj(s.indexOf(t.length-1)>-1);for(let c=0;c-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:dRe(this.attrs,e)}create(e=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new g1(this,this.computeAttrs(e),gn.from(n),Io.setFrom(s))}createChecked(e=null,n,s){return n=gn.from(n),this.checkContent(n),new g1(this,this.computeAttrs(e),n,Io.setFrom(s))}createAndFill(e=null,n,s){if(e=this.computeAttrs(e),n=gn.from(n),n.size){let c=this.contentMatch.fillBefore(n);if(!c)return null;n=c.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(gn.empty,!0);return o?new g1(this,e,n.append(o),Io.setFrom(s)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;ns[o]=new fRe(o,n,c));let i=n.spec.topNode||"doc";if(!s[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let o in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function Mxt(t,e,n){let s=n.split("|");return i=>{let o=i===null?"null":typeof i;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${t}, got ${o}`)}}class Txt{constructor(e,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Mxt(e,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class wse{constructor(e,n,s,i){this.name=e,this.rank=n,this.schema=s,this.spec=i,this.attrs=hRe(e,i.attrs),this.excluded=null;let o=cRe(this.attrs);this.instance=o?new Io(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Io(this,dRe(this.attrs,e))}static compile(e,n){let s=Object.create(null),i=0;return e.forEach((o,c)=>s[o]=new wse(o,i++,n,c)),s}removeFromSet(e){for(var n=0;n-1}}class pRe{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=jd.from(e.nodes),n.marks=jd.from(e.marks||{}),this.nodes=jke.compile(this.spec.nodes,this),this.marks=wse.compile(this.spec.marks,this);let s=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],c=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=s[c]||(s[c]=Oj.parse(c,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=a=="_"?null:a?kke(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],c=o.spec.excludes;o.excluded=c==null?[o]:c==""?[]:kke(this,c.split(" "))}this.nodeFromJSON=i=>g1.fromJSON(this,i),this.markFromJSON=i=>Io.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,s,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof jke){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,s,i)}text(e,n){let s=this.nodes.text;return new jte(s,s.defaultAttrs,e,Io.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function kke(t,e){let n=[];for(let s=0;s-1)&&n.push(c=h)}if(!c)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return n}function Axt(t){return t.tag!=null}function Ext(t){return t.style!=null}let eA=class khe{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(i=>{if(Axt(i))this.tags.push(i);else if(Ext(i)){let o=/[^=]*/.exec(i.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let s=new Ske(this,n,!1);return s.addAll(e,Io.none,n.from,n.to),s.finish()}parseSlice(e,n={}){let s=new Ske(this,n,!0);return s.addAll(e,Io.none,n.from,n.to),hs.maxOpen(s.finish())}matchTag(e,n,s){for(let i=s?this.tags.indexOf(s)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(c.getAttrs){let h=c.getAttrs(n);if(h===!1)continue;c.attrs=h||void 0}return c}}}static schemaRules(e){let n=[];function s(i){let o=i.priority==null?50:i.priority,c=0;for(;c{s(c=Cke(c)),c.mark||c.ignore||c.clearMark||(c.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(c=>{s(c=Cke(c)),c.node||c.ignore||c.mark||(c.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new khe(e,khe.schemaRules(e)))}};const mRe={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},Ixt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gRe={ol:!0,ul:!0},YA=1,Nhe=2,tA=4;function Nke(t,e,n){return e!=null?(e?YA:0)|(e==="full"?Nhe:0):t&&t.whitespace=="pre"?YA|Nhe:n&~tA}class gL{constructor(e,n,s,i,o,c){this.type=e,this.attrs=n,this.marks=s,this.solid=i,this.options=c,this.content=[],this.activeMarks=Io.none,this.match=o||(c&tA?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(gn.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,i;return(i=s.findWrapping(e.type))?(this.match=s,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&YA)){let s=this.content[this.content.length-1],i;if(s&&s.isText&&(i=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=gn.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(gn.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!mRe.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ske{constructor(e,n,s){this.parser=e,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,c=Nke(null,n.preserveWhitespace,0)|(s?tA:0);i?o=new gL(i.type,i.attrs,Io.none,!0,n.topMatch||i.type.contentMatch,c):s?o=new gL(null,null,Io.none,!0,null,c):o=new gL(e.schema.topNodeType,null,Io.none,!0,null,c),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let s=e.nodeValue,i=this.top,o=i.options&Nhe?"full":this.localPreserveWS||(i.options&YA)>0,{schema:c}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(c.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(c.linebreakReplacement.create())){let a=s.split(/\r?\n|\r/);for(let h=0;h!h.clearMark(m)):n=n.concat(this.parser.schema.marks[h.mark].create(h.attrs)),h.consuming===!1)a=h;else break}}return n}addElementByRule(e,n,s,i){let o,c;if(n.node)if(c=this.parser.schema.nodes[n.node],c.isLeaf)this.insertNode(c.create(n.attrs),s,e.nodeName=="BR")||this.leafFallback(e,s);else{let h=this.enter(c,n.attrs||null,s,n.preserveWhitespace);h&&(o=!0,s=h)}else{let h=this.parser.schema.marks[n.mark];s=s.concat(h.create(n.attrs))}let a=this.top;if(c&&c.isLeaf)this.findInside(e);else if(i)this.addElement(e,s,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(h=>this.insertNode(h,s,!1));else{let h=e;typeof n.contentElement=="string"?h=e.querySelector(n.contentElement):typeof n.contentElement=="function"?h=n.contentElement(e):n.contentElement&&(h=n.contentElement),this.findAround(e,h,!0),this.addAll(h,s),this.findAround(e,h,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,s,i){let o=s||0;for(let c=s?e.childNodes[s]:e.firstChild,a=i==null?null:e.childNodes[i];c!=a;c=c.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(c,n);this.findAtPoint(e,o)}findPlace(e,n,s){let i,o;for(let c=this.open,a=0;c>=0;c--){let h=this.nodes[c],m=h.findWrapping(e);if(m&&(!i||i.length>m.length+a)&&(i=m,o=h,!m.length))break;if(h.solid){if(s)break;a+=2}}if(!i)return null;this.sync(o);for(let c=0;c(c.type?c.type.allowsMarkType(m.type):Mke(m.type,e))?(h=m.addToSet(h),!1):!0),this.nodes.push(new gL(e,n,h,i,null,a)),this.open++,s}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=YA)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let i=s.length-1;i>=0;i--)e+=s[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let s=0;s-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),s=this.options.context,i=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(i?0:1),c=(a,h)=>{for(;a>=0;a--){let m=n[a];if(m==""){if(a==n.length-1||a==0)continue;for(;h>=o;h--)if(c(a-1,h))return!0;return!1}else{let x=h>0||h==0&&i?this.nodes[h].type:s&&h>=o?s.node(h-o).type:null;if(!x||x.name!=m&&!x.isInGroup(m))return!1;h--}}return!0};return c(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function Pxt(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&gRe.hasOwnProperty(s)&&n?(n.appendChild(e),e=n):s=="li"?n=e:s&&(n=null)}}function Lxt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Cke(t){let e={};for(let n in t)e[n]=t[n];return e}function Mke(t,e){let n=e.schema.nodes;for(let s in n){let i=n[s];if(!i.allowsMarkType(t))continue;let o=[],c=a=>{o.push(a);for(let h=0;h{if(o.length||c.marks.length){let a=0,h=0;for(;a=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(e,n,s={}){let i=this.marks[e.type.name];return i&&see(Xle(s),i(e,n),null,e.attrs)}static renderSpec(e,n,s=null,i){return see(e,n,s,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Qj(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Tke(e.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(e){return Tke(e.marks)}}function Tke(t){let e={};for(let n in t){let s=t[n].spec.toDOM;s&&(e[n]=s)}return e}function Xle(t){return t.document||window.document}const Ake=new WeakMap;function Oxt(t){let e=Ake.get(t);return e===void 0&&Ake.set(t,e=Dxt(t)),e}function Dxt(t){let e=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);else for(let i=0;i-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 c=i.indexOf(" ");c>0&&(n=i.slice(0,c),i=i.slice(c+1));let a,h=n?t.createElementNS(n,i):t.createElement(i),m=e[1],x=1;if(m&&typeof m=="object"&&m.nodeType==null&&!Array.isArray(m)){x=2;for(let v in m)if(m[v]!=null){let w=v.indexOf(" ");w>0?h.setAttributeNS(v.slice(0,w),v.slice(w+1),m[v]):v=="style"&&h.style?h.style.cssText=m[v]:h.setAttribute(v,m[v])}}for(let v=x;vx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}else{let{dom:k,contentDOM:C}=see(t,w,n,s);if(h.appendChild(k),C){if(a)throw new RangeError("Multiple content holes");a=C}}}return{dom:h,contentDOM:a}}const xRe=65535,yRe=Math.pow(2,16);function Rxt(t,e){return t+e*yRe}function Eke(t){return t&xRe}function Fxt(t){return(t-(t&xRe))/yRe}const vRe=1,_Re=2,iee=4,bRe=8;class She{constructor(e,n,s){this.pos=e,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&bRe)>0}get deletedBefore(){return(this.delInfo&(vRe|iee))>0}get deletedAfter(){return(this.delInfo&(_Re|iee))>0}get deletedAcross(){return(this.delInfo&iee)>0}}class Fh{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fh.empty)return Fh.empty}recover(e){let n=0,s=Eke(e);if(!this.inverted)for(let i=0;ie)break;let m=this.ranges[a+o],x=this.ranges[a+c],v=h+m;if(e<=v){let w=m?e==h?-1:e==v?1:n:n,k=h+i+(w<0?0:x);if(s)return k;let C=e==(n<0?h:v)?null:Rxt(a/3,e-h),S=e==h?_Re:e==v?vRe:iee;return(n<0?e!=h:e!=v)&&(S|=bRe),new She(k,S,C)}i+=x-m}return s?e+i:new She(e+i,0,null)}touches(e,n){let s=0,i=Eke(n),o=this.inverted?2:1,c=this.inverted?1:2;for(let a=0;ae)break;let m=this.ranges[a+o],x=h+m;if(e<=x&&a==i*3)return!0;s+=this.ranges[a+c]-m}return!1}forEach(e){let n=this.inverted?2:1,s=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?s-i-1:void 0)}}invert(){let e=new XA;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let s=this.from;so&&h!c.isAtom||!a.type.allowsMarkType(this.mark.type)?c:c.mark(this.mark.addToSet(c.marks)),i),n.openStart,n.openEnd);return _c.fromReplace(e,this.from,this.to,o)}invert(){return new ig(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new D0(n.pos,s.pos,this.mark)}merge(e){return e instanceof D0&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new D0(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new D0(n.from,n.to,e.markFromJSON(n.mark))}}tu.jsonID("addMark",D0);class ig extends tu{constructor(e,n,s){super(),this.from=e,this.to=n,this.mark=s}apply(e){let n=e.slice(this.from,this.to),s=new hs(Nxe(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return _c.fromReplace(e,this.from,this.to,s)}invert(){return new D0(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new ig(n.pos,s.pos,this.mark)}merge(e){return e instanceof ig&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ig(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ig(n.from,n.to,e.markFromJSON(n.mark))}}tu.jsonID("removeMark",ig);class R0 extends tu{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return _c.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return _c.fromReplace(e,this.pos,this.pos+1,new hs(gn.from(s),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let i=0;is.pos?null:new ld(n.pos,s.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ld(n.from,n.to,n.gapFrom,n.gapTo,hs.fromJSON(e,n.slice),n.insert,!!n.structure)}}tu.jsonID("replaceAround",ld);function Che(t,e,n){let s=t.resolve(e),i=n-e,o=s.depth;for(;i>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,i--;if(i>0){let c=s.node(o).maybeChild(s.indexAfter(o));for(;i>0;){if(!c||c.isLeaf)return!0;c=c.firstChild,i--}}return!1}function zxt(t,e,n,s){let i=[],o=[],c,a;t.doc.nodesBetween(e,n,(h,m,x)=>{if(!h.isInline)return;let v=h.marks;if(!s.isInSet(v)&&x.type.allowsMarkType(s.type)){let w=Math.max(m,e),k=Math.min(m+h.nodeSize,n),C=s.addToSet(v);for(let S=0;St.step(h)),o.forEach(h=>t.step(h))}function Bxt(t,e,n,s){let i=[],o=0;t.doc.nodesBetween(e,n,(c,a)=>{if(!c.isInline)return;o++;let h=null;if(s instanceof wse){let m=c.marks,x;for(;x=s.isInSet(m);)(h||(h=[])).push(x),m=x.removeFromSet(m)}else s?s.isInSet(c.marks)&&(h=[s]):h=c.marks;if(h&&h.length){let m=Math.min(a+c.nodeSize,n);for(let x=0;xt.step(new ig(c.from,c.to,c.style)))}function Sxe(t,e,n,s=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),c=[],a=e+1;for(let h=0;h=0;h--)t.step(c[h])}function $xt(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function l5(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let s=t.depth,i=0,o=0;;--s){let c=t.$from.node(s),a=t.$from.index(s)+i,h=t.$to.indexAfter(s)-o;if(sn;C--)S||s.index(C)>0?(S=!0,x=gn.from(s.node(C).copy(x)),v++):h--;let w=gn.empty,k=0;for(let C=o,S=!1;C>n;C--)S||i.after(C+1)=0;c--){if(s.size){let a=n[c].type.contentMatch.matchFragment(s);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=gn.from(n[c].type.create(n[c].attrs,s))}let i=e.start,o=e.end;t.step(new ld(i,o,i,o,new hs(s,0,0),n.length,!0))}function Wxt(t,e,n,s,i){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(c,a)=>{let h=typeof i=="function"?i(c):i;if(c.isTextblock&&!c.hasMarkup(s,h)&&Gxt(t.doc,t.mapping.slice(o).map(a),s)){let m=null;if(s.schema.linebreakReplacement){let k=s.whitespace=="pre",C=!!s.contentMatch.matchType(s.schema.linebreakReplacement);k&&!C?m=!1:!k&&C&&(m=!0)}m===!1&&jRe(t,c,a,o),Sxe(t,t.mapping.slice(o).map(a,1),s,void 0,m===null);let x=t.mapping.slice(o),v=x.map(a,1),w=x.map(a+c.nodeSize,1);return t.step(new ld(v,w,v+1,w-1,new hs(gn.from(s.create(h,null,c.marks)),0,0),1,!0)),m===!0&&wRe(t,c,a,o),!1}})}function wRe(t,e,n,s){e.forEach((i,o)=>{if(i.isText){let c,a=/\r?\n|\r/g;for(;c=a.exec(i.text);){let h=t.mapping.slice(s).map(n+1+o+c.index);t.replaceWith(h,h+1,e.type.schema.linebreakReplacement.create())}}})}function jRe(t,e,n,s){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let c=t.mapping.slice(s).map(n+1+o);t.replaceWith(c,c+1,e.type.schema.text(` `))}})}function Gxt(t,e,n){let s=t.resolve(e),i=s.index();return s.parent.canReplaceWith(i,i+1,n)}function Kxt(t,e,n,s,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let c=n.create(s,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,c);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ld(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new hs(gn.from(c),0,0),1,!0))}function zx(t,e,n=1,s){let i=t.resolve(e),o=i.depth-n,c=s&&s[s.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!c.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let m=i.depth-1,x=n-2;m>o;m--,x--){let v=i.node(m),w=i.index(m);if(v.type.spec.isolating)return!1;let k=v.content.cutByIndex(w,v.childCount),C=s&&s[x+1];C&&(k=k.replaceChild(0,C.type.create(C.attrs)));let S=s&&s[x]||v;if(!v.canReplace(w+1,v.childCount)||!S.type.validContent(k))return!1}let a=i.indexAfter(o),h=s&&s[0];return i.node(o).canReplaceWith(a,a,h?h.type:i.node(o+1).type)}function Zxt(t,e,n=1,s){let i=t.doc.resolve(e),o=gn.empty,c=gn.empty;for(let a=i.depth,h=i.depth-n,m=n-1;a>h;a--,m--){o=gn.from(i.node(a).copy(o));let x=s&&s[m];c=gn.from(x?x.type.create(x.attrs,c):i.node(a).copy(c))}t.step(new td(e,e,new hs(o.append(c),n,n),!0))}function V1(t,e){let n=t.resolve(e),s=n.index();return kRe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function Yxt(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:s}=t.type.schema;for(let i=0;i0?(o=s.node(i+1),a++,c=s.node(i).maybeChild(a)):(o=s.node(i).maybeChild(a-1),c=s.node(i+1)),o&&!o.isTextblock&&kRe(o,c)&&s.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?s.before(i):s.after(i)}}function Xxt(t,e,n){let s=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),c=o.node().type;if(i&&c.inlineContent){let x=c.whitespace=="pre",v=!!c.contentMatch.matchType(i);x&&!v?s=!1:!x&&v&&(s=!0)}let a=t.steps.length;if(s===!1){let x=t.doc.resolve(e+n);jRe(t,x.node(),x.before(),a)}c.inlineContent&&Sxe(t,e+n-1,c,o.node().contentMatchAt(o.index()),s==null);let h=t.mapping.slice(a),m=h.map(e-n);if(t.step(new td(m,h.map(e+n,-1),hs.empty,!0)),s===!0){let x=t.doc.resolve(m);wRe(t,x.node(),x.before(),t.steps.length)}return t}function Qxt(t,e,n){let s=t.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),n))return e;if(s.parentOffset==0)for(let i=s.depth-1;i>=0;i--){let o=s.index(i);if(s.node(i).canReplaceWith(o,o,n))return s.before(i+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let i=s.depth-1;i>=0;i--){let o=s.indexAfter(i);if(s.node(i).canReplaceWith(o,o,n))return s.after(i+1);if(o=0;c--){let a=c==s.depth?0:s.pos<=(s.start(c+1)+s.end(c+1))/2?-1:1,h=s.index(c)+(a>0?1:0),m=s.node(c),x=!1;if(o==1)x=m.canReplace(h,h,i);else{let v=m.contentMatchAt(h).findWrapping(i.firstChild.type);x=v&&m.canReplaceWith(h,h,v[0])}if(x)return a==0?s.pos:a<0?s.before(c+1):s.after(c+1)}return null}function kse(t,e,n=e,s=hs.empty){if(e==n&&!s.size)return null;let i=t.resolve(e),o=t.resolve(n);return SRe(i,o,s)?new td(e,n,s):new Jxt(i,o,s).fit()}function SRe(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Jxt{constructor(e,n,s){this.$from=e,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=gn.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=gn.from(e.node(i).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 e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,i=this.close(e<0?this.$to:s.doc.resolve(e));if(!i)return null;let o=this.placed,c=s.depth,a=i.depth;for(;c&&a&&o.childCount==1;)o=o.firstChild.content,c--,a--;let h=new hs(o,c,a);return e>-1?new ld(s.pos,e,this.$to.pos,this.$to.end(),h,n):h.size||s.pos!=this.$to.pos?new td(s.pos,i.pos,h):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,i=this.unplaced.openEnd;s1&&(i=0),o.type.spec.isolating&&i<=s){e=s;break}n=o.content}for(let n=1;n<=2;n++)for(let s=n==1?e:this.unplaced.openStart;s>=0;s--){let i,o=null;s?(o=Jle(this.unplaced.content,s-1).firstChild,i=o.content):i=this.unplaced.content;let c=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:h,match:m}=this.frontier[a],x,v=null;if(n==1&&(c?m.matchType(c.type)||(v=m.fillBefore(gn.from(c),!1)):o&&h.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:a,parent:o,inject:v};if(n==2&&c&&(x=m.findWrapping(c.type)))return{sliceDepth:s,frontierDepth:a,parent:o,wrap:x};if(o&&m.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:s}=this.unplaced,i=Jle(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new hs(e,n+1,Math.max(s,i.size+n>=e.size-s?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:s}=this.unplaced,i=Jle(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new hs(iT(e,n-1,1),n-1,o?n-1:s)}else this.unplaced=new hs(iT(e,n,1),n,s)}placeNodes({sliceDepth:e,frontierDepth:n,parent:s,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let S=0;S1||h==0||S.content.size)&&(v=T,x.push(CRe(S.mark(w.allowedMarks(S.marks)),m==1?h:0,m==a.childCount?k:-1)))}let C=m==a.childCount;C||(k=-1),this.placed=aT(this.placed,n,gn.from(x)),this.frontier[n].match=v,C&&k<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let S=0,T=a;S1&&i==this.$to.end(--s);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:s,type:i}=this.frontier[n],o=n=0;a--){let{match:h,type:m}=this.frontier[a],x=ece(e,a,m,h,!0);if(!x||x.childCount)continue e}return{depth:n,fit:c,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=aT(this.placed,n.depth,n.fit)),e=n.move;for(let s=n.depth+1;s<=e.depth;s++){let i=e.node(s),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(s));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,s){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=aT(this.placed,this.depth,gn.from(e.create(n,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(gn.empty,!0);n.childCount&&(this.placed=aT(this.placed,this.frontier.length,n))}}function iT(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(iT(t.firstChild.content,e-1,n)))}function aT(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(aT(t.lastChild.content,e-1,n)))}function Jle(t,e){for(let n=0;n1&&(s=s.replaceChild(0,CRe(s.firstChild,e-1,s.childCount==1?n-1:0))),e>0&&(s=t.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(t.type.contentMatch.matchFragment(s).fillBefore(gn.empty,!0)))),t.copy(s)}function ece(t,e,n,s,i){let o=t.node(e),c=i?t.indexAfter(e):t.index(e);if(c==o.childCount&&!n.compatibleContent(o.type))return null;let a=s.fillBefore(o.content,!0,c);return a&&!eyt(n,o.content,c)?a:null}function eyt(t,e,n){for(let s=n;s0;w--,k--){let C=i.node(w).type.spec;if(C.defining||C.definingAsContext||C.isolating)break;c.indexOf(w)>-1?a=w:i.before(w)==k&&c.splice(1,0,-w)}let h=c.indexOf(a),m=[],x=s.openStart;for(let w=s.content,k=0;;k++){let C=w.firstChild;if(m.push(C),k==s.openStart)break;w=C.content}for(let w=x-1;w>=0;w--){let k=m[w],C=tyt(k.type);if(C&&!k.sameMarkup(i.node(Math.abs(a)-1)))x=w;else if(C||!k.type.isTextblock)break}for(let w=s.openStart;w>=0;w--){let k=(w+x+1)%(s.openStart+1),C=m[k];if(C)for(let S=0;S=0&&(t.replace(e,n,s),!(t.steps.length>v));w--){let k=c[w];k<0||(e=i.before(k),n=o.after(k))}}function MRe(t,e,n,s,i){if(es){let o=i.contentMatchAt(0),c=o.fillBefore(t).append(t);t=c.append(o.matchFragment(c).fillBefore(gn.empty,!0))}return t}function nyt(t,e,n,s){if(!s.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Qxt(t.doc,e,s.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new hs(gn.from(s),0,0))}function syt(t,e,n){let s=t.doc.resolve(e),i=t.doc.resolve(n),o=TRe(s,i);for(let c=0;c0&&(h||s.node(a-1).canReplace(s.index(a-1),i.indexAfter(a-1))))return t.delete(s.before(a),i.after(a))}for(let c=1;c<=s.depth&&c<=i.depth;c++)if(e-s.start(c)==s.depth-c&&n>s.end(c)&&i.end(c)-n!=i.depth-c&&s.start(c-1)==i.start(c-1)&&s.node(c-1).canReplace(s.index(c-1),i.index(c-1)))return t.delete(s.before(c),n);t.delete(e,n)}function TRe(t,e){let n=[],s=Math.min(t.depth,e.depth);for(let i=s;i>=0;i--){let o=t.start(i);if(oe.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class k4 extends tu{constructor(e,n,s){super(),this.pos=e,this.attr=n,this.value=s}apply(e){let n=e.nodeAt(this.pos);if(!n)return _c.fail("No node at attribute step's position");let s=Object.create(null);for(let o in n.attrs)s[o]=n.attrs[o];s[this.attr]=this.value;let i=n.type.create(s,null,n.marks);return _c.fromReplace(e,this.pos,this.pos+1,new hs(gn.from(i),0,n.isLeaf?0:1))}getMap(){return Fh.empty}invert(e){return new k4(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new k4(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new k4(n.pos,n.attr,n.value)}}tu.jsonID("attr",k4);class QA extends tu{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let s=e.type.create(n,e.content,e.marks);return _c.ok(s)}getMap(){return Fh.empty}invert(e){return new QA(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new QA(n.attr,n.value)}}tu.jsonID("docAttr",QA);let uC=class extends Error{};uC=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};uC.prototype=Object.create(Error.prototype);uC.prototype.constructor=uC;uC.prototype.name="TransformError";class ARe{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new XA}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new uC(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,s=hs.empty){let i=kse(this.doc,e,n,s);return i&&this.step(i),this}replaceWith(e,n,s){return this.replace(e,n,new hs(gn.from(s),0,0))}delete(e,n){return this.replace(e,n,hs.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,s){return ryt(this,e,n,s),this}replaceRangeWith(e,n,s){return nyt(this,e,n,s),this}deleteRange(e,n){return syt(this,e,n),this}lift(e,n){return Uxt(this,e,n),this}join(e,n=1){return Xxt(this,e,n),this}wrap(e,n){return Hxt(this,e,n),this}setBlockType(e,n=e,s,i=null){return Wxt(this,e,n,s,i),this}setNodeMarkup(e,n,s=null,i){return Kxt(this,e,n,s,i),this}setNodeAttribute(e,n,s){return this.step(new k4(e,n,s)),this}setDocAttribute(e,n){return this.step(new QA(e,n)),this}addNodeMark(e,n){return this.step(new R0(e,n)),this}removeNodeMark(e,n){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(n instanceof Io)n.isInSet(s.marks)&&this.step(new Dj(e,n));else{let i=s.marks,o,c=[];for(;o=n.isInSet(i);)c.push(new Dj(e,o)),i=o.removeFromSet(i);for(let a=c.length-1;a>=0;a--)this.step(c[a])}return this}split(e,n=1,s){return Zxt(this,e,n,s),this}addMark(e,n,s){return zxt(this,e,n,s),this}removeMark(e,n,s){return Bxt(this,e,n,s),this}clearIncompatible(e,n,s){return Sxe(this,e,n,s),this}}const tce=Object.create(null);class la{constructor(e,n,s){this.$anchor=e,this.$head=n,this.ranges=s||[new iyt(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;o--){let c=n<0?hS(e.node(0),e.node(o),e.before(o+1),e.index(o),n,s):hS(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,s);if(c)return c}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Gh(e.node(0))}static atStart(e){return hS(e,e,0,0,1)||new Gh(e)}static atEnd(e){return hS(e,e,e.content.size,e.childCount,-1)||new Gh(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=tce[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(e,n)}static jsonID(e,n){if(e in tce)throw new RangeError("Duplicate use of selection JSON ID "+e);return tce[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Bi.between(this.$anchor,this.$head).getBookmark()}}la.prototype.visible=!0;class iyt{constructor(e,n){this.$from=e,this.$to=n}}let Pke=!1;function Lke(t){!Pke&&!t.parent.inlineContent&&(Pke=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Bi extends la{constructor(e,n=e){Lke(e),Lke(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let s=e.resolve(n.map(this.head));if(!s.parent.inlineContent)return la.near(s);let i=e.resolve(n.map(this.anchor));return new Bi(i.parent.inlineContent?i:s,s)}replace(e,n=hs.empty){if(super.replace(e,n),n==hs.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof Bi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nse(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Bi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,s=n){let i=e.resolve(n);return new this(i,s==n?i:e.resolve(s))}static between(e,n,s){let i=e.pos-n.pos;if((!s||i)&&(s=i>=0?1:-1),!n.parent.inlineContent){let o=la.findFrom(n,s,!0)||la.findFrom(n,-s,!0);if(o)n=o.$head;else return la.near(n,s)}return e.parent.inlineContent||(i==0?e=n:(e=(la.findFrom(e,-s,!0)||la.findFrom(e,s,!0)).$anchor,e.pos0?0:1);i>0?c=0;c+=i){let a=e.child(c);if(a.isAtom){if(!o&&ti.isSelectable(a))return ti.create(t,n-(i<0?a.nodeSize:0))}else{let h=hS(t,a,n+i,i<0?a.childCount:0,i,o);if(h)return h}n+=a.nodeSize*i}return null}function Oke(t,e,n){let s=t.steps.length-1;if(s{c==null&&(c=x)}),t.setSelection(la.near(t.doc.resolve(c),n))}const Dke=1,xL=2,Rke=4;class oyt extends ARe{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xL,this}ensureMarks(e){return Io.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&xL)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~xL,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let s=this.selection;return n&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||Io.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,s){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(s==null&&(s=n),!e)return this.deleteRange(n,s);let o=this.storedMarks;if(!o){let c=this.doc.resolve(n);o=s==n?c.marks():c.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(la.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Rke,this}get scrolledIntoView(){return(this.updated&Rke)>0}}function Fke(t,e){return!e||!t?t:t.bind(e)}class oT{constructor(e,n,s){this.name=e,this.init=Fke(n.init,s),this.apply=Fke(n.apply,s)}}const lyt=[new oT("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new oT("selection",{init(t,e){return t.selection||la.atStart(e.doc)},apply(t){return t.selection}}),new oT("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,s){return s.selection.$cursor?t.storedMarks:null}}),new oT("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class rce{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=lyt.slice(),n&&n.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new oT(s.key,s.spec.state,s))})}}class CS{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let s=0;ss.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[s],o=i.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new rce(e.schema,e.plugins),o=new CS(i);return i.fields.forEach(c=>{if(c.name=="doc")o.doc=g1.fromJSON(e.schema,n.doc);else if(c.name=="selection")o.selection=la.fromJSON(o.doc,n.selection);else if(c.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let a in s){let h=s[a],m=h.spec.state;if(h.key==c.name&&m&&m.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[c.name]=m.fromJSON.call(h,e,n[a],o);return}}o[c.name]=c.init(e,o)}}),o}}function ERe(t,e,n){for(let s in t){let i=t[s];i instanceof Function?i=i.bind(e):s=="handleDOMEvents"&&(i=ERe(i,e,{})),n[s]=i}return n}class Ld{constructor(e){this.spec=e,this.props={},e.props&&ERe(e.props,this,this.props),this.key=e.key?e.key.key:IRe("plugin")}getState(e){return e[this.key]}}const nce=Object.create(null);function IRe(t){return t in nce?t+"$"+ ++nce[t]:(nce[t]=0,t+"$")}class nf{constructor(e="key"){this.key=IRe(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Sd=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},hC=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Mhe=null;const px=function(t,e,n){let s=Mhe||(Mhe=document.createRange());return s.setEnd(t,n??t.nodeValue.length),s.setStart(t,e||0),s},cyt=function(){Mhe=null},Rj=function(t,e,n,s){return n&&(zke(t,e,n,s,-1)||zke(t,e,n,s,1))},dyt=/^(img|br|input|textarea|hr)$/i;function zke(t,e,n,s,i){for(var o;;){if(t==n&&e==s)return!0;if(e==(i<0?0:If(t))){let c=t.parentNode;if(!c||c.nodeType!=1||wI(t)||dyt.test(t.nodeName)||t.contentEditable=="false")return!1;e=Sd(t)+(i<0?0:1),t=c}else if(t.nodeType==1){let c=t.childNodes[e+(i<0?-1:0)];if(c.nodeType==1&&c.contentEditable=="false")if(!((o=c.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=c,e=i<0?If(t):0}else return!1}}function If(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function uyt(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=If(t)}else if(t.parentNode&&!wI(t))e=Sd(t),t=t.parentNode;else return null}}function hyt(t,e){for(;;){if(t.nodeType==3&&e2),Cf=fC||(wg?/Mac/.test(wg.platform):!1),ORe=wg?/Win/.test(wg.platform):!1,Sx=/Android \d/.test(H1),jI=!!Bke&&"webkitFontSmoothing"in Bke.documentElement.style,gyt=jI?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xyt(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ax(t,e){return typeof t=="number"?t:t[e]}function yyt(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,s=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*s}}function $ke(t,e,n){let s=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let c=n||t.dom;c;){if(c.nodeType!=1){c=hC(c);continue}let a=c,h=a==o.body,m=h?xyt(o):yyt(a),x=0,v=0;if(e.topm.bottom-ax(s,"bottom")&&(v=e.bottom-e.top>m.bottom-m.top?e.top+ax(i,"top")-m.top:e.bottom-m.bottom+ax(i,"bottom")),e.leftm.right-ax(s,"right")&&(x=e.right-m.right+ax(i,"right")),x||v)if(h)o.defaultView.scrollBy(x,v);else{let k=a.scrollLeft,C=a.scrollTop;v&&(a.scrollTop+=v),x&&(a.scrollLeft+=x);let S=a.scrollLeft-k,T=a.scrollTop-C;e={left:e.left-S,top:e.top-T,right:e.right-S,bottom:e.bottom-T}}let w=h?"fixed":getComputedStyle(c).position;if(/^(fixed|sticky)$/.test(w))break;c=w=="absolute"?c.offsetParent:hC(c)}}function vyt(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),s,i;for(let o=(e.left+e.right)/2,c=n+1;c=n-20){s=a,i=h.top;break}}return{refDOM:s,refTop:i,stack:DRe(t.dom)}}function DRe(t){let e=[],n=t.ownerDocument;for(let s=t;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),t!=n);s=hC(s));return e}function _yt({refDOM:t,refTop:e,stack:n}){let s=t?t.getBoundingClientRect().top:0;RRe(n,s==0?0:s-e)}function RRe(t,e){for(let n=0;n=a){c=Math.max(C.bottom,c),a=Math.min(C.top,a);let S=C.left>e.left?C.left-e.left:C.right=(C.left+C.right)/2?1:0));continue}}else C.top>e.top&&!h&&C.left<=e.left&&C.right>=e.left&&(h=x,m={left:Math.max(C.left,Math.min(C.right,e.left)),top:C.top});!n&&(e.left>=C.right&&e.top>=C.top||e.left>=C.left&&e.top>=C.bottom)&&(o=v+1)}}return!n&&h&&(n=h,i=m,s=0),n&&n.nodeType==3?wyt(n,i):!n||s&&n.nodeType==1?{node:t,offset:o}:FRe(n,i)}function wyt(t,e){let n=t.nodeValue.length,s=document.createRange(),i;for(let o=0;o=(c.left+c.right)/2?1:0)};break}}return s.detach(),i||{node:t,offset:0}}function Txe(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function jyt(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(c.left+c.right)/2?1:-1}return t.docView.posFromDOM(s,i,o)}function Nyt(t,e,n,s){let i=-1;for(let o=e,c=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0),h;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((h=a.dom.getBoundingClientRect()).width||h.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!c&&h.left>s.left||h.top>s.top?i=a.posBefore:(!c&&h.right-1?i:t.docView.posFromDOM(e,n,-1)}function zRe(t,e,n){let s=t.childNodes.length;if(s&&n.tope.top&&i++}let m;jI&&i&&s.nodeType==1&&(m=s.childNodes[i-1]).nodeType==1&&m.contentEditable=="false"&&m.getBoundingClientRect().top>=e.top&&i--,s==t.dom&&i==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||s.nodeType!=1||s.childNodes[i-1].nodeName!="BR")&&(a=Nyt(t,s,i,e))}a==null&&(a=kyt(t,c,e));let h=t.docView.nearestDesc(c,!0);return{pos:a,inside:h?h.posAtStart-h.border:-1}}function Uke(t){return t.top=0&&i==s.nodeValue.length?(h--,x=1):n<0?h--:m++,OM(e0(px(s,h,m),x),x<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==If(s))){let h=s.childNodes[i-1];if(h.nodeType==1)return sce(h.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==If(s))){let h=s.childNodes[i-1],m=h.nodeType==3?px(h,If(h)-(c?0:1)):h.nodeType==1&&(h.nodeName!="BR"||!h.nextSibling)?h:null;if(m)return OM(e0(m,1),!1)}if(o==null&&i=0)}function OM(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function sce(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function $Re(t,e,n){let s=t.state,i=t.root.activeElement;s!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{s!=e&&t.updateState(s),i!=t.dom&&i&&i.focus()}}function Myt(t,e,n){let s=e.selection,i=n=="up"?s.$from:s.$to;return $Re(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let c=BRe(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let h;if(a.nodeType==1)h=a.getClientRects();else if(a.nodeType==3)h=px(a,0,a.nodeValue.length).getClientRects();else continue;for(let m=0;mx.top+1&&(n=="up"?c.top-x.top>(x.bottom-c.top)*2:x.bottom-c.bottom>(c.bottom-x.top)*2))return!1}}return!0})}const Tyt=/[\u0590-\u08ac]/;function Ayt(t,e,n){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let i=s.parentOffset,o=!i,c=i==s.parent.content.size,a=t.domSelection();return a?!Tyt.test(s.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:c:$Re(t,e,()=>{let{focusNode:h,focusOffset:m,anchorNode:x,anchorOffset:v}=t.domSelectionRange(),w=a.caretBidiLevel;a.modify("move",n,"character");let k=s.depth?t.docView.domAfterPos(s.before()):t.dom,{focusNode:C,focusOffset:S}=t.domSelectionRange(),T=C&&!k.contains(C.nodeType==1?C:C.parentNode)||h==C&&m==S;try{a.collapse(x,v),h&&(h!=x||m!=v)&&a.extend&&a.extend(h,m)}catch{}return w!=null&&(a.caretBidiLevel=w),T}):s.pos==s.start()||s.pos==s.end()}let qke=null,Vke=null,Hke=!1;function Eyt(t,e,n){return qke==e&&Vke==n?Hke:(qke=e,Vke=n,Hke=n=="up"||n=="down"?Myt(t,e,n):Ayt(t,e,n))}const Wf=0,Wke=1,Nw=2,jg=3;class kI{constructor(e,n,s,i){this.parent=e,this.children=n,this.dom=s,this.contentDOM=i,this.dirty=Wf,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nSd(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let s=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),c;if(o&&(!n||o.node))if(s&&(c=o.nodeDOM)&&!(c.nodeType==1?c.contains(e.nodeType==1?e:e.parentNode):c==e))s=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let s=n;s;s=s.parent)if(s==this)return n}posFromDOM(e,n,s){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,s)}return-1}descAt(e){for(let n=0,s=0;ne||c instanceof qRe){i=e-o;break}o=a}if(i)return this.children[s].domFromPos(i-this.children[s].border,n);for(let o;s&&!(o=this.children[s-1]).size&&o instanceof URe&&o.side>=0;s--);if(n<=0){let o,c=!0;for(;o=s?this.children[s-1]:null,!(!o||o.dom.parentNode==this.contentDOM);s--,c=!1);return o&&n&&c&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Sd(o.dom)+1:0}}else{let o,c=!0;for(;o=s=x&&n<=m-h.border&&h.node&&h.contentDOM&&this.contentDOM.contains(h.contentDOM))return h.parseRange(e,n,x);e=c;for(let v=a;v>0;v--){let w=this.children[v-1];if(w.size&&w.dom.parentNode==this.contentDOM&&!w.emptyChildAt(1)){i=Sd(w.dom)+1;break}e-=w.size}i==-1&&(i=0)}if(i>-1&&(m>n||a==this.children.length-1)){n=m;for(let x=a+1;xC&&cn){let C=a;a=h,h=C}let k=document.createRange();k.setEnd(h.node,h.offset),k.setStart(a.node,a.offset),m.removeAllRanges(),m.addRange(k)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let s=0,i=0;i=s:es){let a=s+o.border,h=c-o.border;if(e>=a&&n<=h){this.dirty=e==s||n==c?Nw:Wke,e==a&&n==h&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=jg:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Nw:jg}s=c}this.dirty=Nw}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let s=e==1?Nw:Wke;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(c.nodeType!=1){let a=document.createElement("span");a.appendChild(c),c=a}c.contentEditable="false",c.classList.add("ProseMirror-widget")}super(e,[],c,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Wf&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Iyt extends kI{constructor(e,n,s,i){super(e,[],n,null),this.textDOM=s,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Fj extends kI{constructor(e,n,s,i,o){super(e,[],s,i),this.mark=n,this.spec=o}static create(e,n,s,i){let o=i.nodeViews[n.type.name],c=o&&o(n,i,s);return(!c||!c.dom)&&(c=Qj.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new Fj(e,n,c.dom,c.contentDOM||c.dom,c)}parseRule(){return this.dirty&jg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jg&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Wf){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=Phe(o,0,e,s));for(let a=0;a{if(!h)return c;if(h.parent)return h.parent.posBeforeChild(h)},s,i),x=m&&m.dom,v=m&&m.contentDOM;if(n.isText){if(!x)x=document.createTextNode(n.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:v}=Qj.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!v&&!n.isText&&x.nodeName!="BR"&&(x.hasAttribute("contenteditable")||(x.contentEditable="false"),n.type.spec.draggable&&(x.draggable=!0));let w=x;return x=WRe(x,s,n),m?h=new Pyt(e,n,s,i,x,v||null,w,m,o,c+1):n.isText?new Cse(e,n,s,i,x,w,o):new y1(e,n,s,i,x,v||null,w,o,c+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let s=this.children[n];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>gn.empty)}return e}matchesNode(e,n,s){return this.dirty==Wf&&e.eq(this.node)&&kte(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let s=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,c=o&&o.pos>-1?o:null,a=o&&o.pos<0,h=new Oyt(this,c&&c.node,e);Fyt(this.node,this.innerDeco,(m,x,v)=>{m.spec.marks?h.syncToMarks(m.spec.marks,s,e):m.type.side>=0&&!v&&h.syncToMarks(x==this.node.childCount?Io.none:this.node.child(x).marks,s,e),h.placeWidget(m,e,i)},(m,x,v,w)=>{h.syncToMarks(m.marks,s,e);let k;h.findNodeMatch(m,x,v,w)||a&&e.state.selection.from>i&&e.state.selection.to-1&&h.updateNodeAt(m,x,v,k,e)||h.updateNextNode(m,x,v,e,w,i)||h.addNode(m,x,v,e,i),i+=m.nodeSize}),h.syncToMarks([],s,e),this.node.isTextblock&&h.addTextblockHacks(),h.destroyRest(),(h.changed||this.dirty==Nw)&&(c&&this.protectLocalComposition(e,c),VRe(this.contentDOM,this.children,e),fC&&zyt(this.dom))}localCompositionInfo(e,n){let{from:s,to:i}=e.state.selection;if(!(e.state.selection instanceof Bi)||sn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let c=o.nodeValue,a=Byt(this.node.content,c,s-n,i-n);return a<0?null:{node:o,pos:a,text:c}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:s,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let c=new Iyt(this,o,n,i);e.input.compositionNodes.push(c),this.children=Phe(this.children,s,s+i.length,e,c)}update(e,n,s,i){return this.dirty==jg||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,s,i),!0)}updateInner(e,n,s,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Wf}updateOuterDeco(e){if(kte(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=HRe(this.dom,this.nodeDOM,Ihe(this.outerDeco,this.node,n),Ihe(e,this.node,n)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Gke(t,e,n,s,i){WRe(s,e,t);let o=new y1(void 0,t,e,n,s,s,s,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Cse extends y1{constructor(e,n,s,i,o,c,a){super(e,n,s,i,o,null,c,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,s,i){return this.dirty==jg||this.dirty!=Wf&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Wf||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Wf,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,s){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,s){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new Cse(this.parent,i,this.outerDeco,this.innerDeco,o,o,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=jg)}get domAtom(){return!1}isText(e){return this.node.text==e}}class qRe extends kI{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Wf&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Pyt extends y1{constructor(e,n,s,i,o,c,a,h,m,x){super(e,n,s,i,o,c,a,m,x),this.spec=h}update(e,n,s,i){if(this.dirty==jg)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,s);return o&&this.updateInner(e,n,s,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,s,i){this.spec.setSelection?this.spec.setSelection(e,n,s.root):super.setSelection(e,n,s,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function VRe(t,e,n){let s=t.firstChild,i=!1;for(let o=0;o>1,c=Math.min(o,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let h=Fj.create(this.top,e[o],n,s);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,s,i){let o=-1,c;if(i>=this.preMatch.index&&(c=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&c.matchesNode(e,n,s))o=this.top.children.indexOf(c,this.index);else for(let a=this.index,h=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(s){let m=n.children[s-1];if(m instanceof Fj)n=m,s=m.children.length;else{a=m,s--;break}}else{if(n==e)break e;s=n.parent.children.indexOf(n),n=n.parent}let h=a.node;if(h){if(h!=t.child(i-1))break;--i,o.set(a,i),c.push(a)}}return{index:i,matched:o,matches:c.reverse()}}function Ryt(t,e){return t.type.side-e.type.side}function Fyt(t,e,n,s){let i=e.locals(t),o=0;if(i.length==0){for(let m=0;mo;)a.push(i[c++]);let C=o+w.nodeSize;if(w.isText){let T=C;c!T.inline):a.slice();s(w,S,e.forChild(o,w),k),o=C}}function zyt(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Byt(t,e,n,s){for(let i=0,o=0;i=n){if(o>=s&&h.slice(s-e.length-a,s-a)==e)return s-e.length;let m=a=0&&m+e.length+a>=n)return a+m;if(n==s&&h.length>=s+e.length-a&&h.slice(s-a,s-a+e.length)==e)return s}}return-1}function Phe(t,e,n,s,i){let o=[];for(let c=0,a=0;c=n||x<=e?o.push(h):(mn&&o.push(h.slice(n-m,h.size,s)))}return o}function Axe(t,e=null){let n=t.domSelectionRange(),s=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,c=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(c<0)return null;let a=s.resolve(c),h,m;if(Sse(n)){for(h=c;i&&!i.node;)i=i.parent;let v=i.node;if(i&&v.isAtom&&ti.isSelectable(v)&&i.parent&&!(v.isInline&&fyt(n.focusNode,n.focusOffset,i.dom))){let w=i.posBefore;m=new ti(c==w?a:s.resolve(w))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let v=c,w=c;for(let k=0;k{(n.anchorNode!=s||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!GRe(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Uyt(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,s=n.nodeName=="IMG";s?e.collapse(n.parentNode,Sd(n)+1):e.collapse(n,0),!s&&!t.state.selection.visible&&ph&&x1<=11&&(n.disabled=!0,n.disabled=!1)}function KRe(t,e){if(e instanceof ti){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Qke(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Qke(t)}function Qke(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Exe(t,e,n,s){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Bi.between(e,n,s)}function Jke(t){return t.editable&&!t.hasFocus()?!1:ZRe(t)}function ZRe(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function qyt(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Rj(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Lhe(t,e){let{$anchor:n,$head:s}=t.selection,i=e>0?n.max(s):n.min(s),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&la.findFrom(o,e)}function c0(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function eNe(t,e,n){let s=t.state.selection;if(s instanceof Bi)if(n.indexOf("s")>-1){let{$head:i}=s,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let c=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return c0(t,new Bi(s.$anchor,c))}else if(s.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Lhe(t.state,e);return i&&i instanceof ti?c0(t,i):!1}else if(!(Cf&&n.indexOf("m")>-1)){let i=s.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,c;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(c=t.docView.descAt(a))&&!c.contentDOM?ti.isSelectable(o)?c0(t,new ti(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):jI?c0(t,new Bi(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof ti&&s.node.isInline)return c0(t,new Bi(e>0?s.$to:s.$from));{let i=Lhe(t.state,e);return i?c0(t,i):!1}}}function Nte(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function nA(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function tS(t,e){return e<0?Vyt(t):Hyt(t)}function Vyt(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let i,o,c=!1;for(Hf&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let a=n.childNodes[s-1];if(nA(a,-1))i=n,o=--s;else if(a.nodeType==3)n=a,s=n.nodeValue.length;else break}}else{if(YRe(n))break;{let a=n.previousSibling;for(;a&&nA(a,-1);)i=n.parentNode,o=Sd(a),a=a.previousSibling;if(a)n=a,s=Nte(n);else{if(n=n.parentNode,n==t.dom)break;s=0}}}c?Ohe(t,n,s):i&&Ohe(t,i,o)}function Hyt(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let i=Nte(n),o,c;for(;;)if(s{t.state==i&&Bx(t)},50)}function tNe(t,e){let n=t.state.doc.resolve(e);if(!(nd||ORe)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),c=(o.top+o.bottom)/2;if(c>i.top&&c1)return o.lefti.top&&c1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function rNe(t,e,n){let s=t.state.selection;if(s instanceof Bi&&!s.empty||n.indexOf("s")>-1||Cf&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=s;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let c=Lhe(t.state,e);if(c&&c instanceof ti)return c0(t,c)}if(!i.parent.inlineContent){let c=e<0?i:o,a=s instanceof Gh?la.near(c,e):la.findFrom(c,e);return a?c0(t,a):!1}return!1}function nNe(t,e){if(!(t.state.selection instanceof Bi))return!0;let{$head:n,$anchor:s,empty:i}=t.state.selection;if(!n.sameParent(s))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let c=t.state.tr;return e<0?c.delete(n.pos-o.nodeSize,n.pos):c.delete(n.pos,n.pos+o.nodeSize),t.dispatch(c),!0}return!1}function sNe(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Kyt(t){if(!eu||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let s=e.firstChild;sNe(t,s,"true"),setTimeout(()=>sNe(t,s,"false"),20)}return!1}function Zyt(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Yyt(t,e){let n=e.keyCode,s=Zyt(e);if(n==8||Cf&&n==72&&s=="c")return nNe(t,-1)||tS(t,-1);if(n==46&&!e.shiftKey||Cf&&n==68&&s=="c")return nNe(t,1)||tS(t,1);if(n==13||n==27)return!0;if(n==37||Cf&&n==66&&s=="c"){let i=n==37?tNe(t,t.state.selection.from)=="ltr"?-1:1:-1;return eNe(t,i,s)||tS(t,i)}else if(n==39||Cf&&n==70&&s=="c"){let i=n==39?tNe(t,t.state.selection.from)=="ltr"?1:-1:1;return eNe(t,i,s)||tS(t,i)}else{if(n==38||Cf&&n==80&&s=="c")return rNe(t,-1,s)||tS(t,-1);if(n==40||Cf&&n==78&&s=="c")return Kyt(t)||rNe(t,1,s)||tS(t,1);if(s==(Cf?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ixe(t,e){t.someProp("transformCopied",k=>{e=k(e,t)});let n=[],{content:s,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){i--,o--;let k=s.firstChild;n.push(k.type.name,k.attrs!=k.type.defaultAttrs?k.attrs:null),s=k.content}let c=t.someProp("clipboardSerializer")||Qj.fromSchema(t.state.schema),a=rFe(),h=a.createElement("div");h.appendChild(c.serializeFragment(s,{document:a}));let m=h.firstChild,x,v=0;for(;m&&m.nodeType==1&&(x=tFe[m.nodeName.toLowerCase()]);){for(let k=x.length-1;k>=0;k--){let C=a.createElement(x[k]);for(;h.firstChild;)C.appendChild(h.firstChild);h.appendChild(C),v++}m=h.firstChild}m&&m.nodeType==1&&m.setAttribute("data-pm-slice",`${i} ${o}${v?` -${v}`:""} ${JSON.stringify(n)}`);let w=t.someProp("clipboardTextSerializer",k=>k(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:h,text:w,slice:e}}function XRe(t,e,n,s,i){let o=i.parent.type.spec.code,c,a;if(!n&&!e)return null;let h=!!e&&(s||o||!n);if(h){if(t.someProp("transformPastedText",w=>{e=w(e,o||s,t)}),o)return a=new hs(gn.from(t.state.schema.text(e.replace(/\r\n?/g,` `))),0,0),t.someProp("transformPasted",w=>{a=w(a,t,!0)}),a;let v=t.someProp("clipboardTextParser",w=>w(e,i,s,t));if(v)a=v;else{let w=i.marks(),{schema:k}=t.state,C=Qj.fromSchema(k);c=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(S=>{let T=c.appendChild(document.createElement("p"));S&&T.appendChild(C.serializeNode(k.text(S,w)))})}}else t.someProp("transformPastedHTML",v=>{n=v(n,t)}),c=e0t(n),jI&&t0t(c);let m=c&&c.querySelector("[data-pm-slice]"),x=m&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(m.getAttribute("data-pm-slice")||"");if(x&&x[3])for(let v=+x[3];v>0;v--){let w=c.firstChild;for(;w&&w.nodeType!=1;)w=w.nextSibling;if(!w)break;c=w}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||eA.fromSchema(t.state.schema)).parseSlice(c,{preserveWhitespace:!!(h||x),context:i,ruleFromNode(w){return w.nodeName=="BR"&&!w.nextSibling&&w.parentNode&&!Xyt.test(w.parentNode.nodeName)?{ignore:!0}:null}})),x)a=r0t(iNe(a,+x[1],+x[2]),x[4]);else if(a=hs.maxOpen(Qyt(a.content,i),!0),a.openStart||a.openEnd){let v=0,w=0;for(let k=a.content.firstChild;v{a=v(a,t,h)}),a}const Xyt=/^(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 Qyt(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,c=[];if(t.forEach(a=>{if(!c)return;let h=i.findWrapping(a.type),m;if(!h)return c=null;if(m=c.length&&o.length&&JRe(h,o,a,c[c.length-1],0))c[c.length-1]=m;else{c.length&&(c[c.length-1]=eFe(c[c.length-1],o.length));let x=QRe(a,h);c.push(x),i=i.matchType(x.type),o=h}}),c)return gn.from(c)}return t}function QRe(t,e,n=0){for(let s=e.length-1;s>=n;s--)t=e[s].create(null,gn.from(t));return t}function JRe(t,e,n,s,i){if(i1&&(o=0),i=n&&(a=e<0?c.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(c.contentMatchAt(c.childCount).fillBefore(gn.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,c.copy(a))}function iNe(t,e,n){return en})),ace.createHTML(t)):t}function e0t(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=rFe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&tFe[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"").reverse().join("")),n.innerHTML=Jyt(t),i)for(let o=0;o=0;a-=2){let h=n.nodes[s[a]];if(!h||h.hasRequiredAttrs())break;i=gn.from(h.create(s[a+1],i)),o++,c++}return new hs(i,o,c)}const Iu={},Pu={},n0t={touchstart:!0,touchmove:!0};class s0t{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 i0t(t){for(let e in Iu){let n=Iu[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=s=>{o0t(t,s)&&!Pxe(t,s)&&(t.editable||!(s.type in Pu))&&n(t,s)},n0t[e]?{passive:!0}:void 0)}eu&&t.dom.addEventListener("input",()=>null),Rhe(t)}function F0(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function a0t(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Rhe(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=s=>Pxe(t,s))})}function Pxe(t,e){return t.someProp("handleDOMEvents",n=>{let s=n[e.type];return s?s(t,e)||e.defaultPrevented:!1})}function o0t(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function l0t(t,e){!Pxe(t,e)&&Iu[e.type]&&(t.editable||!(e.type in Pu))&&Iu[e.type](t,e)}Pu.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!sFe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Sx&&nd&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),fC&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let s=Date.now();t.input.lastIOSEnter=s,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==s&&(t.someProp("handleKeyDown",i=>i(t,gw(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",s=>s(t,n))||Yyt(t,n)?n.preventDefault():F0(t,"key")};Pu.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Pu.keypress=(t,e)=>{let n=e;if(sFe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Cf&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let s=t.state.selection;if(!(s instanceof Bi)||!s.$from.sameParent(s.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",c=>c(t,s.$from.pos,s.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Mse(t){return{left:t.clientX,top:t.clientY}}function c0t(t,e){let n=e.x-t.clientX,s=e.y-t.clientY;return n*n+s*s<100}function Lxe(t,e,n,s,i){if(s==-1)return!1;let o=t.state.doc.resolve(s);for(let c=o.depth+1;c>0;c--)if(t.someProp(e,a=>c>o.depth?a(t,n,o.nodeAfter,o.before(c),i,!0):a(t,n,o.node(c),o.before(c),i,!1)))return!0;return!1}function N4(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let s=t.state.tr.setSelection(e);s.setMeta("pointer",!0),t.dispatch(s)}function d0t(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),s=n.nodeAfter;return s&&s.isAtom&&ti.isSelectable(s)?(N4(t,new ti(n)),!0):!1}function u0t(t,e){if(e==-1)return!1;let n=t.state.selection,s,i;n instanceof ti&&(s=n.node);let o=t.state.doc.resolve(e);for(let c=o.depth+1;c>0;c--){let a=c>o.depth?o.nodeAfter:o.node(c);if(ti.isSelectable(a)){s&&n.$from.depth>0&&c>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(c);break}}return i!=null?(N4(t,ti.create(t.state.doc,i)),!0):!1}function h0t(t,e,n,s,i){return Lxe(t,"handleClickOn",e,n,s)||t.someProp("handleClick",o=>o(t,e,s))||(i?u0t(t,n):d0t(t,n))}function f0t(t,e,n,s){return Lxe(t,"handleDoubleClickOn",e,n,s)||t.someProp("handleDoubleClick",i=>i(t,e,s))}function p0t(t,e,n,s){return Lxe(t,"handleTripleClickOn",e,n,s)||t.someProp("handleTripleClick",i=>i(t,e,s))||m0t(t,n,s)}function m0t(t,e,n){if(n.button!=0)return!1;let s=t.state.doc;if(e==-1)return s.inlineContent?(N4(t,Bi.create(s,0,s.content.size)),!0):!1;let i=s.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(c.inlineContent)N4(t,Bi.create(s,a+1,a+1+c.content.size));else if(ti.isSelectable(c))N4(t,ti.create(s,a));else continue;return!0}}function Oxe(t){return Ste(t)}const nFe=Cf?"metaKey":"ctrlKey";Iu.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let s=Oxe(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&c0t(n,t.input.lastClick)&&!n[nFe]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let c=t.posAtCoords(Mse(n));c&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new g0t(t,c,n,!!s)):(o=="doubleClick"?f0t:p0t)(t,c.pos,c.inside,n)?n.preventDefault():F0(t,"pointer"))};class g0t{constructor(e,n,s,i){this.view=e,this.pos=n,this.event=s,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[nFe],this.allowDefault=s.shiftKey;let o,c;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),c=n.inside;else{let x=e.state.doc.resolve(n.pos);o=x.parent,c=x.depth?x.before():0}const a=i?null:s.target,h=a?e.docView.nearestDesc(a,!0):null;this.target=h&&h.nodeDOM.nodeType==1?h.nodeDOM:null;let{selection:m}=e.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||m instanceof ti&&m.from<=c&&m.to>c)&&(this.mightDrag={node:o,pos:c,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Hf&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),F0(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Bx(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Mse(e))),this.updateAllowDefault(e),this.allowDefault||!n?F0(this.view,"pointer"):h0t(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||eu&&this.mightDrag&&!this.mightDrag.node.isAtom||nd&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(N4(this.view,la.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):F0(this.view,"pointer")}move(e){this.updateAllowDefault(e),F0(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Iu.touchstart=t=>{t.input.lastTouch=Date.now(),Oxe(t),F0(t,"pointer")};Iu.touchmove=t=>{t.input.lastTouch=Date.now(),F0(t,"pointer")};Iu.contextmenu=t=>Oxe(t);function sFe(t,e){return t.composing?!0:eu&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const x0t=Sx?5e3:-1;Pu.compositionstart=Pu.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Bi&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||nd&&ORe&&y0t(t)))t.markCursor=t.state.storedMarks||n.marks(),Ste(t,!0),t.markCursor=null;else if(Ste(t,!e.selection.empty),Hf&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=t.domSelectionRange();for(let i=s.focusNode,o=s.focusOffset;i&&i.nodeType==1&&o!=0;){let c=o<0?i.lastChild:i.childNodes[o-1];if(!c)break;if(c.nodeType==3){let a=t.domSelection();a&&a.collapse(c,c.nodeValue.length);break}else i=c,o=-1}}t.input.composing=!0}iFe(t,x0t)};function y0t(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let s=e.childNodes[n];return s.nodeType==1&&s.contentEditable=="false"}Pu.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,iFe(t,20))};function iFe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ste(t),e))}function aFe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=_0t());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function v0t(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=uyt(e.focusNode,e.focusOffset),s=hyt(e.focusNode,e.focusOffset);if(n&&s&&n!=s){let i=s.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!i||!i.isText(s.nodeValue))return s;if(t.input.compositionNode==s){let c=n.pmViewDesc;if(!(!c||!c.isText(n.nodeValue)))return s}}return n||s}function _0t(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ste(t,e=!1){if(!(Sx&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),aFe(t),e||t.docView&&t.docView.dirty){let n=Axe(t),s=t.state.selection;return n&&!n.eq(s)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function b0t(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),s.removeAllRanges(),s.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const JA=ph&&x1<15||fC&&gyt<604;Iu.copy=Pu.cut=(t,e)=>{let n=e,s=t.state.selection,i=n.type=="cut";if(s.empty)return;let o=JA?null:n.clipboardData,c=s.content(),{dom:a,text:h}=Ixe(t,c);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",h)):b0t(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function w0t(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function j0t(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,s=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),s.parentNode&&s.parentNode.removeChild(s),n?eE(t,s.value,null,i,e):eE(t,s.textContent,s.innerHTML,i,e)},50)}function eE(t,e,n,s,i){let o=XRe(t,e,n,s,t.state.selection.$from);if(t.someProp("handlePaste",h=>h(t,i,o||hs.empty)))return!0;if(!o)return!1;let c=w0t(o),a=c?t.state.tr.replaceSelectionWith(c,s):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function oFe(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Pu.paste=(t,e)=>{let n=e;if(t.composing&&!Sx)return;let s=JA?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;s&&eE(t,oFe(s),s.getData("text/html"),i,n)?n.preventDefault():j0t(t,n)};class lFe{constructor(e,n,s){this.slice=e,this.move=n,this.node=s}}const k0t=Cf?"altKey":"ctrlKey";function cFe(t,e){let n=t.someProp("dragCopies",s=>!s(e));return n??!e[k0t]}Iu.dragstart=(t,e)=>{let n=e,s=t.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Mse(n)),c;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof ti?i.to-1:i.to))){if(s&&s.mightDrag)c=ti.create(t.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let v=t.docView.nearestDesc(n.target,!0);v&&v.node.type.spec.draggable&&v!=t.docView&&(c=ti.create(t.state.doc,v.posBefore))}}let a=(c||t.state.selection).content(),{dom:h,text:m,slice:x}=Ixe(t,a);(!n.dataTransfer.files.length||!nd||LRe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(JA?"Text":"text/html",h.innerHTML),n.dataTransfer.effectAllowed="copyMove",JA||n.dataTransfer.setData("text/plain",m),t.dragging=new lFe(x,cFe(t,n),c)};Iu.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Pu.dragover=Pu.dragenter=(t,e)=>e.preventDefault();Pu.drop=(t,e)=>{try{N0t(t,e,t.dragging)}finally{t.dragging=null}};function N0t(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(Mse(e));if(!s)return;let i=t.state.doc.resolve(s.pos),o=n&&n.slice;o?t.someProp("transformPasted",k=>{o=k(o,t,!1)}):o=XRe(t,oFe(e.dataTransfer),JA?null:e.dataTransfer.getData("text/html"),!1,i);let c=!!(n&&cFe(t,e));if(t.someProp("handleDrop",k=>k(t,e,o||hs.empty,c))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?NRe(t.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let h=t.state.tr;if(c){let{node:k}=n;k?k.replace(h):h.deleteSelection()}let m=h.mapping.map(a),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,v=h.doc;if(x?h.replaceRangeWith(m,m,o.content.firstChild):h.replaceRange(m,m,o),h.doc.eq(v))return;let w=h.doc.resolve(m);if(x&&ti.isSelectable(o.content.firstChild)&&w.nodeAfter&&w.nodeAfter.sameMarkup(o.content.firstChild))h.setSelection(new ti(w));else{let k=h.mapping.map(a);h.mapping.maps[h.mapping.maps.length-1].forEach((C,S,T,I)=>k=I),h.setSelection(Exe(t,w,h.doc.resolve(k)))}t.focus(),t.dispatch(h.setMeta("uiEvent","drop"))}Iu.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())&&Bx(t)},20))};Iu.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Iu.beforeinput=(t,e)=>{if(nd&&Sx&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:s}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=s||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,gw(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Pu)Iu[t]=Pu[t];function tE(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Cte{constructor(e,n){this.toDOM=e,this.spec=n||dj,this.side=this.spec.side||0}map(e,n,s,i){let{pos:o,deleted:c}=e.mapResult(n.from+i,this.side<0?-1:1);return c?null:new Of(o-s,o-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Cte&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&tE(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class v1{constructor(e,n){this.attrs=e,this.spec=n||dj}map(e,n,s,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-s,c=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-s;return o>=c?null:new Of(o,c,this)}valid(e,n){return n.from=e&&(!o||o(a.spec))&&s.push(a.copy(a.from+i,a.to+i))}for(let c=0;ce){let a=this.children[c]+1;this.children[c+2].findInner(e-a,n-a,s,i+a,o)}}map(e,n,s){return this==Ud||e.maps.length==0?this:this.mapInner(e,n,0,0,s||dj)}mapInner(e,n,s,i,o){let c;for(let a=0;a{let m=h+s,x;if(x=uFe(n,a,m)){for(i||(i=this.children.slice());oa&&v.to=e){this.children[a]==e&&(s=this.children[a+2]);break}let o=e+1,c=o+n.content.size;for(let a=0;ao&&h.type instanceof v1){let m=Math.max(o,h.from)-o,x=Math.min(c,h.to)-o;mi.map(e,n,dj));return x0.from(s)}forChild(e,n){if(n.isLeaf)return Lc.empty;let s=[];for(let i=0;in instanceof Lc)?e:e.reduce((n,s)=>n.concat(s instanceof Lc?s:s.members),[]))}}forEachSet(e){for(let n=0;n{let T=S-C-(k-w);for(let I=0;IA+x-v)continue;let D=a[I]+x-v;k>=D?a[I+1]=w<=D?-2:-1:w>=x&&T&&(a[I]+=T,a[I+1]+=T)}v+=T}),x=n.maps[m].map(x,-1)}let h=!1;for(let m=0;m=s.content.size){h=!0;continue}let w=n.map(t[m+1]+o,-1),k=w-i,{index:C,offset:S}=s.content.findIndex(v),T=s.maybeChild(C);if(T&&S==v&&S+T.nodeSize==k){let I=a[m+2].mapInner(n,T,x+1,t[m]+o+1,c);I!=Ud?(a[m]=v,a[m+1]=k,a[m+2]=I):(a[m+1]=-2,h=!0)}else h=!0}if(h){let m=C0t(a,t,e,n,i,o,c),x=Mte(m,s,0,c);e=x.local;for(let v=0;vn&&c.to{let m=uFe(t,a,h+n);if(m){o=!0;let x=Mte(m,a,n+h+1,s);x!=Ud&&i.push(h,h+a.nodeSize,x)}});let c=dFe(o?hFe(t):t,-n).sort(uj);for(let a=0;a0;)e++;t.splice(e,0,n)}function oce(t){let e=[];return t.someProp("decorations",n=>{let s=n(t.state);s&&s!=Ud&&e.push(s)}),t.cursorWrapper&&e.push(Lc.create(t.state.doc,[t.cursorWrapper.deco])),x0.from(e)}const M0t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},T0t=ph&&x1<=11;class A0t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class E0t{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new A0t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),T0t&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,M0t)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Jke(this.view)){if(this.suppressingSelectionUpdates)return Bx(this.view);if(ph&&x1<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Rj(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,s;for(let o=e.focusNode;o;o=hC(o))n.add(o);for(let o=e.anchorNode;o;o=hC(o))if(n.has(o)){s=o;break}let i=s&&this.view.docView.nearestDesc(s);if(i&&i.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let s=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&Jke(e)&&!this.ignoreSelectionChange(s),o=-1,c=-1,a=!1,h=[];if(e.editable)for(let x=0;xv.nodeName=="BR");if(x.length==2){let[v,w]=x;v.parentNode&&v.parentNode.parentNode==w.parentNode?w.remove():v.remove()}else{let{focusNode:v}=this.currentSelection;for(let w of x){let k=w.parentNode;k&&k.nodeName=="LI"&&(!v||L0t(e,v)!=k)&&w.remove()}}}else if((nd||eu)&&h.some(x=>x.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let x of h)if(x.nodeName=="BR"&&x.parentNode){let v=x.nextSibling;v&&v.nodeType==1&&v.contentEditable=="false"&&x.parentNode.removeChild(x)}}let m=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(o>-1&&(e.docView.markDirty(o,c),I0t(e)),this.handleDOMChange(o,c,a,h),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||Bx(e),this.currentSelection.set(s))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let x=0;xi;T--){let I=s.childNodes[T-1],A=I.pmViewDesc;if(I.nodeName=="BR"&&!A){o=T;break}if(!A||A.size)break}let v=t.state.doc,w=t.someProp("domParser")||eA.fromSchema(t.state.schema),k=v.resolve(c),C=null,S=w.parse(s,{topNode:k.parent,topMatch:k.parent.contentMatchAt(k.index()),topOpen:!0,from:i,to:o,preserveWhitespace:k.parent.type.whitespace=="pre"?"full":!0,findPositions:m,ruleFromNode:D0t,context:k});if(m&&m[0].pos!=null){let T=m[0].pos,I=m[1]&&m[1].pos;I==null&&(I=T),C={anchor:T+c,head:I+c}}return{doc:S,sel:C,from:c,to:a}}function D0t(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(eu&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||eu&&/^(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 R0t=/^(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 F0t(t,e,n,s,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let W=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,K=Axe(t,W);if(K&&!t.state.selection.eq(K)){if(nd&&Sx&&t.input.lastKeyCode===13&&Date.now()-100re(t,gw(13,"Enter"))))return;let Z=t.state.tr.setSelection(K);W=="pointer"?Z.setMeta("pointer",!0):W=="key"&&Z.scrollIntoView(),o&&Z.setMeta("composition",o),t.dispatch(Z)}return}let c=t.state.doc.resolve(e),a=c.sharedDepth(n);e=c.before(a+1),n=t.state.doc.resolve(n).after(a+1);let h=t.state.selection,m=O0t(t,e,n),x=t.state.doc,v=x.slice(m.from,m.to),w,k;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Sx)&&i.some(W=>W.nodeType==1&&!R0t.test(W.nodeName))&&(!C||C.endA>=C.endB)&&t.someProp("handleKeyDown",W=>W(t,gw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!C)if(s&&h instanceof Bi&&!h.empty&&h.$head.sameParent(h.$anchor)&&!t.composing&&!(m.sel&&m.sel.anchor!=m.sel.head))C={start:h.from,endA:h.to,endB:h.to};else{if(m.sel){let W=uNe(t,t.state.doc,m.sel);if(W&&!W.eq(t.state.selection)){let K=t.state.tr.setSelection(W);o&&K.setMeta("composition",o),t.dispatch(K)}}return}t.state.selection.fromt.state.selection.from&&C.start<=t.state.selection.from+2&&t.state.selection.from>=m.from?C.start=t.state.selection.from:C.endA=t.state.selection.to-2&&t.state.selection.to<=m.to&&(C.endB+=t.state.selection.to-C.endA,C.endA=t.state.selection.to)),ph&&x1<=11&&C.endB==C.start+1&&C.endA==C.start&&C.start>m.from&&m.doc.textBetween(C.start-m.from-1,C.start-m.from+1)=="  "&&(C.start--,C.endA--,C.endB--);let S=m.doc.resolveNoCache(C.start-m.from),T=m.doc.resolveNoCache(C.endB-m.from),I=x.resolve(C.start),A=S.sameParent(T)&&S.parent.inlineContent&&I.end()>=C.endA;if((fC&&t.input.lastIOSEnter>Date.now()-225&&(!A||i.some(W=>W.nodeName=="DIV"||W.nodeName=="P"))||!A&&S.posW(t,gw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>C.start&&B0t(x,C.start,C.endA,S,T)&&t.someProp("handleKeyDown",W=>W(t,gw(8,"Backspace")))){Sx&&nd&&t.domObserver.suppressSelectionUpdates();return}nd&&C.endB==C.start&&(t.input.lastChromeDelete=Date.now()),Sx&&!A&&S.start()!=T.start()&&T.parentOffset==0&&S.depth==T.depth&&m.sel&&m.sel.anchor==m.sel.head&&m.sel.head==C.endA&&(C.endB-=2,T=m.doc.resolveNoCache(C.endB-m.from),setTimeout(()=>{t.someProp("handleKeyDown",function(W){return W(t,gw(13,"Enter"))})},20));let D=C.start,$=C.endA,F=W=>{let K=W||t.state.tr.replace(D,$,m.doc.slice(C.start-m.from,C.endB-m.from));if(m.sel){let Z=uNe(t,K.doc,m.sel);Z&&!(nd&&t.composing&&Z.empty&&(C.start!=C.endB||t.input.lastChromeDeleteBx(t),20));let W=F(t.state.tr.delete(D,$)),K=x.resolve(C.start).marksAcross(x.resolve(C.endA));K&&W.ensureMarks(K),t.dispatch(W)}else if(C.endA==C.endB&&(q=z0t(S.parent.content.cut(S.parentOffset,T.parentOffset),I.parent.content.cut(I.parentOffset,C.endA-I.start())))){let W=F(t.state.tr);q.type=="add"?W.addMark(D,$,q.mark):W.removeMark(D,$,q.mark),t.dispatch(W)}else if(S.parent.child(S.index()).isText&&S.index()==T.index()-(T.textOffset?0:1)){let W=S.parent.textBetween(S.parentOffset,T.parentOffset),K=()=>F(t.state.tr.insertText(W,D,$));t.someProp("handleTextInput",Z=>Z(t,D,$,W,K))||t.dispatch(K())}else t.dispatch(F());else t.dispatch(F())}function uNe(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Exe(t,e.resolve(n.anchor),e.resolve(n.head))}function z0t(t,e){let n=t.firstChild.marks,s=e.firstChild.marks,i=n,o=s,c,a,h;for(let x=0;xx.mark(a.addToSet(x.marks));else if(i.length==0&&o.length==1)a=o[0],c="remove",h=x=>x.mark(a.removeFromSet(x.marks));else return null;let m=[];for(let x=0;xn||lce(c,!0,!1)0&&(e||t.indexAfter(s)==t.node(s).childCount);)s--,i++,e=!1;if(n){let o=t.node(s).maybeChild(t.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function $0t(t,e,n,s,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:c,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let h=Math.max(0,o-Math.min(c,a));s-=c+h-o}if(c=c?o-s:0;o-=h,o&&o=a?o-s:0;o-=h,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class fFe{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new s0t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(xNe),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=mNe(this),pNe(this),this.nodeViews=gNe(this),this.docView=Gke(this.state.doc,fNe(this),oce(this),this.dom,this),this.domObserver=new E0t(this,(s,i,o,c)=>F0t(this,s,i,o,c)),this.domObserver.start(),i0t(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Rhe(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(xNe),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let s in this._props)n[s]=this._props[s];n.state=this.state;for(let s in e)n[s]=e[s];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var s;let i=this.state,o=!1,c=!1;e.storedMarks&&this.composing&&(aFe(this),c=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let k=gNe(this);q0t(k,this.nodeViews)&&(this.nodeViews=k,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Rhe(this),this.editable=mNe(this),pNe(this);let h=oce(this),m=fNe(this),x=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",v=o||!this.docView.matchesNode(e.doc,m,h);(v||!e.selection.eq(i.selection))&&(c=!0);let w=x=="preserve"&&c&&this.dom.style.overflowAnchor==null&&vyt(this);if(c){this.domObserver.stop();let k=v&&(ph||nd)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&U0t(i.selection,e.selection);if(v){let C=nd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=v0t(this)),(o||!this.docView.update(e.doc,m,h,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=Gke(e.doc,m,h,this.dom,this)),C&&!this.trackWrites&&(k=!0)}k||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&qyt(this))?Bx(this,k):(KRe(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((s=this.dragging)===null||s===void 0)&&s.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():w&&_yt(w)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ti){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&$ke(this,n.getBoundingClientRect(),e)}else $ke(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==s.node&&(i=o)}this.dragging=new lFe(e.slice,e.move,i<0?void 0:ti.create(this.state.doc,i))}someProp(e,n){let s=this._props&&this._props[e],i;if(s!=null&&(i=n?n(s):s))return i;for(let c=0;cn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Syt(this,e)}coordsAtPos(e,n=1){return BRe(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,s=-1){let i=this.docView.posFromDOM(e,n,s);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Eyt(this,n||this.state,e)}pasteHTML(e,n){return eE(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return eE(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ixe(this,e)}destroy(){this.docView&&(a0t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],oce(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,cyt())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return l0t(this,e)}domSelectionRange(){let e=this.domSelection();return e?eu&&this.root.nodeType===11&&pyt(this.dom.ownerDocument)==this.dom&&P0t(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}fFe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function fNe(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let s in n)s=="class"?e.class+=" "+n[s]:s=="style"?e.style=(e.style?e.style+";":"")+n[s]:!e[s]&&s!="contenteditable"&&s!="nodeName"&&(e[s]=String(n[s]))}),e.translate||(e.translate="no"),[Of.node(0,t.state.doc.content.size,e)]}function pNe(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Of.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function mNe(t){return!t.someProp("editable",e=>e(t.state)===!1)}function U0t(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function gNe(t){let e=Object.create(null);function n(s){for(let i in s)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=s[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function q0t(t,e){let n=0,s=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)s++;return n!=s}function xNe(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 I1={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:"'"},Tte={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},V0t=typeof navigator<"u"&&/Mac/.test(navigator.platform),H0t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Cd=0;Cd<10;Cd++)I1[48+Cd]=I1[96+Cd]=String(Cd);for(var Cd=1;Cd<=24;Cd++)I1[Cd+111]="F"+Cd;for(var Cd=65;Cd<=90;Cd++)I1[Cd]=String.fromCharCode(Cd+32),Tte[Cd]=String.fromCharCode(Cd);for(var cce in I1)Tte.hasOwnProperty(cce)||(Tte[cce]=I1[cce]);function W0t(t){var e=V0t&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||H0t&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Tte:I1)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const G0t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),K0t=typeof navigator<"u"&&/Win/.test(navigator.platform);function Z0t(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let s,i,o,c;for(let a=0;at.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function mFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const gFe=(t,e,n)=>{let s=mFe(t,n);if(!s)return!1;let i=zxe(s);if(!i){let c=s.blockRange(),a=c&&l5(c);return a==null?!1:(e&&e(t.tr.lift(c,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(NFe(t,i,e,-1))return!0;if(s.parent.content.size==0&&(pC(o,"end")||ti.isSelectable(o)))for(let c=s.depth;;c--){let a=kse(t.doc,s.before(c),s.after(c),hs.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==s.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},Q0t=(t,e,n)=>{let s=mFe(t,n);if(!s)return!1;let i=zxe(s);return i?xFe(t,i,e):!1},J0t=(t,e,n)=>{let s=vFe(t,n);if(!s)return!1;let i=Bxe(s);return i?xFe(t,i,e):!1};function xFe(t,e,n){let s=e.nodeBefore,i=s,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let x=i.lastChild;if(!x)return!1;i=x}let c=e.nodeAfter,a=c,h=e.pos+1;for(;!a.isTextblock;h++){if(a.type.spec.isolating)return!1;let x=a.firstChild;if(!x)return!1;a=x}let m=kse(t.doc,o,h,hs.empty);if(!m||m.from!=o||m instanceof td&&m.slice.size>=h-o)return!1;if(n){let x=t.tr.step(m);x.setSelection(Bi.create(x.doc,o)),n(x.scrollIntoView())}return!0}function pC(t,e,n=!1){for(let s=t;s;s=e=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(n&&s.childCount!=1)return!1}return!1}const yFe=(t,e,n)=>{let{$head:s,empty:i}=t.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):s.parentOffset>0)return!1;o=zxe(s)}let c=o&&o.nodeBefore;return!c||!ti.isSelectable(c)?!1:(e&&e(t.tr.setSelection(ti.create(t.doc,o.pos-c.nodeSize)).scrollIntoView()),!0)};function zxe(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function vFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let s=vFe(t,n);if(!s)return!1;let i=Bxe(s);if(!i)return!1;let o=i.nodeAfter;if(NFe(t,i,e,1))return!0;if(s.parent.content.size==0&&(pC(o,"start")||ti.isSelectable(o))){let c=kse(t.doc,s.before(),s.after(),hs.empty);if(c&&c.slice.size{let{$head:s,empty:i}=t.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):s.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,s=n instanceof ti,i;if(s){if(n.node.isTextblock||!V1(t.doc,n.from))return!1;i=n.from}else if(i=jse(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);s&&o.setSelection(ti.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},t1t=(t,e)=>{let n=t.selection,s;if(n instanceof ti){if(n.node.isTextblock||!V1(t.doc,n.to))return!1;s=n.to}else if(s=jse(t.doc,n.to,1),s==null)return!1;return e&&e(t.tr.join(s).scrollIntoView()),!0},r1t=(t,e)=>{let{$from:n,$to:s}=t.selection,i=n.blockRange(s),o=i&&l5(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},wFe=(t,e)=>{let{$head:n,$anchor:s}=t.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(e&&e(t.tr.insertText(` `).scrollIntoView()),!0)};function $xe(t){for(let e=0;e{let{$head:n,$anchor:s}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let i=n.node(-1),o=n.indexAfter(-1),c=$xe(i.contentMatchAt(o));if(!c||!i.canReplaceWith(o,o,c))return!1;if(e){let a=n.after(),h=t.tr.replaceWith(a,a,c.createAndFill());h.setSelection(la.near(h.doc.resolve(a),1)),e(h.scrollIntoView())}return!0},jFe=(t,e)=>{let n=t.selection,{$from:s,$to:i}=n;if(n instanceof Gh||s.parent.inlineContent||i.parent.inlineContent)return!1;let o=$xe(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let c=(!s.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(zx(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),i=s&&l5(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)};function s1t(t){return(e,n)=>{let{$from:s,$to:i}=e.selection;if(e.selection instanceof ti&&e.selection.node.isBlock)return!s.parentOffset||!zx(e.doc,s.pos)?!1:(n&&n(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],c,a,h=!1,m=!1;for(let k=s.depth;;k--)if(s.node(k).isBlock){h=s.end(k)==s.pos+(s.depth-k),m=s.start(k)==s.pos-(s.depth-k),a=$xe(s.node(k-1).contentMatchAt(s.indexAfter(k-1))),o.unshift(h&&a?{type:a}:null),c=k;break}else{if(k==1)return!1;o.unshift(null)}let x=e.tr;(e.selection instanceof Bi||e.selection instanceof Gh)&&x.deleteSelection();let v=x.mapping.map(s.pos),w=zx(x.doc,v,o.length,o);if(w||(o[0]=a?{type:a}:null,w=zx(x.doc,v,o.length,o)),!w)return!1;if(x.split(v,o.length,o),!h&&m&&s.node(c).type!=a){let k=x.mapping.map(s.before(c)),C=x.doc.resolve(k);a&&s.node(c-1).canReplaceWith(C.index(),C.index()+1,a)&&x.setNodeMarkup(x.mapping.map(s.before(c)),a)}return n&&n(x.scrollIntoView()),!0}}const i1t=s1t(),a1t=(t,e)=>{let{$from:n,to:s}=t.selection,i,o=n.sharedDepth(s);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(ti.create(t.doc,i))),!0)};function o1t(t,e,n){let s=e.nodeBefore,i=e.nodeAfter,o=e.index();return!s||!i||!s.type.compatibleContent(i.type)?!1:!s.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-s.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||V1(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function NFe(t,e,n,s){let i=e.nodeBefore,o=e.nodeAfter,c,a,h=i.type.spec.isolating||o.type.spec.isolating;if(!h&&o1t(t,e,n))return!0;let m=!h&&e.parent.canReplace(e.index(),e.index()+1);if(m&&(c=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(c[0]||o.type).validEnd){if(n){let k=e.pos+o.nodeSize,C=gn.empty;for(let I=c.length-1;I>=0;I--)C=gn.from(c[I].create(null,C));C=gn.from(i.copy(C));let S=t.tr.step(new ld(e.pos-1,k,e.pos,k,new hs(C,1,0),c.length,!0)),T=S.doc.resolve(k+2*c.length);T.nodeAfter&&T.nodeAfter.type==i.type&&V1(S.doc,T.pos)&&S.join(T.pos),n(S.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&h?null:la.findFrom(e,1),v=x&&x.$from.blockRange(x.$to),w=v&&l5(v);if(w!=null&&w>=e.depth)return n&&n(t.tr.lift(v,w).scrollIntoView()),!0;if(m&&pC(o,"start",!0)&&pC(i,"end")){let k=i,C=[];for(;C.push(k),!k.isTextblock;)k=k.lastChild;let S=o,T=1;for(;!S.isTextblock;S=S.firstChild)T++;if(k.canReplace(k.childCount,k.childCount,S.content)){if(n){let I=gn.empty;for(let D=C.length-1;D>=0;D--)I=gn.from(C[D].copy(I));let A=t.tr.step(new ld(e.pos-C.length,e.pos+o.nodeSize,e.pos+T,e.pos+o.nodeSize-T,new hs(I,C.length,0),0,!0));n(A.scrollIntoView())}return!0}}return!1}function SFe(t){return function(e,n){let s=e.selection,i=t<0?s.$from:s.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(Bi.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const l1t=SFe(-1),c1t=SFe(1);function d1t(t,e=null){return function(n,s){let{$from:i,$to:o}=n.selection,c=i.blockRange(o),a=c&&Cxe(c,t,e);return a?(s&&s(n.tr.wrap(c,a).scrollIntoView()),!0):!1}}function yNe(t,e=null){return function(n,s){let i=!1;for(let o=0;o{if(i)return!1;if(!(!h.isTextblock||h.hasMarkup(t,e)))if(h.type==t)i=!0;else{let x=n.doc.resolve(m),v=x.index();i=x.parent.canReplaceWith(v,v+1,t)}})}if(!i)return!1;if(s){let o=n.tr;for(let c=0;c=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let h=c.resolve(e.start-2);o=new wte(h,h,e.depth),e.endIndex=0;x--)o=gn.from(n[x].type.create(n[x].attrs,o));t.step(new ld(e.start-(s?2:0),e.end,e.start,e.end,new hs(o,0,0),n.length,!0));let c=0;for(let x=0;xc.childCount>0&&c.firstChild.type==t);return o?n?s.node(o.depth-1).type==t?m1t(e,n,t,o):g1t(e,n,o):!0:!1}}function m1t(t,e,n,s){let i=t.tr,o=s.end,c=s.$to.end(s.depth);oS;C--)k-=i.child(C).nodeSize,s.delete(k-1,k+1);let o=s.doc.resolve(n.start),c=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,h=n.endIndex==i.childCount,m=o.node(-1),x=o.index(-1);if(!m.canReplace(x+(a?0:1),x+1,c.content.append(h?gn.empty:gn.from(i))))return!1;let v=o.pos,w=v+c.nodeSize;return s.step(new ld(v-(a?1:0),w+(h?1:0),v+1,w-1,new hs((a?gn.empty:gn.from(i.copy(gn.empty))).append(h?gn.empty:gn.from(i.copy(gn.empty))),a?0:1,h?0:1),a?0:1)),e(s.scrollIntoView()),!0}function x1t(t){return function(e,n){let{$from:s,$to:i}=e.selection,o=s.blockRange(i,m=>m.childCount>0&&m.firstChild.type==t);if(!o)return!1;let c=o.startIndex;if(c==0)return!1;let a=o.parent,h=a.child(c-1);if(h.type!=t)return!1;if(n){let m=h.lastChild&&h.lastChild.type==a.type,x=gn.from(m?t.create():null),v=new hs(gn.from(t.create(null,gn.from(a.type.create(null,x)))),m?3:1,0),w=o.start,k=o.end;n(e.tr.step(new ld(w-(m?3:1),k,w,k,v,1,!0)).scrollIntoView())}return!0}}function Tse(t){const{state:e,transaction:n}=t;let{selection:s}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return s},get doc(){return i},get tr(){return s=n.selection,i=n.doc,o=n.storedMarks,n}}}class Ase{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:s}=this,{view:i}=n,{tr:o}=s,c=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([a,h])=>[a,(...x)=>{const v=h(...x)(c);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),v}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:c}=i,a=[],h=!!e,m=e||o.tr,x=()=>(!h&&n&&!m.getMeta("preventDispatch")&&!this.hasCustomState&&c.dispatch(m),a.every(w=>w===!0)),v={...Object.fromEntries(Object.entries(s).map(([w,k])=>[w,(...S)=>{const T=this.buildProps(m,n),I=k(...S)(T);return a.push(I),v}])),run:x};return v}createCan(e){const{rawCommands:n,state:s}=this,i=!1,o=e||s.tr,c=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([h,m])=>[h,(...x)=>m(...x)({...c,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:c}=i,a={tr:e,editor:i,view:c,state:Tse({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(s).map(([h,m])=>[h,(...x)=>m(...x)(a)]))}};return a}}let y1t=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const s=this.callbacks[e];return s&&s.forEach(i=>i.apply(this,n)),this}off(e,n){const s=this.callbacks[e];return s&&(n?this.callbacks[e]=s.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const s=(...i)=>{this.off(e,s),n.apply(this,i)};return this.on(e,s)}removeAllListeners(){this.callbacks={}}};function ws(t,e,n){return t.config[e]===void 0&&t.parent?ws(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ws(t.parent,e,n):null}):t.config[e]}function Ese(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),s=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:s}}function CFe(t){const e=[],{nodeExtensions:n,markExtensions:s}=Ese(t),i=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(c=>{const a={name:c.name,options:c.options,storage:c.storage,extensions:i},h=ws(c,"addGlobalAttributes",a);if(!h)return;h().forEach(x=>{x.types.forEach(v=>{Object.entries(x.attributes).forEach(([w,k])=>{e.push({type:v,name:w,attribute:{...o,...k}})})})})}),i.forEach(c=>{const a={name:c.name,options:c.options,storage:c.storage},h=ws(c,"addAttributes",a);if(!h)return;const m=h();Object.entries(m).forEach(([x,v])=>{const w={...o,...v};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:c.name,name:x,attribute:w})})}),e}function dd(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ud(...t){return t.filter(e=>!!e).reduce((e,n)=>{const s={...e};return Object.entries(n).forEach(([i,o])=>{if(!s[i]){s[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],h=s[i]?s[i].split(" "):[],m=a.filter(x=>!h.includes(x));s[i]=[...h,...m].join(" ")}else if(i==="style"){const a=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],h=s[i]?s[i].split(";").map(x=>x.trim()).filter(Boolean):[],m=new Map;h.forEach(x=>{const[v,w]=x.split(":").map(k=>k.trim());m.set(v,w)}),a.forEach(x=>{const[v,w]=x.split(":").map(k=>k.trim());m.set(v,w)}),s[i]=Array.from(m.entries()).map(([x,v])=>`${x}: ${v}`).join("; ")}else s[i]=o}),s},{})}function Fhe(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,s)=>ud(n,s),{})}function MFe(t){return typeof t=="function"}function da(t,e=void 0,...n){return MFe(t)?e?t.bind(e)(...n):t(...n):t}function v1t(t={}){return Object.keys(t).length===0&&t.constructor===Object}function _1t(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function vNe(t,e){return"style"in t?t:{...t,getAttrs:n=>{const s=t.getAttrs?t.getAttrs(n):t.attrs;if(s===!1)return!1;const i=e.reduce((o,c)=>{const a=c.attribute.parseHTML?c.attribute.parseHTML(n):_1t(n.getAttribute(c.name));return a==null?o:{...o,[c.name]:a}},{});return{...s,...i}}}}function _Ne(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&v1t(n)?!1:n!=null))}function b1t(t,e){var n;const s=CFe(t),{nodeExtensions:i,markExtensions:o}=Ese(t),c=(n=i.find(m=>ws(m,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(m=>{const x=s.filter(I=>I.type===m.name),v={name:m.name,options:m.options,storage:m.storage,editor:e},w=t.reduce((I,A)=>{const D=ws(A,"extendNodeSchema",v);return{...I,...D?D(m):{}}},{}),k=_Ne({...w,content:da(ws(m,"content",v)),marks:da(ws(m,"marks",v)),group:da(ws(m,"group",v)),inline:da(ws(m,"inline",v)),atom:da(ws(m,"atom",v)),selectable:da(ws(m,"selectable",v)),draggable:da(ws(m,"draggable",v)),code:da(ws(m,"code",v)),whitespace:da(ws(m,"whitespace",v)),linebreakReplacement:da(ws(m,"linebreakReplacement",v)),defining:da(ws(m,"defining",v)),isolating:da(ws(m,"isolating",v)),attrs:Object.fromEntries(x.map(I=>{var A;return[I.name,{default:(A=I==null?void 0:I.attribute)===null||A===void 0?void 0:A.default}]}))}),C=da(ws(m,"parseHTML",v));C&&(k.parseDOM=C.map(I=>vNe(I,x)));const S=ws(m,"renderHTML",v);S&&(k.toDOM=I=>S({node:I,HTMLAttributes:Fhe(I,x)}));const T=ws(m,"renderText",v);return T&&(k.toText=T),[m.name,k]})),h=Object.fromEntries(o.map(m=>{const x=s.filter(T=>T.type===m.name),v={name:m.name,options:m.options,storage:m.storage,editor:e},w=t.reduce((T,I)=>{const A=ws(I,"extendMarkSchema",v);return{...T,...A?A(m):{}}},{}),k=_Ne({...w,inclusive:da(ws(m,"inclusive",v)),excludes:da(ws(m,"excludes",v)),group:da(ws(m,"group",v)),spanning:da(ws(m,"spanning",v)),code:da(ws(m,"code",v)),attrs:Object.fromEntries(x.map(T=>{var I;return[T.name,{default:(I=T==null?void 0:T.attribute)===null||I===void 0?void 0:I.default}]}))}),C=da(ws(m,"parseHTML",v));C&&(k.parseDOM=C.map(T=>vNe(T,x)));const S=ws(m,"renderHTML",v);return S&&(k.toDOM=T=>S({mark:T,HTMLAttributes:Fhe(T,x)})),[m.name,k]}));return new pRe({topNode:c,nodes:a,marks:h})}function uce(t,e){return e.nodes[t]||e.marks[t]||null}function bNe(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function qxe(t,e){const n=Qj.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const w1t=(t,e=500)=>{let n="";const s=t.parentOffset;return t.parent.nodesBetween(Math.max(0,s-e),s,(i,o,c,a)=>{var h,m;const x=((m=(h=i.type.spec).toText)===null||m===void 0?void 0:m.call(h,{node:i,pos:o,parent:c,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?x:x.slice(0,Math.max(0,s-o))}),n};function Vxe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Ise{constructor(e){this.find=e.find,this.handler=e.handler}}const j1t=(t,e)=>{if(Vxe(e))return e.exec(t);const n=e(t);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=t,s.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(n.replaceWith)),s};function yL(t){var e;const{editor:n,from:s,to:i,text:o,rules:c,plugin:a}=t,{view:h}=n;if(h.composing)return!1;const m=h.state.doc.resolve(s);if(m.parent.type.spec.code||!((e=m.nodeBefore||m.nodeAfter)===null||e===void 0)&&e.marks.find(w=>w.type.spec.code))return!1;let x=!1;const v=w1t(m)+o;return c.forEach(w=>{if(x)return;const k=j1t(v,w.find);if(!k)return;const C=h.state.tr,S=Tse({state:h.state,transaction:C}),T={from:s-(k[0].length-o.length),to:i},{commands:I,chain:A,can:D}=new Ase({editor:n,state:S});w.handler({state:S,range:T,match:k,commands:I,chain:A,can:D})===null||!C.steps.length||(C.setMeta(a,{transform:C,from:s,to:i,text:o}),h.dispatch(C),x=!0)}),x}function k1t(t){const{editor:e,rules:n}=t,s=new Ld({state:{init(){return null},apply(i,o,c){const a=i.getMeta(s);if(a)return a;const h=i.getMeta("applyInputRules");return!!h&&setTimeout(()=>{let{text:x}=h;typeof x=="string"?x=x:x=qxe(gn.from(x),c.schema);const{from:v}=h,w=v+x.length;yL({editor:e,from:v,to:w,text:x,rules:n,plugin:s})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,c,a){return yL({editor:e,from:o,to:c,text:a,rules:n,plugin:s})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&yL({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:c}=i.state.selection;return c?yL({editor:e,from:c.pos,to:c.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function N1t(t){return Object.prototype.toString.call(t).slice(8,-1)}function vL(t){return N1t(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Pse(t,e){const n={...t};return vL(t)&&vL(e)&&Object.keys(e).forEach(s=>{vL(e[s])&&vL(t[s])?n[s]=Pse(t[s],e[s]):n[s]=e[s]}),n}class kg{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=da(ws(this,"addOptions",{name:this.name}))),this.storage=da(ws(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new kg(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Pse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new kg(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=da(ws(n,"addOptions",{name:n.name})),n.storage=da(ws(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:s}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const c=i.marks();if(!!!c.find(m=>(m==null?void 0:m.type.name)===n.name))return!1;const h=c.find(m=>(m==null?void 0:m.type.name)===n.name);return h&&s.removeStoredMark(h),s.insertText(" ",i.pos),e.view.dispatch(s),!0}return!1}}function S1t(t){return typeof t=="number"}class C1t{constructor(e){this.find=e.find,this.handler=e.handler}}const M1t=(t,e,n)=>{if(Vxe(e))return[...t.matchAll(e)];const s=e(t,n);return s?s.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function T1t(t){const{editor:e,state:n,from:s,to:i,rule:o,pasteEvent:c,dropEvent:a}=t,{commands:h,chain:m,can:x}=new Ase({editor:e,state:n}),v=[];return n.doc.nodesBetween(s,i,(k,C)=>{if(!k.isTextblock||k.type.spec.code)return;const S=Math.max(s,C),T=Math.min(i,C+k.content.size),I=k.textBetween(S-C,T-C,void 0,"");M1t(I,o.find,c).forEach(D=>{if(D.index===void 0)return;const $=S+D.index+1,F=$+D[0].length,q={from:n.tr.mapping.map($),to:n.tr.mapping.map(F)},W=o.handler({state:n,range:q,match:D,commands:h,chain:m,can:x,pasteEvent:c,dropEvent:a});v.push(W)})}),v.every(k=>k!==null)}let _L=null;const A1t=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function E1t(t){const{editor:e,rules:n}=t;let s=null,i=!1,o=!1,c=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const h=({state:x,from:v,to:w,rule:k,pasteEvt:C})=>{const S=x.tr,T=Tse({state:x,transaction:S});if(!(!T1t({editor:e,state:T,from:Math.max(v-1,0),to:w.b-1,rule:k,pasteEvent:C,dropEvent:a})||!S.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return c=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,S}};return n.map(x=>new Ld({view(v){const w=C=>{var S;s=!((S=v.dom.parentElement)===null||S===void 0)&&S.contains(C.target)?v.dom.parentElement:null,s&&(_L=e)},k=()=>{_L&&(_L=null)};return window.addEventListener("dragstart",w),window.addEventListener("dragend",k),{destroy(){window.removeEventListener("dragstart",w),window.removeEventListener("dragend",k)}}},props:{handleDOMEvents:{drop:(v,w)=>{if(o=s===v.dom.parentElement,a=w,!o){const k=_L;k!=null&&k.isEditable&&setTimeout(()=>{const C=k.state.selection;C&&k.commands.deleteRange({from:C.from,to:C.to})},10)}return!1},paste:(v,w)=>{var k;const C=(k=w.clipboardData)===null||k===void 0?void 0:k.getData("text/html");return c=w,i=!!(C!=null&&C.includes("data-pm-slice")),!1}}},appendTransaction:(v,w,k)=>{const C=v[0],S=C.getMeta("uiEvent")==="paste"&&!i,T=C.getMeta("uiEvent")==="drop"&&!o,I=C.getMeta("applyPasteRules"),A=!!I;if(!S&&!T&&!A)return;if(A){let{text:F}=I;typeof F=="string"?F=F:F=qxe(gn.from(F),k.schema);const{from:q}=I,W=q+F.length,K=A1t(F);return h({rule:x,state:k,from:q,to:{b:W},pasteEvt:K})}const D=w.doc.content.findDiffStart(k.doc.content),$=w.doc.content.findDiffEnd(k.doc.content);if(!(!S1t(D)||!$||D===$.b))return h({rule:x,state:k,from:D,to:$,pasteEvt:c})}}))}function I1t(t){const e=t.filter((n,s)=>t.indexOf(n)!==s);return Array.from(new Set(e))}class MS{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=MS.resolve(e),this.schema=b1t(this.extensions,n),this.setupExtensions()}static resolve(e){const n=MS.sort(MS.flatten(e)),s=I1t(n.map(i=>i.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const s={name:n.name,options:n.options,storage:n.storage},i=ws(n,"addExtensions",s);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((s,i)=>{const o=ws(s,"priority")||100,c=ws(i,"priority")||100;return o>c?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:uce(n.name,this.schema)},i=ws(n,"addCommands",s);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=MS.sort([...this.extensions].reverse()),s=[],i=[],o=n.map(c=>{const a={name:c.name,options:c.options,storage:c.storage,editor:e,type:uce(c.name,this.schema)},h=[],m=ws(c,"addKeyboardShortcuts",a);let x={};if(c.type==="mark"&&ws(c,"exitable",a)&&(x.ArrowRight=()=>kg.handleExit({editor:e,mark:c})),m){const S=Object.fromEntries(Object.entries(m()).map(([T,I])=>[T,()=>I({editor:e})]));x={...x,...S}}const v=X0t(x);h.push(v);const w=ws(c,"addInputRules",a);bNe(c,e.options.enableInputRules)&&w&&s.push(...w());const k=ws(c,"addPasteRules",a);bNe(c,e.options.enablePasteRules)&&k&&i.push(...k());const C=ws(c,"addProseMirrorPlugins",a);if(C){const S=C();h.push(...S)}return h}).flat();return[k1t({editor:e,rules:s}),...E1t({editor:e,rules:i}),...o]}get attributes(){return CFe(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Ese(this.extensions);return Object.fromEntries(n.filter(s=>!!ws(s,"addNodeView")).map(s=>{const i=this.attributes.filter(h=>h.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:e,type:dd(s.name,this.schema)},c=ws(s,"addNodeView",o);if(!c)return[];const a=(h,m,x,v,w)=>{const k=Fhe(h,i);return c()({node:h,view:m,getPos:x,decorations:v,innerDecorations:w,editor:e,extension:s,HTMLAttributes:k})};return[s.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const s={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:uce(e.name,this.schema)};e.type==="mark"&&(!((n=da(ws(e,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=ws(e,"onBeforeCreate",s),o=ws(e,"onCreate",s),c=ws(e,"onUpdate",s),a=ws(e,"onSelectionUpdate",s),h=ws(e,"onTransaction",s),m=ws(e,"onFocus",s),x=ws(e,"onBlur",s),v=ws(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),c&&this.editor.on("update",c),a&&this.editor.on("selectionUpdate",a),h&&this.editor.on("transaction",h),m&&this.editor.on("focus",m),x&&this.editor.on("blur",x),v&&this.editor.on("destroy",v)})}}class Id{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=da(ws(this,"addOptions",{name:this.name}))),this.storage=da(ws(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Id(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Pse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Id({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=da(ws(n,"addOptions",{name:n.name})),n.storage=da(ws(n,"addStorage",{name:n.name,options:n.options})),n}}function TFe(t,e,n){const{from:s,to:i}=e,{blockSeparator:o=` `,textSerializers:c={}}=n||{};let a="";return t.nodesBetween(s,i,(h,m,x,v)=>{var w;h.isBlock&&m>s&&(a+=o);const k=c==null?void 0:c[h.type.name];if(k)return x&&(a+=k({node:h,pos:m,parent:x,index:v,range:e})),!1;h.isText&&(a+=(w=h==null?void 0:h.text)===null||w===void 0?void 0:w.slice(Math.max(s,m)-m,i-m))}),a}function AFe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const P1t=Id.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ld({key:new nf("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:s,selection:i}=e,{ranges:o}=i,c=Math.min(...o.map(x=>x.$from.pos)),a=Math.max(...o.map(x=>x.$to.pos)),h=AFe(n);return TFe(s,{from:c,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:h})}}})]}}),L1t=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),O1t=(t=!1)=>({commands:e})=>e.setContent("",t),D1t=()=>({state:t,tr:e,dispatch:n})=>{const{selection:s}=e,{ranges:i}=s;return n&&i.forEach(({$from:o,$to:c})=>{t.doc.nodesBetween(o.pos,c.pos,(a,h)=>{if(a.type.isText)return;const{doc:m,mapping:x}=e,v=m.resolve(x.map(h)),w=m.resolve(x.map(h+a.nodeSize)),k=v.blockRange(w);if(!k)return;const C=l5(k);if(a.type.isTextblock){const{defaultType:S}=v.parent.contentMatchAt(v.index());e.setNodeMarkup(k.start,S)}(C||C===0)&&e.lift(k,C)})}),!0},R1t=t=>e=>t(e),F1t=()=>({state:t,dispatch:e})=>jFe(t,e),z1t=(t,e)=>({editor:n,tr:s})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);s.deleteRange(t.from,t.to);const c=s.mapping.map(e);return s.insert(c,o.content),s.setSelection(new Bi(s.doc.resolve(Math.max(c-1,0)))),!0},B1t=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,s=n.$anchor.node();if(s.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s.type){if(e){const a=i.before(o),h=i.after(o);t.delete(a,h).scrollIntoView()}return!0}return!1},$1t=t=>({tr:e,state:n,dispatch:s})=>{const i=dd(t,n.schema),o=e.selection.$anchor;for(let c=o.depth;c>0;c-=1)if(o.node(c).type===i){if(s){const h=o.before(c),m=o.after(c);e.delete(h,m).scrollIntoView()}return!0}return!1},U1t=t=>({tr:e,dispatch:n})=>{const{from:s,to:i}=t;return n&&e.delete(s,i),!0},q1t=()=>({state:t,dispatch:e})=>Fxe(t,e),V1t=()=>({commands:t})=>t.keyboardShortcut("Enter"),H1t=()=>({state:t,dispatch:e})=>n1t(t,e);function Ate(t,e,n={strict:!0}){const s=Object.keys(e);return s.length?s.every(i=>n.strict?e[i]===t[i]:Vxe(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function EFe(t,e,n={}){return t.find(s=>s.type===e&&Ate(Object.fromEntries(Object.keys(n).map(i=>[i,s.attrs[i]])),n))}function wNe(t,e,n={}){return!!EFe(t,e,n)}function Hxe(t,e,n){var s;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(x=>x.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(x=>x.type===e)||(n=n||((s=i.node.marks[0])===null||s===void 0?void 0:s.attrs),!EFe([...i.node.marks],e,n)))return;let c=i.index,a=t.start()+i.offset,h=c+1,m=a+i.node.nodeSize;for(;c>0&&wNe([...t.parent.child(c-1).marks],e,n);)c-=1,a-=t.parent.child(c).nodeSize;for(;h({tr:n,state:s,dispatch:i})=>{const o=W1(t,s.schema),{doc:c,selection:a}=n,{$from:h,from:m,to:x}=a;if(i){const v=Hxe(h,o,e);if(v&&v.from<=m&&v.to>=x){const w=Bi.create(c,v.from,v.to);n.setSelection(w)}}return!0},G1t=t=>e=>{const n=typeof t=="function"?t(e):t;for(let s=0;s({editor:n,view:s,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const c=()=>{(Wxe()||K1t())&&s.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(s.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(s.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!IFe(n.state.selection))return c(),!0;const a=PFe(i.doc,t)||n.state.selection,h=n.state.selection.eq(a);return o&&(h||i.setSelection(a),h&&i.storedMarks&&i.setStoredMarks(i.storedMarks),c()),!0},Y1t=(t,e)=>n=>t.every((s,i)=>e(s,{...n,index:i})),X1t=(t,e)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),LFe=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const s=e[n];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?t.removeChild(s):s.nodeType===1&&LFe(s)}return t};function bL(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return LFe(n)}function rE(t,e,n){if(t instanceof g1||t instanceof gn)return t;n={slice:!0,parseOptions:{},...n};const s=typeof t=="object"&&t!==null,i=typeof t=="string";if(s)try{if(Array.isArray(t)&&t.length>0)return gn.fromArray(t.map(a=>e.nodeFromJSON(a)));const c=e.nodeFromJSON(t);return n.errorOnInvalidContent&&c.check(),c}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),rE("",e,n)}if(i){if(n.errorOnInvalidContent){let c=!1,a="";const h=new pRe({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:m=>(c=!0,a=typeof m=="string"?m:m.outerHTML,null)}]}})});if(n.slice?eA.fromSchema(h).parseSlice(bL(t),n.parseOptions):eA.fromSchema(h).parse(bL(t),n.parseOptions),n.errorOnInvalidContent&&c)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=eA.fromSchema(e);return n.slice?o.parseSlice(bL(t),n.parseOptions).content:o.parse(bL(t),n.parseOptions)}return rE("",e,n)}function Q1t(t,e,n){const s=t.steps.length-1;if(s{c===0&&(c=x)}),t.setSelection(la.near(t.doc.resolve(c),n))}const J1t=t=>!("type"in t),evt=(t,e,n)=>({tr:s,dispatch:i,editor:o})=>{var c;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const h=T=>{o.emit("contentError",{editor:o,error:T,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{rE(e,o.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(T){h(T)}try{a=rE(e,o.schema,{parseOptions:m,errorOnInvalidContent:(c=n.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})}catch(T){return h(T),!1}let{from:x,to:v}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},w=!0,k=!0;if((J1t(a)?a:[a]).forEach(T=>{T.check(),w=w?T.isText&&T.marks.length===0:!1,k=k?T.isBlock:!1}),x===v&&k){const{parent:T}=s.doc.resolve(x);T.isTextblock&&!T.type.spec.code&&!T.childCount&&(x-=1,v+=1)}let S;if(w){if(Array.isArray(e))S=e.map(T=>T.text||"").join("");else if(e instanceof gn){let T="";e.forEach(I=>{I.text&&(T+=I.text)}),S=T}else typeof e=="object"&&e&&e.text?S=e.text:S=e;s.insertText(S,x,v)}else S=a,s.replaceWith(x,v,S);n.updateSelection&&Q1t(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:x,text:S}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:x,text:S})}return!0},tvt=()=>({state:t,dispatch:e})=>e1t(t,e),rvt=()=>({state:t,dispatch:e})=>t1t(t,e),nvt=()=>({state:t,dispatch:e})=>gFe(t,e),svt=()=>({state:t,dispatch:e})=>_Fe(t,e),ivt=()=>({state:t,dispatch:e,tr:n})=>{try{const s=jse(t.doc,t.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},avt=()=>({state:t,dispatch:e,tr:n})=>{try{const s=jse(t.doc,t.selection.$from.pos,1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},ovt=()=>({state:t,dispatch:e})=>Q0t(t,e),lvt=()=>({state:t,dispatch:e})=>J0t(t,e);function OFe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function cvt(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let s,i,o,c;for(let a=0;a({editor:e,view:n,tr:s,dispatch:i})=>{const o=cvt(t).split(/-(?!$)/),c=o.find(m=>!["Alt","Ctrl","Meta","Shift"].includes(m)),a=new KeyboardEvent("keydown",{key:c==="Space"?" ":c,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),h=e.captureTransaction(()=>{n.someProp("handleKeyDown",m=>m(n,a))});return h==null||h.steps.forEach(m=>{const x=m.map(s.mapping);x&&i&&s.maybeStep(x)}),!0};function nE(t,e,n={}){const{from:s,to:i,empty:o}=t.selection,c=e?dd(e,t.schema):null,a=[];t.doc.nodesBetween(s,i,(v,w)=>{if(v.isText)return;const k=Math.max(s,w),C=Math.min(i,w+v.nodeSize);a.push({node:v,from:k,to:C})});const h=i-s,m=a.filter(v=>c?c.name===v.node.type.name:!0).filter(v=>Ate(v.node.attrs,n,{strict:!1}));return o?!!m.length:m.reduce((v,w)=>v+w.to-w.from,0)>=h}const uvt=(t,e={})=>({state:n,dispatch:s})=>{const i=dd(t,n.schema);return nE(n,i,e)?r1t(n,s):!1},hvt=()=>({state:t,dispatch:e})=>kFe(t,e),fvt=t=>({state:e,dispatch:n})=>{const s=dd(t,e.schema);return p1t(s)(e,n)},pvt=()=>({state:t,dispatch:e})=>wFe(t,e);function Lse(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function jNe(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((s,i)=>(n.includes(i)||(s[i]=t[i]),s),{})}const mvt=(t,e)=>({tr:n,state:s,dispatch:i})=>{let o=null,c=null;const a=Lse(typeof t=="string"?t:t.name,s.schema);return a?(a==="node"&&(o=dd(t,s.schema)),a==="mark"&&(c=W1(t,s.schema)),i&&n.selection.ranges.forEach(h=>{s.doc.nodesBetween(h.$from.pos,h.$to.pos,(m,x)=>{o&&o===m.type&&n.setNodeMarkup(x,void 0,jNe(m.attrs,e)),c&&m.marks.length&&m.marks.forEach(v=>{c===v.type&&n.addMark(x,x+m.nodeSize,c.create(jNe(v.attrs,e)))})})}),!0):!1},gvt=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),xvt=()=>({tr:t,dispatch:e})=>{if(e){const n=new Gh(t.doc);t.setSelection(n)}return!0},yvt=()=>({state:t,dispatch:e})=>yFe(t,e),vvt=()=>({state:t,dispatch:e})=>bFe(t,e),_vt=()=>({state:t,dispatch:e})=>a1t(t,e),bvt=()=>({state:t,dispatch:e})=>c1t(t,e),wvt=()=>({state:t,dispatch:e})=>l1t(t,e);function zhe(t,e,n={},s={}){return rE(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const jvt=(t,e=!1,n={},s={})=>({editor:i,tr:o,dispatch:c,commands:a})=>{var h,m;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const v=zhe(t,i.schema,n,{errorOnInvalidContent:(h=s.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck});return c&&o.replaceWith(0,x.content.size,v).setMeta("preventUpdate",!e),!0}return c&&o.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:x.content.size},t,{parseOptions:n,errorOnInvalidContent:(m=s.errorOnInvalidContent)!==null&&m!==void 0?m:i.options.enableContentCheck})};function DFe(t,e){const n=W1(e,t.schema),{from:s,to:i,empty:o}=t.selection,c=[];o?(t.storedMarks&&c.push(...t.storedMarks),c.push(...t.selection.$head.marks())):t.doc.nodesBetween(s,i,h=>{c.push(...h.marks)});const a=c.find(h=>h.type.name===n.name);return a?{...a.attrs}:{}}function kvt(t,e){const n=new ARe(t);return e.forEach(s=>{s.steps.forEach(i=>{n.step(i)})}),n}function Nvt(t){for(let e=0;e{n(i)&&s.push({node:i,pos:o})}),s}function Cvt(t,e){for(let n=t.depth;n>0;n-=1){const s=t.node(n);if(e(s))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:s}}}function Gxe(t){return e=>Cvt(e.$from,t)}function Mvt(t,e){const n={from:0,to:t.content.size};return TFe(t,n,e)}function Tvt(t,e){const n=dd(e,t.schema),{from:s,to:i}=t.selection,o=[];t.doc.nodesBetween(s,i,a=>{o.push(a)});const c=o.reverse().find(a=>a.type.name===n.name);return c?{...c.attrs}:{}}function RFe(t,e){const n=Lse(typeof e=="string"?e:e.name,t.schema);return n==="node"?Tvt(t,e):n==="mark"?DFe(t,e):{}}function Avt(t,e=JSON.stringify){const n={};return t.filter(s=>{const i=e(s);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Evt(t){const e=Avt(t);return e.length===1?e:e.filter((n,s)=>!e.filter((o,c)=>c!==s).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function Ivt(t){const{mapping:e,steps:n}=t,s=[];return e.maps.forEach((i,o)=>{const c=[];if(i.ranges.length)i.forEach((a,h)=>{c.push({from:a,to:h})});else{const{from:a,to:h}=n[o];if(a===void 0||h===void 0)return;c.push({from:a,to:h})}c.forEach(({from:a,to:h})=>{const m=e.slice(o).map(a,-1),x=e.slice(o).map(h),v=e.invert().map(m,-1),w=e.invert().map(x);s.push({oldRange:{from:v,to:w},newRange:{from:m,to:x}})})}),Evt(s)}function Kxe(t,e,n){const s=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),c=Hxe(o,i.type);c&&s.push({mark:i,...c})}):n.nodesBetween(t,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||s.push(...i.marks.map(c=>({from:o,to:o+i.nodeSize,mark:c})))}),s}function aee(t,e,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const i=t.find(o=>o.type===e&&o.name===s);return i?i.attribute.keepOnSplit:!1}))}function Bhe(t,e,n={}){const{empty:s,ranges:i}=t.selection,o=e?W1(e,t.schema):null;if(s)return!!(t.storedMarks||t.selection.$from.marks()).filter(v=>o?o.name===v.type.name:!0).find(v=>Ate(v.attrs,n,{strict:!1}));let c=0;const a=[];if(i.forEach(({$from:v,$to:w})=>{const k=v.pos,C=w.pos;t.doc.nodesBetween(k,C,(S,T)=>{if(!S.isText&&!S.marks.length)return;const I=Math.max(k,T),A=Math.min(C,T+S.nodeSize),D=A-I;c+=D,a.push(...S.marks.map($=>({mark:$,from:I,to:A})))})}),c===0)return!1;const h=a.filter(v=>o?o.name===v.mark.type.name:!0).filter(v=>Ate(v.mark.attrs,n,{strict:!1})).reduce((v,w)=>v+w.to-w.from,0),m=a.filter(v=>o?v.mark.type!==o&&v.mark.type.excludes(o):!0).reduce((v,w)=>v+w.to-w.from,0);return(h>0?h+m:h)>=c}function Pvt(t,e,n={}){if(!e)return nE(t,null,n)||Bhe(t,null,n);const s=Lse(e,t.schema);return s==="node"?nE(t,e,n):s==="mark"?Bhe(t,e,n):!1}function kNe(t,e){const{nodeExtensions:n}=Ese(e),s=n.find(c=>c.name===t);if(!s)return!1;const i={name:s.name,options:s.options,storage:s.storage},o=da(ws(s,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Zxe(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((s=t.text)!==null&&s!==void 0?s:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Zxe(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Lvt(t){return t instanceof ti}function Ovt(t,e,n){var s;const{selection:i}=e;let o=null;if(IFe(i)&&(o=i.$cursor),o){const a=(s=t.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(a)||!a.some(h=>h.type.excludes(n))}const{ranges:c}=i;return c.some(({$from:a,$to:h})=>{let m=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,h.pos,(x,v,w)=>{if(m)return!1;if(x.isInline){const k=!w||w.type.allowsMarkType(n),C=!!n.isInSet(x.marks)||!x.marks.some(S=>S.type.excludes(n));m=k&&C}return!m}),m})}const Dvt=(t,e={})=>({tr:n,state:s,dispatch:i})=>{const{selection:o}=n,{empty:c,ranges:a}=o,h=W1(t,s.schema);if(i)if(c){const m=DFe(s,h);n.addStoredMark(h.create({...m,...e}))}else a.forEach(m=>{const x=m.$from.pos,v=m.$to.pos;s.doc.nodesBetween(x,v,(w,k)=>{const C=Math.max(k,x),S=Math.min(k+w.nodeSize,v);w.marks.find(I=>I.type===h)?w.marks.forEach(I=>{h===I.type&&n.addMark(C,S,h.create({...I.attrs,...e}))}):n.addMark(C,S,h.create(e))})});return Ovt(s,n,h)},Rvt=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Fvt=(t,e={})=>({state:n,dispatch:s,chain:i})=>{const o=dd(t,n.schema);let c;return n.selection.$anchor.sameParent(n.selection.$head)&&(c=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>yNe(o,{...c,...e})(n)?!0:a.clearNodes()).command(({state:a})=>yNe(o,{...c,...e})(a,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},zvt=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,i=Cw(t,0,s.content.size),o=ti.create(s,i);e.setSelection(o)}return!0},Bvt=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,c=Bi.atStart(s).from,a=Bi.atEnd(s).to,h=Cw(i,c,a),m=Cw(o,c,a),x=Bi.create(s,h,m);e.setSelection(x)}return!0},$vt=t=>({state:e,dispatch:n})=>{const s=dd(t,e.schema);return x1t(s)(e,n)};function NNe(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const s=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(s)}}const Uvt=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:s,editor:i})=>{const{selection:o,doc:c}=e,{$from:a,$to:h}=o,m=i.extensionManager.attributes,x=aee(m,a.node().type.name,a.node().attrs);if(o instanceof ti&&o.node.isBlock)return!a.parentOffset||!zx(c,a.pos)?!1:(s&&(t&&NNe(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const v=h.parentOffset===h.parent.content.size,w=a.depth===0?void 0:Nvt(a.node(-1).contentMatchAt(a.indexAfter(-1)));let k=v&&w?[{type:w,attrs:x}]:void 0,C=zx(e.doc,e.mapping.map(a.pos),1,k);if(!k&&!C&&zx(e.doc,e.mapping.map(a.pos),1,w?[{type:w}]:void 0)&&(C=!0,k=w?[{type:w,attrs:x}]:void 0),s){if(C&&(o instanceof Bi&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,k),w&&!v&&!a.parentOffset&&a.parent.type!==w)){const S=e.mapping.map(a.before()),T=e.doc.resolve(S);a.node(-1).canReplaceWith(T.index(),T.index()+1,w)&&e.setNodeMarkup(e.mapping.map(a.before()),w)}t&&NNe(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return C},qvt=(t,e={})=>({tr:n,state:s,dispatch:i,editor:o})=>{var c;const a=dd(t,s.schema),{$from:h,$to:m}=s.selection,x=s.selection.node;if(x&&x.isBlock||h.depth<2||!h.sameParent(m))return!1;const v=h.node(-1);if(v.type!==a)return!1;const w=o.extensionManager.attributes;if(h.parent.content.size===0&&h.node(-1).childCount===h.indexAfter(-1)){if(h.depth===2||h.node(-3).type!==a||h.index(-2)!==h.node(-2).childCount-1)return!1;if(i){let I=gn.empty;const A=h.index(-1)?1:h.index(-2)?2:3;for(let K=h.depth-A;K>=h.depth-3;K-=1)I=gn.from(h.node(K).copy(I));const D=h.indexAfter(-1){if(W>-1)return!1;K.isTextblock&&K.content.size===0&&(W=Z+1)}),W>-1&&n.setSelection(Bi.near(n.doc.resolve(W))),n.scrollIntoView()}return!0}const k=m.pos===h.end()?v.contentMatchAt(0).defaultType:null,C={...aee(w,v.type.name,v.attrs),...e},S={...aee(w,h.node().type.name,h.node().attrs),...e};n.delete(h.pos,m.pos);const T=k?[{type:a,attrs:C},{type:k,attrs:S}]:[{type:a,attrs:C}];if(!zx(n.doc,h.pos,2))return!1;if(i){const{selection:I,storedMarks:A}=s,{splittableMarks:D}=o.extensionManager,$=A||I.$to.parentOffset&&I.$from.marks();if(n.split(h.pos,2,T).scrollIntoView(),!$||!i)return!0;const F=$.filter(q=>D.includes(q.type.name));n.ensureMarks(F)}return!0},hce=(t,e)=>{const n=Gxe(c=>c.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const i=t.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&V1(t.doc,n.pos)&&t.join(n.pos),!0},fce=(t,e)=>{const n=Gxe(c=>c.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const i=t.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&V1(t.doc,s)&&t.join(s),!0},Vvt=(t,e,n,s={})=>({editor:i,tr:o,state:c,dispatch:a,chain:h,commands:m,can:x})=>{const{extensions:v,splittableMarks:w}=i.extensionManager,k=dd(t,c.schema),C=dd(e,c.schema),{selection:S,storedMarks:T}=c,{$from:I,$to:A}=S,D=I.blockRange(A),$=T||S.$to.parentOffset&&S.$from.marks();if(!D)return!1;const F=Gxe(q=>kNe(q.type.name,v))(S);if(D.depth>=1&&F&&D.depth-F.depth<=1){if(F.node.type===k)return m.liftListItem(C);if(kNe(F.node.type.name,v)&&k.validContent(F.node.content)&&a)return h().command(()=>(o.setNodeMarkup(F.pos,k),!0)).command(()=>hce(o,k)).command(()=>fce(o,k)).run()}return!n||!$||!a?h().command(()=>x().wrapInList(k,s)?!0:m.clearNodes()).wrapInList(k,s).command(()=>hce(o,k)).command(()=>fce(o,k)).run():h().command(()=>{const q=x().wrapInList(k,s),W=$.filter(K=>w.includes(K.type.name));return o.ensureMarks(W),q?!0:m.clearNodes()}).wrapInList(k,s).command(()=>hce(o,k)).command(()=>fce(o,k)).run()},Hvt=(t,e={},n={})=>({state:s,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,c=W1(t,s.schema);return Bhe(s,c,e)?i.unsetMark(c,{extendEmptyMarkRange:o}):i.setMark(c,e)},Wvt=(t,e,n={})=>({state:s,commands:i})=>{const o=dd(t,s.schema),c=dd(e,s.schema),a=nE(s,o,n);let h;return s.selection.$anchor.sameParent(s.selection.$head)&&(h=s.selection.$anchor.parent.attrs),a?i.setNode(c,h):i.setNode(o,{...h,...n})},Gvt=(t,e={})=>({state:n,commands:s})=>{const i=dd(t,n.schema);return nE(n,i,e)?s.lift(i):s.wrapIn(i,e)},Kvt=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let s=0;s=0;h-=1)c.step(a.steps[h].invert(a.docs[h]));if(o.text){const h=c.doc.resolve(o.from).marks();c.replaceWith(o.from,o.to,t.schema.text(o.text,h))}else c.delete(o.from,o.to)}return!0}}return!1},Zvt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:s,ranges:i}=n;return s||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},Yvt=(t,e={})=>({tr:n,state:s,dispatch:i})=>{var o;const{extendEmptyMarkRange:c=!1}=e,{selection:a}=n,h=W1(t,s.schema),{$from:m,empty:x,ranges:v}=a;if(!i)return!0;if(x&&c){let{from:w,to:k}=a;const C=(o=m.marks().find(T=>T.type===h))===null||o===void 0?void 0:o.attrs,S=Hxe(m,h,C);S&&(w=S.from,k=S.to),n.removeMark(w,k,h)}else v.forEach(w=>{n.removeMark(w.$from.pos,w.$to.pos,h)});return n.removeStoredMark(h),!0},Xvt=(t,e={})=>({tr:n,state:s,dispatch:i})=>{let o=null,c=null;const a=Lse(typeof t=="string"?t:t.name,s.schema);return a?(a==="node"&&(o=dd(t,s.schema)),a==="mark"&&(c=W1(t,s.schema)),i&&n.selection.ranges.forEach(h=>{const m=h.$from.pos,x=h.$to.pos;let v,w,k,C;n.selection.empty?s.doc.nodesBetween(m,x,(S,T)=>{o&&o===S.type&&(k=Math.max(T,m),C=Math.min(T+S.nodeSize,x),v=T,w=S)}):s.doc.nodesBetween(m,x,(S,T)=>{T=m&&T<=x&&(o&&o===S.type&&n.setNodeMarkup(T,void 0,{...S.attrs,...e}),c&&S.marks.length&&S.marks.forEach(I=>{if(c===I.type){const A=Math.max(T,m),D=Math.min(T+S.nodeSize,x);n.addMark(A,D,c.create({...I.attrs,...e}))}}))}),w&&(v!==void 0&&n.setNodeMarkup(v,void 0,{...w.attrs,...e}),c&&w.marks.length&&w.marks.forEach(S=>{c===S.type&&n.addMark(k,C,c.create({...S.attrs,...e}))}))}),!0):!1},Qvt=(t,e={})=>({state:n,dispatch:s})=>{const i=dd(t,n.schema);return d1t(i,e)(n,s)},Jvt=(t,e={})=>({state:n,dispatch:s})=>{const i=dd(t,n.schema);return u1t(i,e)(n,s)};var e_t=Object.freeze({__proto__:null,blur:L1t,clearContent:O1t,clearNodes:D1t,command:R1t,createParagraphNear:F1t,cut:z1t,deleteCurrentNode:B1t,deleteNode:$1t,deleteRange:U1t,deleteSelection:q1t,enter:V1t,exitCode:H1t,extendMarkRange:W1t,first:G1t,focus:Z1t,forEach:Y1t,insertContent:X1t,insertContentAt:evt,joinBackward:nvt,joinDown:rvt,joinForward:svt,joinItemBackward:ivt,joinItemForward:avt,joinTextblockBackward:ovt,joinTextblockForward:lvt,joinUp:tvt,keyboardShortcut:dvt,lift:uvt,liftEmptyBlock:hvt,liftListItem:fvt,newlineInCode:pvt,resetAttributes:mvt,scrollIntoView:gvt,selectAll:xvt,selectNodeBackward:yvt,selectNodeForward:vvt,selectParentNode:_vt,selectTextblockEnd:bvt,selectTextblockStart:wvt,setContent:jvt,setMark:Dvt,setMeta:Rvt,setNode:Fvt,setNodeSelection:zvt,setTextSelection:Bvt,sinkListItem:$vt,splitBlock:Uvt,splitListItem:qvt,toggleList:Vvt,toggleMark:Hvt,toggleNode:Wvt,toggleWrap:Gvt,undoInputRule:Kvt,unsetAllMarks:Zvt,unsetMark:Yvt,updateAttributes:Xvt,wrapIn:Qvt,wrapInList:Jvt});const t_t=Id.create({name:"commands",addCommands(){return{...e_t}}}),r_t=Id.create({name:"drop",addProseMirrorPlugins(){return[new Ld({key:new nf("tiptapDrop"),props:{handleDrop:(t,e,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:s})}}})]}}),n_t=Id.create({name:"editable",addProseMirrorPlugins(){return[new Ld({key:new nf("editable"),props:{editable:()=>this.editor.options.editable}})]}}),s_t=new nf("focusEvents"),i_t=Id.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ld({key:s_t,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const s=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(s),!1},blur:(e,n)=>{t.isFocused=!1;const s=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(s),!1}}}})]}}),a_t=Id.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:c})=>[()=>c.undoInputRule(),()=>c.command(({tr:a})=>{const{selection:h,doc:m}=a,{empty:x,$anchor:v}=h,{pos:w,parent:k}=v,C=v.parent.isTextblock&&w>0?a.doc.resolve(w-1):v,S=C.parent.type.spec.isolating,T=v.pos-v.parentOffset,I=S&&C.parent.childCount===1?T===v.pos:la.atStart(m).from===w;return!x||!k.type.isTextblock||k.textContent.length||!I||I&&v.parent.type.name==="paragraph"?!1:c.clearNodes()}),()=>c.deleteSelection(),()=>c.joinBackward(),()=>c.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:c})=>[()=>c.deleteSelection(),()=>c.deleteCurrentNode(),()=>c.joinForward(),()=>c.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:c})=>[()=>c.newlineInCode(),()=>c.createParagraphNear(),()=>c.liftEmptyBlock(),()=>c.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...s},o={...s,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Wxe()||OFe()?o:i},addProseMirrorPlugins(){return[new Ld({key:new nf("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(S=>S.getMeta("composition")))return;const s=t.some(S=>S.docChanged)&&!e.doc.eq(n.doc),i=t.some(S=>S.getMeta("preventClearDocument"));if(!s||i)return;const{empty:o,from:c,to:a}=e.selection,h=la.atStart(e.doc).from,m=la.atEnd(e.doc).to;if(o||!(c===h&&a===m)||!Zxe(n.doc))return;const w=n.tr,k=Tse({state:n,transaction:w}),{commands:C}=new Ase({editor:this.editor,state:k});if(C.clearNodes(),!!w.steps.length)return w}})]}}),o_t=Id.create({name:"paste",addProseMirrorPlugins(){return[new Ld({key:new nf("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),l_t=Id.create({name:"tabindex",addProseMirrorPlugins(){return[new Ld({key:new nf("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class xw{get name(){return this.node.type.name}constructor(e,n,s=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,s=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:n,to:s},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new xw(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new xw(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new xw(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,s)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,c=this.pos+s+(o?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(c);if(!i&&a.depth<=this.depth)return;const h=new xw(a,this.editor,i,i?n:null);i&&(h.actualDepth=this.depth+1),e.push(new xw(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let s=null,i=this.parent;for(;i&&!s;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,c=Object.keys(n);for(let a=0;a{s&&i.length>0||(c.node.type.name===e&&o.every(h=>n[h]===c.node.attrs[h])&&i.push(c),!(s&&i.length>0)&&(i=i.concat(c.querySelectorAll(e,n,s))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const c_t=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function d_t(t,e,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class u_t extends y1t{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:s,moved:i})=>this.options.onDrop(n,s,i)),this.on("paste",({event:n,slice:s})=>this.options.onPaste(n,s)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=d_t(c_t,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const s=MFe(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let s=n;if([].concat(e).forEach(o=>{const c=typeof o=="string"?`${o}$`:o.key;s=s.filter(a=>!a.key.startsWith(c))}),n.length===s.length)return;const i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[n_t,P1t.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),t_t,i_t,a_t,l_t,r_t,o_t].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new MS(i,this)}createCommandManager(){this.commandManager=new Ase({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=zhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(c){if(!(c instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(c.message))throw c;this.emit("contentError",{editor:this,error:c,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=zhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=PFe(n,this.options.autofocus);this.view=new fFe(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:CS.create({doc:n,selection:s||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(c=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(c)});return}const n=this.state.apply(e),s=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),s&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return RFe(this.state,e)}isActive(e,n){const s=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return Pvt(this.state,s,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return qxe(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` `,textSerializers:s={}}=e||{};return Mvt(this.state.doc,{blockSeparator:n,textSerializers:{...AFe(this.schema),...s}})}get isEmpty(){return Zxe(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(e,n))||null}$nodes(e,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new xw(n,this)}get $doc(){return this.$pos(0)}}function mC(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s})=>{const i=da(t.getAttributes,void 0,s);if(i===!1||i===null)return null;const{tr:o}=e,c=s[s.length-1],a=s[0];if(c){const h=a.search(/\S/),m=n.from+a.indexOf(c),x=m+c.length;if(Kxe(n.from,n.to,e.doc).filter(k=>k.mark.type.excluded.find(S=>S===t.type&&S!==k.mark.type)).filter(k=>k.to>m).length)return null;xn.from&&o.delete(n.from+h,m);const w=n.from+h+c.length;o.addMark(n.from+h,w,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function h_t(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s})=>{const i=da(t.getAttributes,void 0,s)||{},{tr:o}=e,c=n.from;let a=n.to;const h=t.type.create(i);if(s[1]){const m=s[0].lastIndexOf(s[1]);let x=c+m;x>a?x=a:a=x+s[1].length;const v=s[0][s[0].length-1];o.insertText(v,c+s[0].length-1),o.replaceWith(x,a,h)}else if(s[0]){const m=t.type.isInline?c:c-1;o.insert(m,t.type.create(i)).delete(o.mapping.map(c),o.mapping.map(a))}o.scrollIntoView()}})}function $he(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s})=>{const i=e.doc.resolve(n.from),o=da(t.getAttributes,void 0,s)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function sE(t){return new Ise({find:t.find,handler:({state:e,range:n,match:s,chain:i})=>{const o=da(t.getAttributes,void 0,s)||{},c=e.tr.delete(n.from,n.to),h=c.doc.resolve(n.from).blockRange(),m=h&&Cxe(h,t.type,o);if(!m)return null;if(c.wrap(h,m),t.keepMarks&&t.editor){const{selection:v,storedMarks:w}=e,{splittableMarks:k}=t.editor.extensionManager,C=w||v.$to.parentOffset&&v.$from.marks();if(C){const S=C.filter(T=>k.includes(T.type.name));c.ensureMarks(S)}}if(t.keepAttributes){const v=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(v,o).run()}const x=c.doc.resolve(n.from-1).nodeBefore;x&&x.type===t.type&&V1(c.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(s,x))&&c.join(n.from-1)}})}let _m=class Uhe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=da(ws(this,"addOptions",{name:this.name}))),this.storage=da(ws(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Uhe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Pse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Uhe(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=da(ws(n,"addOptions",{name:n.name})),n.storage=da(ws(n,"addStorage",{name:n.name,options:n.options})),n}};function zj(t){return new C1t({find:t.find,handler:({state:e,range:n,match:s,pasteEvent:i})=>{const o=da(t.getAttributes,void 0,s,i);if(o===!1||o===null)return null;const{tr:c}=e,a=s[s.length-1],h=s[0];let m=n.to;if(a){const x=h.search(/\S/),v=n.from+h.indexOf(a),w=v+a.length;if(Kxe(n.from,n.to,e.doc).filter(C=>C.mark.type.excluded.find(T=>T===t.type&&T!==C.mark.type)).filter(C=>C.to>v).length)return null;wn.from&&c.delete(n.from+x,v),m=n.from+x+a.length,c.addMark(n.from+x,m,t.type.create(o||{})),c.removeStoredMark(t.type)}}})}function f_t(t,e){const{selection:n}=t,{$from:s}=n;if(n instanceof ti){const o=s.index();return s.parent.canReplaceWith(o,o+1,e)}let i=s.depth;for(;i>=0;){const o=s.index(i);if(s.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function p_t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var FFe={exports:{}},pce={};/** * @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 SNe;function m_t(){if(SNe)return pce;SNe=1;var t=lt;function e(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,i=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function a(v,w){var k=w(),C=s({inst:{value:k,getSnapshot:w}}),S=C[0].inst,T=C[1];return o(function(){S.value=k,S.getSnapshot=w,h(S)&&T({inst:S})},[v,k,w]),i(function(){return h(S)&&T({inst:S}),v(function(){h(S)&&T({inst:S})})},[v]),c(k),k}function h(v){var w=v.getSnapshot;v=v.value;try{var k=w();return!n(v,k)}catch{return!0}}function m(v,w){return w()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:a;return pce.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:x,pce}FFe.exports=m_t();var Yxe=FFe.exports;const g_t=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},x_t=({contentComponent:t})=>{const e=Yxe.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return lt.createElement(lt.Fragment,null,Object.values(e))};function y_t(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,s){e={...e,[n]:Cme.createPortal(s.reactElement,s.element,n)},t.forEach(i=>i())},removeRenderer(n){const s={...e};delete s[n],e=s,t.forEach(i=>i())}}}class v_t extends lt.Component{constructor(e){var n;super(e),this.editorContentRef=lt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=y_t(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...s}=this.props;return lt.createElement(lt.Fragment,null,lt.createElement("div",{ref:g_t(n,this.editorContentRef),...s}),(e==null?void 0:e.contentComponent)&<.createElement(x_t,{contentComponent:e.contentComponent}))}}const __t=P.forwardRef((t,e)=>{const n=lt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return lt.createElement(v_t,{key:n,innerRef:e,...t})}),zFe=lt.memo(__t);var b_t=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var s,i,o;if(Array.isArray(e)){if(s=e.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(s=e.length,s!=n.length)return!1;for(i=s;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(o=Object.keys(e),s=o.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=s;i--!==0;){var c=o[i];if(!(c==="_owner"&&e.$$typeof)&&!t(e[c],n[c]))return!1}return!0}return e!==e&&n!==n},w_t=p_t(b_t),BFe={exports:{}},mce={};/** * @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 CNe;function j_t(){if(CNe)return mce;CNe=1;var t=lt,e=Yxe;function n(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var s=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,c=t.useEffect,a=t.useMemo,h=t.useDebugValue;return mce.useSyncExternalStoreWithSelector=function(m,x,v,w,k){var C=o(null);if(C.current===null){var S={hasValue:!1,value:null};C.current=S}else S=C.current;C=a(function(){function I(q){if(!A){if(A=!0,D=q,q=w(q),k!==void 0&&S.hasValue){var W=S.value;if(k(W,q))return $=W}return $=q}if(W=$,s(D,q))return W;var K=w(q);return k!==void 0&&k(W,K)?W:(D=q,$=K)}var A=!1,D,$,F=v===void 0?null:v;return[function(){return I(x())},F===null?void 0:function(){return I(F())}]},[x,v,w,k]);var T=i(m,C[0],C[1]);return c(function(){S.hasValue=!0,S.value=T},[T]),h(T),T},mce}BFe.exports=j_t();var k_t=BFe.exports;const N_t=typeof window<"u"?P.useLayoutEffect:P.useEffect;class S_t{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},s=this.editor;return s.on("transaction",n),()=>{s.off("transaction",n)}}}}function C_t(t){var e;const[n]=P.useState(()=>new S_t(t.editor)),s=k_t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:w_t);return N_t(()=>n.watch(t.editor),[t.editor,n]),P.useDebugValue(s),s}const M_t=!1,qhe=typeof window>"u",T_t=qhe||!!(typeof window<"u"&&window.next);class Xxe{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?qhe||T_t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...s)},onBlur:(...s)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...s)},onCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...s)},onDestroy:(...s)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...s)},onFocus:(...s)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...s)},onSelectionUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...s)},onTransaction:(...s)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...s)},onUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...s)},onContentError:(...s)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...s)},onDrop:(...s)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...s)},onPaste:(...s)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...s)}};return new u_t(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,o)=>{var c;return i===((c=n.extensions)===null||c===void 0?void 0:c[o])}):e[s]===n[s])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Xxe.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((s,i)=>s===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function $Fe(t={},e=[]){const n=P.useRef(t);n.current=t;const[s]=P.useState(()=>new Xxe(n)),i=Yxe.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return P.useDebugValue(i),P.useEffect(s.onRender(e)),C_t({editor:i,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),i}const A_t=P.createContext({editor:null});A_t.Consumer;const E_t=P.createContext({onDragStart:void 0}),I_t=()=>P.useContext(E_t);lt.forwardRef((t,e)=>{const{onDragStart:n}=I_t(),s=t.as||"div";return lt.createElement(s,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const P_t=/^\s*>\s$/,L_t=_m.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",ud(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[sE({find:P_t,type:this.type})]}}),O_t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,D_t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,R_t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,F_t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,z_t=kg.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",ud(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[mC({find:O_t,type:this.type}),mC({find:R_t,type:this.type})]},addPasteRules(){return[zj({find:D_t,type:this.type}),zj({find:F_t,type:this.type})]}}),B_t="listItem",MNe="textStyle",TNe=/^\s*([-+*])\s$/,$_t=_m.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",ud(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(B_t,this.editor.getAttributes(MNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=sE({find:TNe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=sE({find:TNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(MNe),editor:this.editor})),[t]}}),U_t=/(^|[^`])`([^`]+)`(?!`)/,q_t=/(^|[^`])`([^`]+)`(?!`)/g,V_t=kg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ud(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[mC({find:U_t,type:this.type})]},addPasteRules(){return[zj({find:q_t,type:this.type})]}}),H_t=/^```([a-z]+)?[\s\n]$/,W_t=/^~~~([a-z]+)?[\s\n]$/,G_t=_m.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(c=>c.startsWith(n)).map(c=>c.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ud(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type)return!1;const o=s.parentOffset===s.parent.nodeSize-2,c=s.parent.textContent.endsWith(` `);return!o||!c?!1:t.chain().command(({tr:a})=>(a.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:s}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:s.nodeAt(a)?t.commands.command(({tr:m})=>(m.setSelection(la.near(s.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[$he({find:H_t,type:this.type,getAttributes:t=>({language:t[1]})}),$he({find:W_t,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ld({key:new nf("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),s=e.clipboardData.getData("vscode-editor-data"),i=s?JSON.parse(s):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:c,schema:a}=t.state,h=a.text(n.replace(/\r\n?/g,` `));return c.replaceSelectionWith(this.type.create({language:o},h)),c.selection.$from.parent.type!==this.type&&c.setSelection(Bi.near(c.doc.resolve(Math.max(0,c.selection.from-2)))),c.setMeta("paste",!0),t.dispatch(c),!0}}})]}}),K_t=_m.create({name:"doc",topNode:!0,content:"block+"});function Z_t(t={}){return new Ld({view(e){return new Y_t(e,t)}})}class Y_t{constructor(e,n){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=c=>{this[i](c)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,s,i=this.editorView.dom,o=i.getBoundingClientRect(),c=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let v=e.nodeBefore,w=e.nodeAfter;if(v||w){let k=this.editorView.nodeDOM(this.cursorPos-(v?v.nodeSize:0));if(k){let C=k.getBoundingClientRect(),S=v?C.bottom:C.top;v&&w&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let T=this.width/2*a;s={left:C.left,right:C.right,top:S-T,bottom:S+T}}}}if(!s){let v=this.editorView.coordsAtPos(this.cursorPos),w=this.width/2*c;s={left:v.left-w,right:v.left+w,top:v.top,bottom:v.bottom}}let h=this.editorView.dom.offsetParent;this.element||(this.element=h.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let m,x;if(!h||h==document.body&&getComputedStyle(h).position=="static")m=-pageXOffset,x=-pageYOffset;else{let v=h.getBoundingClientRect(),w=v.width/h.offsetWidth,k=v.height/h.offsetHeight;m=v.left-h.scrollLeft*w,x=v.top-h.scrollTop*k}this.element.style.left=(s.left-m)/c+"px",this.element.style.top=(s.top-x)/a+"px",this.element.style.width=(s.right-s.left)/c+"px",this.element.style.height=(s.bottom-s.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=s&&s.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let c=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=NRe(this.editorView.state.doc,c,this.editorView.dragging.slice);a!=null&&(c=a)}this.setCursor(c),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const X_t=Id.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Z_t(this.options)]}});class $l extends la{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return $l.valid(s)?new $l(s):la.near(s)}content(){return hs.empty}eq(e){return e instanceof $l&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new $l(e.resolve(n.pos))}getBookmark(){return new Qxe(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Q_t(e)||!J_t(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&$l.valid(e))return e;let i=e.pos,o=null;for(let c=e.depth;;c--){let a=e.node(c);if(n>0?e.indexAfter(c)0){o=a.child(n>0?e.indexAfter(c):e.index(c)-1);break}else if(c==0)return null;i+=n;let h=e.doc.resolve(i);if($l.valid(h))return h}for(;;){let c=n>0?o.firstChild:o.lastChild;if(!c){if(o.isAtom&&!o.isText&&!ti.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),s=!1;continue e}break}o=c,i+=n;let a=e.doc.resolve(i);if($l.valid(a))return a}return null}}}$l.prototype.visible=!1;$l.findFrom=$l.findGapCursorFrom;la.jsonID("gapcursor",$l);class Qxe{constructor(e){this.pos=e}map(e){return new Qxe(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return $l.valid(n)?new $l(n):la.near(n)}}function UFe(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Q_t(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),s=t.node(e);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||UFe(i.type))return!0;if(i.inlineContent)return!1}}return!0}function J_t(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),s=t.node(e);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||UFe(i.type))return!0;if(i.inlineContent)return!1}}return!0}function e2t(){return new Ld({props:{decorations:s2t,createSelectionBetween(t,e,n){return e.pos==n.pos&&$l.valid(n)?new $l(n):null},handleClick:r2t,handleKeyDown:t2t,handleDOMEvents:{beforeinput:n2t}}})}const t2t=pFe({ArrowLeft:wL("horiz",-1),ArrowRight:wL("horiz",1),ArrowUp:wL("vert",-1),ArrowDown:wL("vert",1)});function wL(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,i,o){let c=s.selection,a=e>0?c.$to:c.$from,h=c.empty;if(c instanceof Bi){if(!o.endOfTextblock(n)||a.depth==0)return!1;h=!1,a=s.doc.resolve(e>0?a.after():a.before())}let m=$l.findGapCursorFrom(a,e,h);return m?(i&&i(s.tr.setSelection(new $l(m))),!0):!1}}function r2t(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!$l.valid(s))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ti.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new $l(s))),!0)}function n2t(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof $l))return!1;let{$from:n}=t.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!s)return!1;let i=gn.empty;for(let c=s.length-1;c>=0;c--)i=gn.from(s[c].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new hs(i,0,0));return o.setSelection(Bi.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function s2t(t){if(!(t.selection instanceof $l))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Lc.create(t.doc,[Of.widget(t.selection.head,e,{key:"gapcursor"})])}const i2t=Id.create({name:"gapCursor",addProseMirrorPlugins(){return[e2t()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=da(ws(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),a2t=_m.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",ud(this.options.HTMLAttributes,t)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:s})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:c}=this.options,{splittableMarks:a}=s.extensionManager,h=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:m,dispatch:x})=>{if(x&&h&&c){const v=h.filter(w=>a.includes(w.type.name));m.ensureMarks(v)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),o2t=_m.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ud(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>$he({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ete=200,cd=function(){};cd.prototype.append=function(e){return e.length?(e=cd.from(e),!this.length&&e||e.length=n?cd.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};cd.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};cd.prototype.forEach=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(e,n,s,0):this.forEachInvertedInner(e,n,s,0)};cd.prototype.map=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var i=[];return this.forEach(function(o,c){return i.push(e(o,c))},n,s),i};cd.from=function(e){return e instanceof cd?e:e&&e.length?new qFe(e):cd.empty};var qFe=function(t){function e(s){t.call(this),this.values=s}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,c,a){for(var h=o;h=c;h--)if(i(this.values[h],a+h)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ete)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ete)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(cd);cd.empty=new qFe([]);var l2t=function(t){function e(n,s){t.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return sa&&this.right.forEachInner(s,Math.max(i-a,0),Math.min(this.length,o)-a,c+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,c){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(s,i-a,Math.max(o,a)-a,c+a)===!1||o=o?this.right.slice(s-o,i-o):this.left.slice(s,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(s){var i=this.right.leafAppend(s);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(s){var i=this.left.leafPrepend(s);if(i)return new e(i,this.right)},e.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new e(this.left,new e(this.right,s)):new e(this,s)},e}(cd);const c2t=500;class Yp{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let i,o;n&&(i=this.remapping(s,this.items.length),o=i.maps.length);let c=e.tr,a,h,m=[],x=[];return this.items.forEach((v,w)=>{if(!v.step){i||(i=this.remapping(s,w+1),o=i.maps.length),o--,x.push(v);return}if(i){x.push(new Gm(v.map));let k=v.step.map(i.slice(o)),C;k&&c.maybeStep(k).doc&&(C=c.mapping.maps[c.mapping.maps.length-1],m.push(new Gm(C,void 0,void 0,m.length+x.length))),o--,C&&i.appendMap(C,o)}else c.maybeStep(v.step);if(v.selection)return a=i?v.selection.map(i.slice(o)):v.selection,h=new Yp(this.items.slice(0,s).append(x.reverse().concat(m)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:c,selection:a}}addTransform(e,n,s,i){let o=[],c=this.eventCount,a=this.items,h=!i&&a.length?a.get(a.length-1):null;for(let x=0;xu2t&&(a=d2t(a,m),c-=m),new Yp(a.append(o),c)}remapping(e,n){let s=new XA;return this.items.forEach((i,o)=>{let c=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?s.maps.length-i.mirrorOffset:void 0;s.appendMap(i.map,c)},e,n),s}addMaps(e){return this.eventCount==0?this:new Yp(this.items.append(e.map(n=>new Gm(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let s=[],i=Math.max(0,this.items.length-n),o=e.mapping,c=e.steps.length,a=this.eventCount;this.items.forEach(w=>{w.selection&&a--},i);let h=n;this.items.forEach(w=>{let k=o.getMirror(--h);if(k==null)return;c=Math.min(c,k);let C=o.maps[k];if(w.step){let S=e.steps[k].invert(e.docs[k]),T=w.selection&&w.selection.map(o.slice(h+1,k));T&&a++,s.push(new Gm(C,S,T))}else s.push(new Gm(C))},i);let m=[];for(let w=n;wc2t&&(v=v.compress(this.items.length-s.length)),v}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),s=n.maps.length,i=[],o=0;return this.items.forEach((c,a)=>{if(a>=e)i.push(c),c.selection&&o++;else if(c.step){let h=c.step.map(n.slice(s)),m=h&&h.getMap();if(s--,m&&n.appendMap(m,s),h){let x=c.selection&&c.selection.map(n.slice(s));x&&o++;let v=new Gm(m.invert(),h,x),w,k=i.length-1;(w=i.length&&i[k].merge(v))?i[k]=w:i.push(v)}}else c.map&&s--},this.items.length,0),new Yp(cd.from(i.reverse()),o)}}Yp.empty=new Yp(cd.empty,0);function d2t(t,e){let n;return t.forEach((s,i)=>{if(s.selection&&e--==0)return n=i,!1}),t.slice(n)}class Gm{constructor(e,n,s,i){this.map=e,this.step=n,this.selection=s,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Gm(n.getMap().invert(),n,this.selection)}}}class d0{constructor(e,n,s,i,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=i,this.prevComposition=o}}const u2t=20;function h2t(t,e,n,s){let i=n.getMeta(hj),o;if(i)return i.historyState;n.getMeta(m2t)&&(t=new d0(t.done,t.undone,null,0,-1));let c=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(c&&c.getMeta(hj))return c.getMeta(hj).redo?new d0(t.done.addTransform(n,void 0,s,oee(e)),t.undone,ANe(n.mapping.maps),t.prevTime,t.prevComposition):new d0(t.done,t.undone.addTransform(n,void 0,s,oee(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(c&&c.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),h=t.prevTime==0||!c&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-s.newGroupDelay||!f2t(n,t.prevRanges)),m=c?gce(t.prevRanges,n.mapping):ANe(n.mapping.maps);return new d0(t.done.addTransform(n,h?e.selection.getBookmark():void 0,s,oee(e)),Yp.empty,m,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new d0(t.done.rebased(n,o),t.undone.rebased(n,o),gce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new d0(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),gce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function f2t(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((s,i)=>{for(let o=0;o=e[o]&&(n=!0)}),n}function ANe(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((s,i,o,c)=>e.push(o,c));return e}function gce(t,e){if(!t)return null;let n=[];for(let s=0;s{let i=hj.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(s){let o=p2t(i,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const HFe=VFe(!1,!0),WFe=VFe(!0,!0),x2t=Id.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>HFe(t,e),redo:()=>({state:t,dispatch:e})=>WFe(t,e)}},addProseMirrorPlugins(){return[g2t(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()}}}),y2t=_m.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ud(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!f_t(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:s,$to:i}=n,o=t();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:i.pos},{type:this.name}):Lvt(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:c,dispatch:a})=>{var h;if(a){const{$to:m}=c.selection,x=m.end();if(m.nodeAfter)m.nodeAfter.isTextblock?c.setSelection(Bi.create(c.doc,m.pos+1)):m.nodeAfter.isBlock?c.setSelection(ti.create(c.doc,m.pos)):c.setSelection(Bi.create(c.doc,m.pos));else{const v=(h=m.parent.type.contentMatch.defaultType)===null||h===void 0?void 0:h.create();v&&(c.insert(x,v),c.setSelection(Bi.create(c.doc,x+1)))}c.scrollIntoView()}return!0}).run()}}},addInputRules(){return[h_t({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),v2t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,_2t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,b2t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,w2t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,j2t=kg.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",ud(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[mC({find:v2t,type:this.type}),mC({find:b2t,type:this.type})]},addPasteRules(){return[zj({find:_2t,type:this.type}),zj({find:w2t,type:this.type})]}}),k2t=_m.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ud(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)}}}),N2t="listItem",INe="textStyle",PNe=/^(\d+)\.\s$/,S2t=_m.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ud(this.options.HTMLAttributes,n),0]:["ol",ud(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(N2t,this.editor.getAttributes(INe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=sE({find:PNe,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=sE({find:PNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(INe)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),C2t=_m.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ud(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),M2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,T2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,A2t=kg.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",ud(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[mC({find:M2t,type:this.type})]},addPasteRules(){return[zj({find:T2t,type:this.type})]}}),E2t=_m.create({name:"text",group:"inline"}),GFe=Id.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(z_t.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(L_t.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push($_t.configure(this.options.bulletList)),this.options.code!==!1&&t.push(V_t.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(G_t.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(K_t.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(X_t.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(i2t.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(a2t.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(o2t.configure(this.options.heading)),this.options.history!==!1&&t.push(x2t.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(y2t.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(j2t.configure(this.options.italic)),this.options.listItem!==!1&&t.push(k2t.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(S2t.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(C2t.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(A2t.configure(this.options.strike)),this.options.text!==!1&&t.push(E2t.configure(this.options.text)),t}}),I2t="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",P2t="ελ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",Vhe="numeric",Hhe="ascii",Whe="alpha",sA="asciinumeric",lT="alphanumeric",Ghe="domain",KFe="emoji",L2t="scheme",O2t="slashscheme",yce="whitespace";function D2t(t,e){return t in e||(e[t]=[]),e[t]}function Mw(t,e,n){e[Vhe]&&(e[sA]=!0,e[lT]=!0),e[Hhe]&&(e[sA]=!0,e[Whe]=!0),e[sA]&&(e[lT]=!0),e[Whe]&&(e[lT]=!0),e[lT]&&(e[Ghe]=!0),e[KFe]&&(e[Ghe]=!0);for(const s in e){const i=D2t(s,n);i.indexOf(t)<0&&i.push(t)}}function R2t(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function sh(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}sh.groups={};sh.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let s=0;st.ta(e,n,s,i),Ol=(t,e,n,s,i)=>t.tr(e,n,s,i),LNe=(t,e,n,s,i)=>t.ts(e,n,s,i),Nn=(t,e,n,s,i)=>t.tt(e,n,s,i),ux="WORD",Khe="UWORD",ZFe="ASCIINUMERICAL",YFe="ALPHANUMERICAL",iE="LOCALHOST",Zhe="TLD",Yhe="UTLD",lee="SCHEME",pS="SLASH_SCHEME",Jxe="NUM",Xhe="WS",eye="NL",iA="OPENBRACE",aA="CLOSEBRACE",Ite="OPENBRACKET",Pte="CLOSEBRACKET",Lte="OPENPAREN",Ote="CLOSEPAREN",Dte="OPENANGLEBRACKET",Rte="CLOSEANGLEBRACKET",Fte="FULLWIDTHLEFTPAREN",zte="FULLWIDTHRIGHTPAREN",Bte="LEFTCORNERBRACKET",$te="RIGHTCORNERBRACKET",Ute="LEFTWHITECORNERBRACKET",qte="RIGHTWHITECORNERBRACKET",Vte="FULLWIDTHLESSTHAN",Hte="FULLWIDTHGREATERTHAN",Wte="AMPERSAND",Gte="APOSTROPHE",Kte="ASTERISK",u0="AT",Zte="BACKSLASH",Yte="BACKTICK",Xte="CARET",y0="COLON",tye="COMMA",Qte="DOLLAR",Km="DOT",Jte="EQUALS",rye="EXCLAMATION",jf="HYPHEN",oA="PERCENT",ere="PIPE",tre="PLUS",rre="POUND",lA="QUERY",nye="QUOTE",XFe="FULLWIDTHMIDDLEDOT",sye="SEMI",Zm="SLASH",cA="TILDE",nre="UNDERSCORE",QFe="EMOJI",sre="SYM";var JFe=Object.freeze({__proto__:null,ALPHANUMERICAL:YFe,AMPERSAND:Wte,APOSTROPHE:Gte,ASCIINUMERICAL:ZFe,ASTERISK:Kte,AT:u0,BACKSLASH:Zte,BACKTICK:Yte,CARET:Xte,CLOSEANGLEBRACKET:Rte,CLOSEBRACE:aA,CLOSEBRACKET:Pte,CLOSEPAREN:Ote,COLON:y0,COMMA:tye,DOLLAR:Qte,DOT:Km,EMOJI:QFe,EQUALS:Jte,EXCLAMATION:rye,FULLWIDTHGREATERTHAN:Hte,FULLWIDTHLEFTPAREN:Fte,FULLWIDTHLESSTHAN:Vte,FULLWIDTHMIDDLEDOT:XFe,FULLWIDTHRIGHTPAREN:zte,HYPHEN:jf,LEFTCORNERBRACKET:Bte,LEFTWHITECORNERBRACKET:Ute,LOCALHOST:iE,NL:eye,NUM:Jxe,OPENANGLEBRACKET:Dte,OPENBRACE:iA,OPENBRACKET:Ite,OPENPAREN:Lte,PERCENT:oA,PIPE:ere,PLUS:tre,POUND:rre,QUERY:lA,QUOTE:nye,RIGHTCORNERBRACKET:$te,RIGHTWHITECORNERBRACKET:qte,SCHEME:lee,SEMI:sye,SLASH:Zm,SLASH_SCHEME:pS,SYM:sre,TILDE:cA,TLD:Zhe,UNDERSCORE:nre,UTLD:Yhe,UWORD:Khe,WORD:ux,WS:Xhe});const ox=/[a-z]/,DM=new RegExp("\\p{L}","u"),vce=new RegExp("\\p{Emoji}","u"),lx=/\d/,_ce=/\s/,ONe="\r",bce=` `,F2t="️",z2t="‍",wce="";let jL=null,kL=null;function B2t(t=[]){const e={};sh.groups=e;const n=new sh;jL==null&&(jL=DNe(I2t)),kL==null&&(kL=DNe(P2t)),Nn(n,"'",Gte),Nn(n,"{",iA),Nn(n,"}",aA),Nn(n,"[",Ite),Nn(n,"]",Pte),Nn(n,"(",Lte),Nn(n,")",Ote),Nn(n,"<",Dte),Nn(n,">",Rte),Nn(n,"(",Fte),Nn(n,")",zte),Nn(n,"「",Bte),Nn(n,"」",$te),Nn(n,"『",Ute),Nn(n,"』",qte),Nn(n,"<",Vte),Nn(n,">",Hte),Nn(n,"&",Wte),Nn(n,"*",Kte),Nn(n,"@",u0),Nn(n,"`",Yte),Nn(n,"^",Xte),Nn(n,":",y0),Nn(n,",",tye),Nn(n,"$",Qte),Nn(n,".",Km),Nn(n,"=",Jte),Nn(n,"!",rye),Nn(n,"-",jf),Nn(n,"%",oA),Nn(n,"|",ere),Nn(n,"+",tre),Nn(n,"#",rre),Nn(n,"?",lA),Nn(n,'"',nye),Nn(n,"/",Zm),Nn(n,";",sye),Nn(n,"~",cA),Nn(n,"_",nre),Nn(n,"\\",Zte),Nn(n,"・",XFe);const s=Ol(n,lx,Jxe,{[Vhe]:!0});Ol(s,lx,s);const i=Ol(s,ox,ZFe,{[sA]:!0}),o=Ol(s,DM,YFe,{[lT]:!0}),c=Ol(n,ox,ux,{[Hhe]:!0});Ol(c,lx,i),Ol(c,ox,c),Ol(i,lx,i),Ol(i,ox,i);const a=Ol(n,DM,Khe,{[Whe]:!0});Ol(a,ox),Ol(a,lx,o),Ol(a,DM,a),Ol(o,lx,o),Ol(o,ox),Ol(o,DM,o);const h=Nn(n,bce,eye,{[yce]:!0}),m=Nn(n,ONe,Xhe,{[yce]:!0}),x=Ol(n,_ce,Xhe,{[yce]:!0});Nn(n,wce,x),Nn(m,bce,h),Nn(m,wce,x),Ol(m,_ce,x),Nn(x,ONe),Nn(x,bce),Ol(x,_ce,x),Nn(x,wce,x);const v=Ol(n,vce,QFe,{[KFe]:!0});Nn(v,"#"),Ol(v,vce,v),Nn(v,F2t,v);const w=Nn(v,z2t);Nn(w,"#"),Ol(w,vce,v);const k=[[ox,c],[lx,i]],C=[[ox,null],[DM,a],[lx,o]];for(let S=0;SS[0]>T[0]?1:-1);for(let S=0;S=0?A[Ghe]=!0:ox.test(T)?lx.test(T)?A[sA]=!0:A[Hhe]=!0:A[Vhe]=!0,LNe(n,T,T,A)}return LNe(n,"localhost",iE,{ascii:!0}),n.jd=new sh(sre),{start:n,tokens:Object.assign({groups:e},JFe)}}function eze(t,e){const n=$2t(e.replace(/[A-Z]/g,a=>a.toLowerCase())),s=n.length,i=[];let o=0,c=0;for(;c=0&&(v+=n[c].length,w++),m+=n[c].length,o+=n[c].length,c++;o-=v,c-=w,m-=v,i.push({t:x.t,v:e.slice(o-m,o),s:o-m,e:o})}return i}function $2t(t){const e=[],n=t.length;let s=0;for(;s56319||s+1===n||(o=t.charCodeAt(s+1))<56320||o>57343?t[s]:t.slice(s,s+2);e.push(c),s+=c.length}return e}function Yy(t,e,n,s,i){let o;const c=e.length;for(let a=0;a=0;)o++;if(o>0){e.push(n.join(""));for(let c=parseInt(t.substring(s,s+o),10);c>0;c--)n.pop();s+=o}else n.push(t[s]),s++}return e}const aE={defaultProtocol:"http",events:null,format:RNe,formatHref:RNe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function iye(t,e=null){let n=Object.assign({},aE);t&&(n=Object.assign(n,t instanceof iye?t.o:t));const s=n.ignoreTags,i=[];for(let o=0;on?s.substring(0,n)+"…":s},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=aE.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),s=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),c={},a=t.get("className",n,e),h=t.get("target",n,e),m=t.get("rel",n,e),x=t.getObj("attributes",n,e),v=t.getObj("events",n,e);return c.href=s,a&&(c.class=a),h&&(c.target=h),m&&(c.rel=m),x&&Object.assign(c,x),{tagName:i,attributes:c,content:o,eventListeners:v}}};function Ose(t,e){class n extends tze{constructor(i,o){super(i,o),this.t=t}}for(const s in e)n.prototype[s]=e[s];return n.t=t,n}const FNe=Ose("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),zNe=Ose("text"),U2t=Ose("nl"),NL=Ose("url",{isLink:!0,toHref(t=aE.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==iE&&t[1].t===y0}}),vf=t=>new sh(t);function q2t({groups:t}){const e=t.domain.concat([Wte,Kte,u0,Zte,Yte,Xte,Qte,Jte,jf,Jxe,oA,ere,tre,rre,Zm,sre,cA,nre]),n=[Gte,y0,tye,Km,rye,oA,lA,nye,sye,Dte,Rte,iA,aA,Pte,Ite,Lte,Ote,Fte,zte,Bte,$te,Ute,qte,Vte,Hte],s=[Wte,Gte,Kte,Zte,Yte,Xte,Qte,Jte,jf,iA,aA,oA,ere,tre,rre,lA,Zm,sre,cA,nre],i=vf(),o=Nn(i,cA);aa(o,s,o),aa(o,t.domain,o);const c=vf(),a=vf(),h=vf();aa(i,t.domain,c),aa(i,t.scheme,a),aa(i,t.slashscheme,h),aa(c,s,o),aa(c,t.domain,c);const m=Nn(c,u0);Nn(o,u0,m),Nn(a,u0,m),Nn(h,u0,m);const x=Nn(o,Km);aa(x,s,o),aa(x,t.domain,o);const v=vf();aa(m,t.domain,v),aa(v,t.domain,v);const w=Nn(v,Km);aa(w,t.domain,v);const k=vf(FNe);aa(w,t.tld,k),aa(w,t.utld,k),Nn(m,iE,k);const C=Nn(v,jf);Nn(C,jf,C),aa(C,t.domain,v),aa(k,t.domain,v),Nn(k,Km,w),Nn(k,jf,C);const S=Nn(k,y0);aa(S,t.numeric,FNe);const T=Nn(c,jf),I=Nn(c,Km);Nn(T,jf,T),aa(T,t.domain,c),aa(I,s,o),aa(I,t.domain,c);const A=vf(NL);aa(I,t.tld,A),aa(I,t.utld,A),aa(A,t.domain,c),aa(A,s,o),Nn(A,Km,I),Nn(A,jf,T),Nn(A,u0,m);const D=Nn(A,y0),$=vf(NL);aa(D,t.numeric,$);const F=vf(NL),q=vf();aa(F,e,F),aa(F,n,q),aa(q,e,F),aa(q,n,q),Nn(A,Zm,F),Nn($,Zm,F);const W=Nn(a,y0),K=Nn(h,y0),Z=Nn(K,Zm),re=Nn(Z,Zm);aa(a,t.domain,c),Nn(a,Km,I),Nn(a,jf,T),aa(h,t.domain,c),Nn(h,Km,I),Nn(h,jf,T),aa(W,t.domain,F),Nn(W,Zm,F),Nn(W,lA,F),aa(re,t.domain,F),aa(re,e,F),Nn(re,Zm,F);const he=[[iA,aA],[Ite,Pte],[Lte,Ote],[Dte,Rte],[Fte,zte],[Bte,$te],[Ute,qte],[Vte,Hte]];for(let ue=0;ue=0&&w++,i++,x++;if(w<0)i-=x,i0&&(o.push(jce(zNe,e,c)),c=[]),i-=w,x-=w;const k=v.t,C=n.slice(i-x,i);o.push(jce(k,e,C))}}return c.length>0&&o.push(jce(zNe,e,c)),o}function jce(t,e,n){const s=n[0].s,i=n[n.length-1].e,o=e.slice(s,i);return new t(o,n)}const H2t=typeof console<"u"&&console&&console.warn||(()=>{}),W2t="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",al={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function G2t(){return sh.groups={},al.scanner=null,al.parser=null,al.tokenQueue=[],al.pluginQueue=[],al.customSchemes=[],al.initialized=!1,al}function BNe(t,e=!1){if(al.initialized&&H2t(`linkifyjs: already initialized - will not register custom scheme "${t}" ${W2t}`),!/^[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`);al.customSchemes.push([t,e])}function K2t(){al.scanner=B2t(al.customSchemes);for(let t=0;t{const i=e.some(m=>m.docChanged)&&!n.doc.eq(s.doc),o=e.some(m=>m.getMeta("preventAutolink"));if(!i||o)return;const{tr:c}=s,a=kvt(n.doc,[...e]);if(Ivt(a).forEach(({newRange:m})=>{const x=Svt(s.doc,m,k=>k.isTextblock);let v,w;if(x.length>1)v=x[0],w=s.doc.textBetween(v.pos,v.pos+v.node.nodeSize,void 0," ");else if(x.length){const k=s.doc.textBetween(m.from,m.to," "," ");if(!Y2t.test(k))return;v=x[0],w=s.doc.textBetween(v.pos,m.to,void 0," ")}if(v&&w){const k=w.split(Z2t).filter(Boolean);if(k.length<=0)return!1;const C=k[k.length-1],S=v.pos+w.lastIndexOf(C);if(!C)return!1;const T=aye(C).map(I=>I.toObject(t.defaultProtocol));if(!Q2t(T))return!1;T.filter(I=>I.isLink).map(I=>({...I,from:S+I.start+1,to:S+I.end+1})).filter(I=>s.schema.marks.code?!s.doc.rangeHasMark(I.from,I.to,s.schema.marks.code):!0).filter(I=>t.validate(I.value)).filter(I=>t.shouldAutoLink(I.value)).forEach(I=>{Kxe(I.from,I.to,s.doc).some(A=>A.mark.type===t.type)||c.addMark(I.from,I.to,t.type.create({href:I.href}))})}}),!!c.steps.length)return c}})}function ebt(t){return new Ld({key:new nf("handleClickLink"),props:{handleClick:(e,n,s)=>{var i,o;if(s.button!==0||!e.editable)return!1;let c=s.target;const a=[];for(;c.nodeName!=="DIV";)a.push(c),c=c.parentNode;if(!a.find(w=>w.nodeName==="A"))return!1;const h=RFe(e.state,t.type.name),m=s.target,x=(i=m==null?void 0:m.href)!==null&&i!==void 0?i:h.href,v=(o=m==null?void 0:m.target)!==null&&o!==void 0?o:h.target;return m&&x?(window.open(x,v),!0):!1}}})}function tbt(t){return new Ld({key:new nf("handlePasteLink"),props:{handlePaste:(e,n,s)=>{const{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let a="";s.content.forEach(m=>{a+=m.textContent});const h=rze(a,{defaultProtocol:t.defaultProtocol}).find(m=>m.isLink&&m.value===a);return!a||!h?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Vv(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(s=>{const i=typeof s=="string"?s:s.scheme;i&&n.push(i)}),!t||t.replace(X2t,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const nze=kg.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"){BNe(t);return}BNe(t.scheme,t.optionalSlashes)})},onDestroy(){G2t()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Vv(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Vv(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Vv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ud(this.options.HTMLAttributes,t),0]:["a",ud(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!Vv(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!Vv(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[zj({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,i=rze(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:c=>!!Vv(c,n),protocols:n,defaultProtocol:s}));i.length&&i.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(J2t({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:i=>!!Vv(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(ebt({type:this.type})),this.options.linkOnPaste&&t.push(tbt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),sze=Id.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),rbt=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var s,i;const o=n.getAttribute("style"),c=(i=(s=n.parentElement)===null||s===void 0?void 0:s.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");n.setAttribute("style",`${c};${o}`)})},ize=kg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&rbt(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",ud(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,s)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||t.removeMark(s,s+n.nodeSize,this.type)}),!0}}}});function iy({content:t,onChange:e,placeholder:n="Enter content...",minHeight:s="150px"}){const[i,o]=P.useState(!1),[c,a]=P.useState(""),[h,m]=P.useState(!0),x=$Fe({extensions:[GFe,nze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),sze.configure({types:["heading","paragraph"]}),ize],content:t,onUpdate:({editor:C})=>{e(C.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n}}});P.useEffect(()=>{x&&t!==x.getHTML()&&x.commands.setContent(t)},[t,x]);const v=()=>{if(!x)return;const C=x.getAttributes("link").href||"",S=x.getAttributes("link").target;a(C),m(S==="_blank"),o(!0)},w=()=>{x&&(c===""?x.chain().focus().extendMarkRange("link").unsetLink().run():x.chain().focus().extendMarkRange("link").setLink({href:c,target:h?"_blank":null,rel:h?"noopener noreferrer nofollow":null}).run(),o(!1),a(""))},k=()=>{x&&x.chain().focus().extendMarkRange("link").unsetLink().run()};return x?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),className:x.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(NT,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),className:x.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(ST,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBold().run(),className:x.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(qS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleItalic().run(),className:x.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(XS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBulletList().run(),className:x.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx($f,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleOrderedList().run(),className:x.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(t4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("left").run(),className:x.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx($S,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("center").run(),className:x.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(BS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("right").run(),className:x.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(US,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:v,className:x.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(bo,{className:"h-4 w-4"})}),x.isActive("link")&&r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:k,title:"Remove Link",children:r.jsx(bo,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().undo().run(),disabled:!x.can().undo(),title:"Undo",children:r.jsx(c4,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().redo().run(),disabled:!x.can().redo(),title:"Redo",children:r.jsx(o4,{className:"h-4 w-4"})})]}),r.jsx(zFe,{editor:x,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none",style:{minHeight:s}})]}),r.jsx(Ur,{open:i,onOpenChange:o,children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"link-url",children:"URL"}),r.jsx(xt,{id:"link-url",value:c,onChange:C=>a(C.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Js,{id:"link-new-tab",checked:h,onCheckedChange:m}),r.jsx(Xe,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(ai,{children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{type:"button",onClick:w,children:c?"Apply Link":"Remove Link"})]})]})})]}):null}const Dse=async t=>{try{const{data:e,error:n}=await ee.from("push_notification_settings").select("is_enabled").eq("setting_key",t).maybeSingle();return n?(console.error("Error checking notification setting:",n),!0):(e==null?void 0:e.is_enabled)??!0}catch(e){return console.error("Error checking notification setting:",e),!0}},NI=async t=>{try{const{data:e,error:n}=await ee.functions.invoke("send-push-notification",{body:t});return n?(console.error("Error sending notification:",n),{success:!1,error:n}):(console.log("Notification sent:",e),{success:!0,data:e})}catch(e){return console.error("Error sending notification:",e),{success:!1,error:e}}},nbt=async(t,e)=>await Dse("new_templates")?NI({title:"New Template Available",body:`Check out the new template: ${t}`,url:`/templates/${e}`}):(console.log("New template notifications are disabled"),{success:!1,skipped:!0}),sbt=async(t,e)=>NI({title:"New Academy Video",body:`New video added: ${t}`,url:`/academy/${e}`}),ibt=async(t,e)=>await Dse("new_events")?NI({title:"New Event",body:`New event: ${t}`,url:`/events/${e}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),abt=async(t,e)=>await Dse("new_toolbox")?NI({title:"New Resource Kit",body:`New resource kit available: ${t}`,url:`/toolbox/${e}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),Qhe=async(t,e)=>await Dse("new_social_swag")?NI({title:"New Social Swag",body:`New social swag available: ${t}`,url:`/social-swag/${e}`}):(console.log("New social swag notifications are disabled"),{success:!1,skipped:!0}),SL={title:"",description:"",image_url:"",video_url:"",event_date:void 0,event_time:"12:00",zoom_link:"",zoom_meeting_id:"",capacity:"",is_published:!1};function obt(){const t=ts(),e=Qr(),[n,s]=P.useState(!1),[i,o]=P.useState(null),[c,a]=P.useState(SL),[h,m]=P.useState(null),[x,v]=P.useState(null),[w,k]=P.useState(!1),C=P.useRef(null),[S,T]=P.useState(!1),[I,A]=P.useState(null),[D,$]=P.useState(!1),[F,q]=P.useState(null),[W,K]=P.useState(null),[Z,re]=P.useState(!0),[he,ue]=P.useState(""),{data:je,isLoading:ne}=rr({queryKey:["admin-events"],queryFn:async()=>{const{data:Me,error:rt}=await ee.from("events").select("*").order("event_date",{ascending:!0});if(rt)throw rt;return Me}}),{data:ye}=rr({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:Me,error:rt}=await ee.from("event_registrations").select("event_id");if(rt)throw rt;const Re={};return Me.forEach(Ge=>{Re[Ge.event_id]=(Re[Ge.event_id]||0)+1}),Re}}),{data:ie,isLoading:me}=rr({queryKey:["event-registrations-details",I==null?void 0:I.id],queryFn:async()=>{if(!I)return[];const{data:Me,error:rt}=await ee.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",I.id).order("registered_at",{ascending:!1});if(rt)throw rt;if(!Me||Me.length===0)return[];const Re=Me.map(Et=>Et.user_id).filter(Boolean);let Ge=[];if(Re.length>0){const{data:Et,error:Lt}=await ee.from("profiles").select("id, name, email").in("id",Re);if(Lt)throw Lt;Ge=Et||[]}const tt=new Map((Ge==null?void 0:Ge.map(Et=>[Et.id,Et]))||[]);return Me.map(Et=>({...Et,profiles:Et.user_id&&tt.get(Et.user_id)||null}))},enabled:!!I}),{data:fe,isLoading:ve}=rr({queryKey:["event-attendees-details",I==null?void 0:I.id],queryFn:async()=>{if(!I)return[];const{data:Me,error:rt}=await ee.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",I.id).order("created_at",{ascending:!1});if(rt)throw rt;if(!Me||Me.length===0)return[];const Re=Me.map(Ot=>Ot.user_id).filter(Boolean);let Ge=[];if(Re.length>0){const{data:Ot,error:Dt}=await ee.from("profiles").select("id, name, email").in("id",Re);if(Dt)throw Dt;Ge=Ot||[]}const{data:tt}=await ee.from("agent_points").select("user_id").eq("event_id",I.id),Et=new Set((tt==null?void 0:tt.map(Ot=>Ot.user_id))||[]),Lt=new Map((Ge==null?void 0:Ge.map(Ot=>[Ot.id,Ot]))||[]);return Me.map(Ot=>({...Ot,profiles:Ot.user_id&&Lt.get(Ot.user_id)||null,points_awarded:Ot.user_id?Et.has(Ot.user_id):!1}))},enabled:!!I}),Ie=Me=>{A(Me),T(!0)},Se=dr({mutationFn:async Me=>{const{data:{session:rt}}=await ee.auth.getSession();if(!rt)throw new Error("Not authenticated");const Re=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rt.access_token}`},body:JSON.stringify({event_id:Me})}),Ge=await Re.json();if(!Re.ok)throw new Error(Ge.error||"Failed to sync");return Ge},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-registrations-details",I==null?void 0:I.id]}),e.invalidateQueries({queryKey:["event-registrations-count"]}),He.success(Me.message)},onError:Me=>{He.error("Failed to sync: "+Me.message)}}),oe=dr({mutationFn:async Me=>{const{data:{session:rt}}=await ee.auth.getSession();if(!rt)throw new Error("Not authenticated");const Re=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rt.access_token}`},body:JSON.stringify({event_id:Me})}),Ge=await Re.json();if(!Re.ok)throw new Error(Ge.error||"Failed to sync attendees");return Ge},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-attendees-details",I==null?void 0:I.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]}),Me!=null&&Me.message?He.success(Me.message):He.success(`Synced ${Me.synced||0} attendees. ${Me.points_awarded||0} points awarded!`)},onError:Me=>{He.error("Failed to sync attendees: "+Me.message)}}),ae=dr({mutationFn:async({eventId:Me,testMode:rt})=>{const{data:{session:Re}}=await ee.auth.getSession();if(!Re)throw new Error("Not authenticated");const Ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Re.access_token}`},body:JSON.stringify({event_id:Me,test_mode:rt})}),tt=await Ge.json();if(!Ge.ok)throw new Error(tt.error||"Failed to send reminders");return tt},onSuccess:Me=>{Me.test?He.success(Me.message||"Test email sent!"):He.success(Me.message||`Reminder emails sent to ${Me.sent} registrants!`)},onError:Me=>{He.error("Failed to send reminders: "+Me.message)}}),{data:Ne}=rr({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let Me=[],rt=0;const Re=1e3;for(;;){const{data:Ge,error:tt}=await ee.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(rt,rt+Re-1);if(tt)throw tt;if(!Ge||Ge.length===0||(Me=[...Me,...Ge],Ge.length{const{error:tt}=await ee.from("event_attendees").update({user_id:rt}).eq("id",Me);if(tt)throw tt;if(Ge&&Re){const{error:Lt}=await ee.from("zoom_email_aliases").upsert({user_id:rt,zoom_email:Re.toLowerCase()},{onConflict:"zoom_email"});Lt&&console.error("Failed to save alias:",Lt)}const Et=I==null?void 0:I.id;if(Et){const{data:Lt}=await ee.from("user_roles").select("id").eq("user_id",rt).eq("role","admin").single();if(!Lt){const{data:Ot}=await ee.from("agent_points").select("id").eq("user_id",rt).eq("event_id",Et).single();Ot||(await ee.rpc("award_attendance_points",{p_user_id:rt,p_event_id:Et,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await ee.rpc("check_and_award_badges",{p_user_id:rt}))}}return{userId:rt,zoomEmail:Re,shouldSaveAlias:Ge}},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-attendees-details",I==null?void 0:I.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]});let rt="Attendee linked and points awarded!";Me.shouldSaveAlias&&Me.zoomEmail&&(rt+=` Email "${Me.zoomEmail}" will be auto-matched in the future.`),He.success(rt),$(!1),q(null),K(null),ue("")},onError:Me=>{He.error("Failed to link attendee: "+Me.message)}}),Be=Me=>{q(Me),K(null),re(!0),ue(""),$(!0)},Le=()=>{!F||!W||Te.mutate({attendeeId:F.id,userId:W,zoomEmail:F.zoom_email,shouldSaveAlias:Z})},Qe=(Ne==null?void 0:Ne.filter(Me=>{var Re,Ge;if(!he)return!0;const rt=he.toLowerCase();return((Re=Me.name)==null?void 0:Re.toLowerCase().includes(rt))||((Ge=Me.email)==null?void 0:Ge.toLowerCase().includes(rt))}))||[],Fe=async Me=>{const rt=Me.name.split(".").pop(),Ge=`${`${crypto.randomUUID()}.${rt}`}`,{error:tt}=await ee.storage.from("event-images").upload(Ge,Me);if(tt)throw tt;const{data:{publicUrl:Et}}=ee.storage.from("event-images").getPublicUrl(Ge);return Et},Ce=Me=>{var Re;const rt=(Re=Me.target.files)==null?void 0:Re[0];if(rt){if(rt.size>5*1024*1024){He.error("Image must be less than 5MB");return}m(rt),v(URL.createObjectURL(rt))}},Je=()=>{m(null),v(null),a({...c,image_url:""}),C.current&&(C.current.value="")},Ae=dr({mutationFn:async Me=>{k(!0);let rt=Me.image_url;h&&(rt=await Fe(h)||"");const Re=new Date(Me.event_date),[Ge,tt]=Me.event_time.split(":");Re.setHours(parseInt(Ge),parseInt(tt));const{data:Et,error:Lt}=await ee.from("events").insert({title:Me.title,description:Me.description||null,image_url:rt||null,video_url:Me.video_url||null,event_date:Re.toISOString(),zoom_link:Me.zoom_link,zoom_meeting_id:Me.zoom_meeting_id||null,capacity:Me.capacity?parseInt(Me.capacity):null,is_published:Me.is_published}).select().single();if(Lt)throw Lt;Et&&ibt(Me.title,Et.id)},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),He.success("Event created successfully"),s(!1),a(SL),m(null),v(null),k(!1)},onError:Me=>{He.error("Failed to create event: "+Me.message),k(!1)}}),Ye=dr({mutationFn:async({id:Me,data:rt})=>{k(!0);let Re=rt.image_url;h&&(Re=await Fe(h)||"");const Ge=new Date(rt.event_date),[tt,Et]=rt.event_time.split(":");Ge.setHours(parseInt(tt),parseInt(Et));const{error:Lt}=await ee.from("events").update({title:rt.title,description:rt.description||null,image_url:Re||null,video_url:rt.video_url||null,event_date:Ge.toISOString(),zoom_link:rt.zoom_link,zoom_meeting_id:rt.zoom_meeting_id||null,capacity:rt.capacity?parseInt(rt.capacity):null,is_published:rt.is_published}).eq("id",Me);if(Lt)throw Lt},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),He.success("Event updated successfully"),s(!1),o(null),a(SL),m(null),v(null),k(!1)},onError:Me=>{He.error("Failed to update event: "+Me.message),k(!1)}}),ge=dr({mutationFn:async Me=>{const{error:rt}=await ee.from("events").delete().eq("id",Me);if(rt)throw rt},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),He.success("Event deleted successfully")},onError:Me=>{He.error("Failed to delete event: "+Me.message)}}),ft=Me=>{var Re;const rt=new Date(Me.event_date);o(Me),a({title:Me.title,description:Me.description||"",image_url:Me.image_url||"",video_url:Me.video_url||"",event_date:rt,event_time:un(rt,"HH:mm"),zoom_link:Me.zoom_link,zoom_meeting_id:Me.zoom_meeting_id||"",capacity:((Re=Me.capacity)==null?void 0:Re.toString())||"",is_published:Me.is_published}),v(Me.image_url||null),m(null),s(!0)},nt=Me=>{if(Me.preventDefault(),!c.event_date){He.error("Please select a date");return}i?Ye.mutate({id:i.id,data:c}):Ae.mutate(c)},Ve=()=>{s(!1),o(null),a(SL),m(null),v(null)};return r.jsx("div",{className:"min-h-screen bg-background p-6",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:r.jsx(Ga,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Event Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage upcoming events"})]})]}),r.jsxs(Ze,{className:"mb-6",children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"All Events"}),r.jsxs(Ur,{open:n,onOpenChange:Me=>!Me&&Ve(),children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Br,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:i?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:nt,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",value:c.title,onChange:Me=>a({...c,title:Me.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:c.description,onChange:Me=>a({...c,description:Me}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Event Image"}),r.jsx("input",{type:"file",ref:C,accept:"image/*",onChange:Ce,className:"hidden"}),x?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:x,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),r.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:Je,children:r.jsx(Es,{className:"h-4 w-4"})})]}):r.jsxs(te,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var Me;return(Me=C.current)==null?void 0:Me.click()},children:[r.jsx(Ao,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Date *"}),r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!c.event_date&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),c.event_date?un(c.event_date,"PPP"):"Pick a date"]})}),r.jsx(gh,{className:"w-auto p-0",align:"start",children:r.jsx(Lj,{mode:"single",selected:c.event_date,onSelect:Me=>a({...c,event_date:Me}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"time",children:"Time *"}),r.jsx(xt,{id:"time",type:"time",value:c.event_time,onChange:Me=>a({...c,event_time:Me.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(xt,{id:"zoom_link",value:c.zoom_link,onChange:Me=>a({...c,zoom_link:Me.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(xt,{id:"zoom_meeting_id",value:c.zoom_meeting_id,onChange:Me=>a({...c,zoom_meeting_id:Me.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(xt,{id:"video_url",value:c.video_url,onChange:Me=>a({...c,video_url:Me.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(xt,{id:"capacity",type:"number",value:c.capacity,onChange:Me=>a({...c,capacity:Me.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{htmlFor:"is_published",children:"Published"}),r.jsx(Js,{id:"is_published",checked:c.is_published,onCheckedChange:Me=>a({...c,is_published:Me})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:Ve,className:"flex-1",children:"Cancel"}),r.jsx(te,{type:"submit",className:"flex-1",disabled:Ae.isPending||Ye.isPending||w,children:w?"Uploading...":i?"Update Event":"Create Event"})]})]})]})]})]}),r.jsx(et,{children:ne?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(je==null?void 0:je.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Date & Time"}),r.jsx(Mt,{children:"Registrations"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:je==null?void 0:je.map(Me=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:Me.title}),r.jsx(yt,{children:un(new Date(Me.event_date),"PPP p")}),r.jsx(yt,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ie(Me),children:[r.jsx(fs,{className:"h-4 w-4"}),(ye==null?void 0:ye[Me.id])||0,Me.capacity&&` / ${Me.capacity}`]})}),r.jsx(yt,{children:r.jsx("span",{className:$t("px-2 py-1 rounded-full text-xs font-medium",Me.is_published?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"),children:Me.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(Me.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx($s,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ft(Me),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&ge.mutate(Me.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},Me.id))})]})})]}),r.jsx(Ur,{open:S,onOpenChange:T,children:r.jsxs(Br,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),I==null?void 0:I.title]}),r.jsx(us,{children:"View registrations and attendees for this event"})]}),r.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ae.mutate({eventId:I.id,testMode:!0}),disabled:ae.isPending,children:[r.jsx(oi,{className:$t("h-4 w-4 mr-2",ae.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>ae.mutate({eventId:I.id}),disabled:ae.isPending||!(ie!=null&&ie.length),children:[r.jsx(oi,{className:$t("h-4 w-4 mr-2",ae.isPending&&"animate-spin")}),ae.isPending?"Sending...":"Send Reminder to All"]}),(I==null?void 0:I.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Se.mutate(I.id),disabled:Se.isPending,children:[r.jsx(Fl,{className:$t("h-4 w-4 mr-2",Se.isPending&&"animate-spin")}),Se.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(te,{variant:"default",size:"sm",onClick:()=>oe.mutate(I.id),disabled:oe.isPending,children:[r.jsx(qa,{className:$t("h-4 w-4 mr-2",oe.isPending&&"animate-spin")}),oe.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(Oa,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-2",children:[r.jsxs(xn,{value:"registrations",className:"gap-2",children:[r.jsx(fs,{className:"h-4 w-4"}),"Registrations (",(ie==null?void 0:ie.length)||0,")"]}),r.jsxs(xn,{value:"attendees",className:"gap-2",children:[r.jsx(Ha,{className:"h-4 w-4"}),"Attendees (",(fe==null?void 0:fe.length)||0,")"]})]}),r.jsx(Un,{value:"registrations",className:"mt-4",children:me?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(ie==null?void 0:ie.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(I==null?void 0:I.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Registered"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Vs,{children:ie==null?void 0:ie.map(Me=>{var tt,Et;const rt=((tt=Me.profiles)==null?void 0:tt.name)||Me.zoom_name||"Unknown",Re=((Et=Me.profiles)==null?void 0:Et.email)||Me.zoom_email||null,Ge=!Me.user_id;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[rt,Ge&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(yt,{children:Re?r.jsxs("a",{href:`mailto:${Re}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(oi,{className:"h-3 w-3"}),Re]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(yt,{className:"text-muted-foreground text-sm",children:un(new Date(Me.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(yt,{children:Me.zoom_join_url?r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Registered"}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Me.id)})})]})}),r.jsx(Un,{value:"attendees",className:"mt-4",children:ve?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(fe==null?void 0:fe.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(I==null?void 0:I.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(fe==null?void 0:fe.filter(Me=>!Me.user_id).length)>0&&r.jsxs("div",{className:"mb-6 p-4 border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ul,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",fe==null?void 0:fe.filter(Me=>!Me.user_id).length,")"]})]}),r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 mb-3",children:"These attendees couldn't be matched to a profile. Link them to award points."}),r.jsx("div",{className:"space-y-2",children:fe==null?void 0:fe.filter(Me=>!Me.user_id).map(Me=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium text-sm",children:Me.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Me.zoom_email||"No email"})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Be(Me),className:"gap-1",children:[r.jsx(Bf,{className:"h-3 w-3"}),"Link to Profile"]})]},Me.id))})]}),r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Points"})]})}),r.jsx(Vs,{children:fe==null?void 0:fe.filter(Me=>Me.user_id).map(Me=>{var Ge,tt;const rt=((Ge=Me.profiles)==null?void 0:Ge.name)||Me.zoom_name||"Unknown",Re=((tt=Me.profiles)==null?void 0:tt.email)||Me.zoom_email||null;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[rt,Me.manually_added&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:"Manual"})]})}),r.jsx(yt,{children:Re?r.jsxs("a",{href:`mailto:${Re}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(oi,{className:"h-3 w-3"}),Re]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(yt,{children:Me.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Gi,{className:"h-3 w-3"}),Me.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:Me.points_awarded?r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[r.jsx(qa,{className:"h-3 w-3"}),"+10 pts"]}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Me.id)})})]})]})})]})]})}),r.jsx(Ur,{open:D,onOpenChange:$,children:r.jsxs(Br,{className:"max-w-md",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(Bf,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(us,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),F&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm font-medium",children:F.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:F.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name or email...",value:he,onChange:Me=>ue(Me.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Qe.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No profiles found"}):r.jsx("div",{className:"divide-y",children:Qe.slice(0,20).map(Me=>r.jsxs("button",{type:"button",onClick:()=>K(Me.id),className:$t("w-full p-3 text-left hover:bg-muted/50 transition-colors",W===Me.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:Me.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Me.email})]},Me.id))})}),F.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(vc,{id:"save-alias",checked:Z,onCheckedChange:Me=>re(Me)}),r.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),r.jsx(te,{onClick:Le,disabled:!W||Te.isPending,children:Te.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const lbt=()=>{const{user:t}=zr(),{toast:e}=ua(),n=Qr(),[s,i]=Pd(),[o,c]=P.useState(!1),[a,h]=P.useState(null),[m,x]=P.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:""}),[v,w]=P.useState(null),[k,C]=P.useState(0),[S,T]=P.useState(!1),[I,A]=P.useState(null),[D,$]=P.useState(""),[F,q]=P.useState(""),[W,K]=P.useState(""),[Z,re]=P.useState(!1),[he,ue]=P.useState(!1),{data:je=[]}=rr({queryKey:["template-categories"],queryFn:async()=>{const{data:Ye,error:ge}=await ee.from("template_categories").select("*").order("name");if(ge)throw ge;return Ye}}),{data:ne=[]}=rr({queryKey:["template-types"],queryFn:async()=>{const{data:Ye,error:ge}=await ee.from("template_types").select("*").order("name");if(ge)throw ge;return Ye}}),{data:ye=[],isLoading:ie}=rr({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Ye,error:ge}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(ge)throw ge;const{data:ft,error:nt}=await ee.from("template_links").select("*").order("sort_order");if(nt)throw nt;const{data:Ve,error:Me}=await ee.from("template_guides").select("*").order("sort_order");if(Me)throw Me;return Ye.map(Re=>({...Re,links:(ft==null?void 0:ft.filter(Ge=>Ge.template_id===Re.id))||[],guides:(Ve==null?void 0:Ve.filter(Ge=>Ge.template_id===Re.id))||[]}))}});P.useEffect(()=>{const Ye=s.get("edit");if(Ye&&ye.length>0){const ge=ye.find(ft=>ft.id===Ye);ge&&(oe(ge),i({},{replace:!0}))}},[ye,s]);const me=dr({mutationFn:async Ye=>{const{data:ge,error:ft}=await ee.from("template_categories").insert({name:Ye}).select().single();if(ft)throw ft;return ge},onSuccess:Ye=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...m,category_id:Ye.id}),q(""),re(!1),e({title:"Category added"})},onError:Ye=>{e({title:"Error adding category",description:Ye.message,variant:"destructive"})}}),fe=dr({mutationFn:async Ye=>{const{data:ge,error:ft}=await ee.from("template_types").insert({name:Ye}).select().single();if(ft)throw ft;return ge},onSuccess:Ye=>{n.invalidateQueries({queryKey:["template-types"]}),x({...m,type_id:Ye.id}),K(""),ue(!1),e({title:"Type added"})},onError:Ye=>{e({title:"Error adding type",description:Ye.message,variant:"destructive"})}}),ve=dr({mutationFn:async Ye=>{var Me;let ge=Ye.existingImageUrl;if(Ye.image){const rt=Ye.image.name.split(".").pop(),Re=`${Date.now()}-${Math.random().toString(36).substring(7)}.${rt}`,{error:Ge}=await ee.storage.from("template-previews").upload(Re,Ye.image);if(Ge)throw Ge;const{data:tt}=ee.storage.from("template-previews").getPublicUrl(Re);ge=tt.publicUrl}const ft={name:Ye.template.name,description:Ye.template.description||null,category_id:Ye.template.category_id||null,type_id:Ye.template.type_id||null,preview_image_url:ge,video_url:Ye.videoUrl||null,publish_date:Ye.template.publish_date?new Date(Ye.template.publish_date).toISOString():new Date().toISOString(),created_by:t==null?void 0:t.id};let nt=Ye.templateId;if(nt){const{error:rt}=await ee.from("canva_templates").update(ft).eq("id",nt);if(rt)throw rt;const{error:Re}=await ee.from("template_links").delete().eq("template_id",nt);if(Re)throw Re;const Ge=((Me=Ye.existingGuides)==null?void 0:Me.map(Lt=>Lt.id).filter(Boolean))||[],tt=Ye.template.guides.map(Lt=>Lt.id).filter(Boolean),Et=Ge.filter(Lt=>!tt.includes(Lt));Et.length>0&&await ee.from("template_guides").delete().in("id",Et)}else{const{data:rt,error:Re}=await ee.from("canva_templates").insert(ft).select().single();if(Re)throw Re;nt=rt.id,nbt(Ye.template.name,rt.id)}const Ve=Ye.template.links.filter(rt=>rt.title.trim()&&rt.canva_share_link.trim());if(Ve.length>0){const rt=Ve.map((Ge,tt)=>({template_id:nt,title:Ge.title.trim(),canva_share_link:Ge.canva_share_link.trim(),sort_order:tt})),{error:Re}=await ee.from("template_links").insert(rt);if(Re)throw Re}for(let rt=0;rt{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),Se(),c(!1),e({title:a?"Template updated":"Template created"})},onError:Ye=>{e({title:"Error saving template",description:Ye.message,variant:"destructive"})}}),Ie=dr({mutationFn:async Ye=>{const{error:ge}=await ee.from("canva_templates").delete().eq("id",Ye);if(ge)throw ge},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),e({title:"Template deleted"})},onError:Ye=>{e({title:"Error deleting template",description:Ye.message,variant:"destructive"})}}),Se=()=>{x({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),A(null),$(""),h(null),re(!1),ue(!1),q(""),K(""),w(null),C(0),T(!1)},oe=Ye=>{var ge;h(Ye),x({name:Ye.name,description:Ye.description||"",category_id:Ye.category_id||"",type_id:Ye.type_id||"",publish_date:Ye.publish_date?new Date(Ye.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Ye.links&&Ye.links.length>0?Ye.links.map(ft=>({id:ft.id,title:ft.title,canva_share_link:ft.canva_share_link,sort_order:ft.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((ge=Ye.guides)==null?void 0:ge.map(ft=>({id:ft.id,name:ft.name,file_url:ft.file_url,file_type:ft.file_type,file_size:ft.file_size,sort_order:ft.sort_order})))||[],video_url:Ye.video_url||""}),$(Ye.preview_image_url||""),w(null),c(!0)},ae=Ye=>{var ft;const ge=(ft=Ye.target.files)==null?void 0:ft[0];ge&&(A(ge),$(URL.createObjectURL(ge)))},Ne=()=>{x({...m,links:[...m.links,{title:"",canva_share_link:"",sort_order:m.links.length}]})},Te=Ye=>{if(m.links.length<=1)return;const ge=m.links.filter((ft,nt)=>nt!==Ye);x({...m,links:ge})},Be=(Ye,ge,ft)=>{const nt=[...m.links];nt[Ye]={...nt[Ye],[ge]:ft},x({...m,links:nt})},Le=Ye=>{const ge=Ye.target.files;if(!ge)return;const ft=Array.from(ge).map((nt,Ve)=>({name:nt.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:nt.type,file_size:nt.size,sort_order:m.guides.length+Ve,file:nt}));x({...m,guides:[...m.guides,...ft]}),Ye.target.value=""},Qe=Ye=>{const ge=m.guides.filter((ft,nt)=>nt!==Ye);x({...m,guides:ge})},Fe=(Ye,ge)=>{const ft=[...m.guides];ft[Ye]={...ft[Ye],name:ge},x({...m,guides:ft})},Ce=async()=>{if(!v)return null;T(!0),C(0);try{const{data:Ye,error:ge}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:m.name||v.name}});if(ge)throw new Error(ge.message);const{videoId:ft,libraryId:nt}=Ye,{data:Ve,error:Me}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ft}});if(Me)throw new Error(Me.message);const rt=new XMLHttpRequest;return await new Promise((Ge,tt)=>{rt.upload.addEventListener("progress",Et=>{if(Et.lengthComputable){const Lt=Math.round(Et.loaded/Et.total*100);C(Lt)}}),rt.addEventListener("load",()=>{rt.status>=200&&rt.status<300?Ge():tt(new Error(`Upload failed with status ${rt.status}`))}),rt.addEventListener("error",()=>tt(new Error("Upload failed"))),rt.open("PUT",Ve.uploadUrl),rt.setRequestHeader("AccessKey",Ve.apiKey),rt.send(v)}),`https://player.mediadelivery.net/embed/${nt}/${ft}`}catch(Ye){return console.error("Bunny upload error:",Ye),e({title:"Video upload failed",description:Ye instanceof Error?Ye.message:"Unknown error",variant:"destructive"}),null}finally{T(!1)}},Je=Ye=>{var ft;const ge=(ft=Ye.target.files)==null?void 0:ft[0];ge&&w(ge),Ye.target.value=""},Ae=async Ye=>{if(Ye.preventDefault(),!m.name.trim()){e({title:"Please enter a template name",variant:"destructive"});return}if(m.links.filter(nt=>nt.title.trim()&&nt.canva_share_link.trim()).length===0){e({title:"Please add at least one Canva link",variant:"destructive"});return}let ft=m.video_url;if(v){const nt=await Ce();if(!nt)return;ft=nt}ve.mutate({template:m,image:I,existingImageUrl:(a==null?void 0:a.preview_image_url)||null,templateId:a==null?void 0:a.id,existingGuides:a==null?void 0:a.guides,videoUrl:ft})};return r.jsx(Dr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Manage Templates",description:"Create and manage Canva templates"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ye.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:je.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ne.length})})]})]}),r.jsxs(Ur,{open:o,onOpenChange:Ye=>{c(Ye),Ye||Se()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:a?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Ae,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Name *"}),r.jsx(xt,{id:"name",value:m.name,onChange:Ye=>x({...m,name:Ye.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:m.description,onChange:Ye=>x({...m,description:Ye}),placeholder:"Brief description of the template",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{children:"Canva Links *"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ne,className:"gap-1",children:[r.jsx(Mn,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:m.links.map((Ye,ge)=>r.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(xt,{value:Ye.title,onChange:ft=>Be(ge,"title",ft.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(xt,{value:Ye.canva_share_link,onChange:ft=>Be(ge,"canva_share_link",ft.target.value),placeholder:"https://www.canva.com/design/..."})]}),m.links.length>1&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Te(ge),children:r.jsx(Es,{className:"h-4 w-4"})})]},ge))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Category"}),Z?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:F,onChange:Ye=>q(Ye.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>F.trim()&&me.mutate(F.trim()),disabled:me.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{re(!1),q("")},children:r.jsx(Es,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:m.category_id,onValueChange:Ye=>x({...m,category_id:Ye}),children:[r.jsx(yn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:je.map(Ye=>r.jsx(tr,{value:Ye.id,children:Ye.name},Ye.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>re(!0),children:r.jsx(Mn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Template Type"}),he?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:W,onChange:Ye=>K(Ye.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>W.trim()&&fe.mutate(W.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{ue(!1),K("")},children:r.jsx(Es,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:m.type_id,onValueChange:Ye=>x({...m,type_id:Ye}),children:[r.jsx(yn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select type"})}),r.jsx(vn,{children:ne.map(Ye=>r.jsx(tr,{value:Ye.id,children:Ye.name},Ye.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>ue(!0),children:r.jsx(Mn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(xt,{id:"publish_date",type:"date",value:m.publish_date,onChange:Ye=>x({...m,publish_date:Ye.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[D?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:D,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(te,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{A(null),$("")},children:r.jsx(Es,{className:"h-3 w-3"})})]}):r.jsx("div",{className:"w-32 h-24 rounded-lg border-2 border-dashed border-muted-foreground/25 flex items-center justify-center",children:r.jsx(Wo,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(xt,{type:"file",accept:"image/*",onChange:ae,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Video (Optional)"}),m.video_url&&!v?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Wi,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>x({...m,video_url:""}),className:"text-destructive hover:text-destructive",children:"Remove"})]}),r.jsx("div",{className:"aspect-video max-w-md rounded-lg overflow-hidden border",children:r.jsx("iframe",{src:m.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):S?r.jsxs("div",{className:"space-y-2 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",k,"%"]})]}),r.jsx(Bc,{value:k,className:"h-2"})]}):v?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Wi,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:v.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(v.size/1024/1024).toFixed(1)," MB"]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>w(null),children:r.jsx(Es,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(xt,{type:"file",accept:"video/*",onChange:Je,className:"hidden"}),r.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg hover:border-primary/50 transition-colors",children:[r.jsx(Wi,{className:"h-8 w-8 text-muted-foreground/50"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(xt,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Le,className:"hidden"}),r.jsx(te,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(Ao,{className:"h-3 w-3"}),"Add Files"]})})]})]}),m.guides.length>0?r.jsx("div",{className:"space-y-2",children:m.guides.map((Ye,ge)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(Si,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(xt,{value:Ye.name,onChange:ft=>Fe(ge,ft.target.value),placeholder:"Guide name",className:"flex-1"}),Ye.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Ye.file_size/1024).toFixed(0)," KB"]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Qe(ge),children:r.jsx(Es,{className:"h-4 w-4"})})]},Ye.id||ge))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>{c(!1),Se()},children:"Cancel"}),r.jsx(te,{type:"submit",disabled:ve.isPending,children:ve.isPending?"Saving...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:ie?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):ye.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Preview"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Links"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ye.map(Ye=>{var ge,ft,nt,Ve,Me;return r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Ye.preview_image_url?r.jsx("img",{src:Ye.preview_image_url,alt:Ye.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Wo,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(yt,{className:"font-medium",children:Ye.name}),r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Ft,{variant:"secondary",children:[((ge=Ye.links)==null?void 0:ge.length)||0," link",(((ft=Ye.links)==null?void 0:ft.length)||0)!==1?"s":""]}),(((nt=Ye.guides)==null?void 0:nt.length)||0)>0&&r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(Si,{className:"h-3 w-3"}),(Ve=Ye.guides)==null?void 0:Ve.length," guide",(((Me=Ye.guides)==null?void 0:Me.length)||0)!==1?"s":""]})]})}),r.jsx(yt,{children:Ye.category?r.jsx(Ft,{variant:"secondary",children:Ye.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{children:Ye.type?r.jsx(Ft,{variant:"outline",children:Ye.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{className:"text-muted-foreground",children:new Date(Ye.publish_date).toLocaleDateString()}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{size:"icon",variant:"ghost",onClick:()=>oe(Ye),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ie.mutate(Ye.id)},children:r.jsx(es,{className:"h-4 w-4"})})]})})]},Ye.id)})})]})})})]})})},cbt=[{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"}],dbt=()=>{const{user:t}=zr(),{toast:e}=ua(),n=Qr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,h]=P.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,x]=P.useState(null),[v,w]=P.useState(""),[k,C]=P.useState([]),[S,T]=P.useState([]),[I,A]=P.useState([]),[D,$]=P.useState(""),[F,q]=P.useState(!1),[W,K]=P.useState(null),[Z,re]=P.useState(0),[he,ue]=P.useState(!1),[je,ne]=P.useState(null),{data:ye=[]}=rr({queryKey:["academy-categories"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(Je)throw Je;return Ce}}),{data:ie=[],isLoading:me}=rr({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(Je)throw Je;const{data:Ae,error:Ye}=await ee.from("academy_resources").select("*").order("sort_order");if(Ye)throw Ye;return Ce.map(ft=>({...ft,resources:(Ae==null?void 0:Ae.filter(nt=>nt.video_id===ft.id))||[]}))}}),fe=dr({mutationFn:async Ce=>{const{data:Je,error:Ae}=await ee.from("academy_categories").insert({name:Ce,sort_order:ye.length}).select().single();if(Ae)throw Ae;return Je},onSuccess:Ce=>{n.invalidateQueries({queryKey:["academy-categories"]}),h({...a,category_id:Ce.id}),$(""),q(!1),e({title:"Category added"})},onError:Ce=>{e({title:"Error adding category",description:Ce.message,variant:"destructive"})}}),ve=dr({mutationFn:async Ce=>{let Je=Ce.existingThumbnailUrl;if(Ce.thumbnail){const ge=Ce.thumbnail.name.split(".").pop(),ft=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${ge}`,{error:nt}=await ee.storage.from("academy-resources").upload(ft,Ce.thumbnail);if(nt)throw nt;const{data:Ve}=ee.storage.from("academy-resources").getPublicUrl(ft);Je=Ve.publicUrl}const Ae={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:Je,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 Ye=Ce.videoId;if(Ye){const{error:ge}=await ee.from("academy_videos").update(Ae).eq("id",Ye);if(ge)throw ge}else{const{data:ge,error:ft}=await ee.from("academy_videos").insert(Ae).select().single();if(ft)throw ft;Ye=ge.id,sbt(Ce.video.title,ge.id)}if(Ce.resourcesToDelete.length>0){const{error:ge}=await ee.from("academy_resources").delete().in("id",Ce.resourcesToDelete);if(ge)throw ge}for(let ge=0;ge{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),oe(),i(!1),e({title:o?"Video updated":"Video created"})},onError:Ce=>{e({title:"Error saving video",description:Ce.message,variant:"destructive"})}}),Ie=dr({mutationFn:async Ce=>{const{error:Je}=await ee.from("academy_videos").delete().eq("id",Ce);if(Je)throw Je},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),e({title:"Video deleted"})},onError:Ce=>{e({title:"Error deleting video",description:Ce.message,variant:"destructive"})}}),Se=dr({mutationFn:async({id:Ce,is_published:Je})=>{const{error:Ae}=await ee.from("academy_videos").update({is_published:Je}).eq("id",Ce);if(Ae)throw Ae},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]})},onError:Ce=>{e({title:"Error updating video",description:Ce.message,variant:"destructive"})}}),oe=()=>{h({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),w(""),C([]),T([]),A([]),c(null),q(!1),$(""),K(null),re(0),ue(!1),ne(null)},ae=Ce=>{c(Ce),h({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}),w(Ce.thumbnail_url||""),T(Ce.resources||[]),C([]),A([]),i(!0)},Ne=Ce=>{var Ae;const Je=(Ae=Ce.target.files)==null?void 0:Ae[0];Je&&(x(Je),w(URL.createObjectURL(Je)))},Te=Ce=>{const Je=Ce.target.files;if(Je){const Ae=Array.from(Je).map(Ye=>({file:Ye,title:Ye.name.replace(/\.[^/.]+$/,"")}));C([...k,...Ae])}Ce.target.value=""},Be=Ce=>{C(k.filter((Je,Ae)=>Ae!==Ce))},Le=Ce=>{A([...I,Ce]),T(S.filter(Je=>Je.id!==Ce))},Qe=async()=>{if(!W)return null;ue(!0),re(0);try{const{data:Ce,error:Je}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:a.title||W.name}});if(Je)throw new Error(Je.message);const{videoId:Ae,libraryId:Ye}=Ce;ne(Ae);const{data:ge,error:ft}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ae}});if(ft)throw new Error(ft.message);const nt=new XMLHttpRequest;return await new Promise((Me,rt)=>{nt.upload.addEventListener("progress",Re=>{if(Re.lengthComputable){const Ge=Math.round(Re.loaded/Re.total*100);re(Ge)}}),nt.addEventListener("load",()=>{nt.status>=200&&nt.status<300?Me():rt(new Error(`Upload failed with status ${nt.status}`))}),nt.addEventListener("error",()=>rt(new Error("Upload failed"))),nt.open("PUT",ge.uploadUrl),nt.setRequestHeader("AccessKey",ge.apiKey),nt.send(W)}),`https://player.mediadelivery.net/embed/${Ye}/${Ae}`}catch(Ce){return console.error("Bunny upload error:",Ce),e({title:"Video upload failed",description:Ce instanceof Error?Ce.message:"Unknown error",variant:"destructive"}),null}finally{ue(!1)}},Fe=async Ce=>{if(Ce.preventDefault(),!a.title.trim()){e({title:"Please enter a video title",variant:"destructive"});return}let Je=a.video_url;if(a.video_type==="bunny_stream"&&W&&!o){const Ae=await Qe();if(!Ae)return;Je=Ae}else if(!a.video_url.trim()&&a.video_type!=="bunny_stream"){e({title:"Please enter a video URL",variant:"destructive"});return}else if(a.video_type==="bunny_stream"&&!W&&!a.video_url&&!o){e({title:"Please select a video file to upload",variant:"destructive"});return}ve.mutate({video:{...a,video_url:Je},thumbnail:m,existingThumbnailUrl:(o==null?void 0:o.thumbnail_url)||null,videoId:o==null?void 0:o.id,newResources:k,resourcesToDelete:I})};return r.jsx(Dr,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Manage Academy",description:"Create and manage training videos and resources"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.filter(Ce=>Ce.is_published).length})})]})]}),r.jsxs(Ur,{open:s,onOpenChange:Ce=>{i(Ce),Ce||oe()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:o?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Fe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",value:a.title,onChange:Ce=>h({...a,title:Ce.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:a.description,onChange:Ce=>h({...a,description:Ce}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Video Type"}),r.jsxs(_n,{value:a.video_type,onValueChange:Ce=>{h({...a,video_type:Ce,video_url:""}),K(null)},disabled:he,children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:cbt.map(Ce=>r.jsx(tr,{value:Ce.value,children:Ce.label},Ce.value))})]})]}),a.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Xe,{children:["Upload Video File ",!o&&"*"]}),o&&a.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx(xt,{type:"file",accept:"video/*",onChange:Ce=>{var Ae;const Je=(Ae=Ce.target.files)==null?void 0:Ae[0];Je&&K(Je)},disabled:he}),W&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Wi,{className:"h-4 w-4"}),W.name," (",(W.size/(1024*1024)).toFixed(1)," MB)"]}),he&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Bc,{value:Z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[Z,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(xt,{id:"video_url",value:a.video_url,onChange:Ce=>h({...a,video_url:Ce.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"duration",children:"Duration"}),r.jsx(xt,{id:"duration",value:a.duration,onChange:Ce=>h({...a,duration:Ce.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(xt,{id:"publish_date",type:"date",value:a.publish_date,onChange:Ce=>h({...a,publish_date:Ce.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Category"}),F?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:D,onChange:Ce=>$(Ce.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(te,{type:"button",size:"sm",onClick:()=>D.trim()&&fe.mutate(D.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),$("")},children:r.jsx(Es,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:a.category_id,onValueChange:Ce=>h({...a,category_id:Ce}),children:[r.jsx(yn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:ye.map(Ce=>r.jsx(tr,{value:Ce.id,children:Ce.name},Ce.id))})]}),r.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:r.jsx(Mn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[v&&r.jsx("img",{src:v,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(xt,{type:"file",accept:"image/*",onChange:Ne,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{children:"Resource Files"}),r.jsx(te,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(Ao,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Te,className:"hidden"})]})})]}),(S.length>0||k.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[S.map(Ce=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:Ce.title}),r.jsx(Ft,{variant:"outline",className:"text-xs",children:Ce.file_type}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>Le(Ce.id),className:"text-destructive hover:text-destructive",children:r.jsx(Es,{className:"h-4 w-4"})})]},Ce.id)),k.map((Ce,Je)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(xt,{value:Ce.title,onChange:Ae=>{const Ye=[...k];Ye[Je].title=Ae.target.value,C(Ye)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>Be(Je),className:"text-destructive hover:text-destructive",children:r.jsx(Es,{className:"h-4 w-4"})})]},Je))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"is_published",checked:a.is_published,onCheckedChange:Ce=>h({...a,is_published:Ce})}),r.jsx(Xe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(ai,{children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:he,children:"Cancel"}),r.jsx(te,{type:"submit",disabled:ve.isPending||he,children:he?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):ve.isPending?"Saving...":o?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:me?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):ie.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Wi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No videos yet"}),r.jsx("p",{className:"text-sm",children:"Add your first academy video"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Resources"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Vs,{children:ie.map(Ce=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ce.thumbnail_url?r.jsx("img",{src:Ce.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):r.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:r.jsx(Wi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:Ce.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:Ce.video_type.replace("_"," ")})]})]})}),r.jsx(yt,{children:Ce.category?r.jsx(Ft,{variant:"outline",children:Ce.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(yt,{children:Ce.duration||"-"}),r.jsx(yt,{children:Ce.resources&&Ce.resources.length>0?r.jsxs(Ft,{variant:"secondary",children:[Ce.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(yt,{children:new Date(Ce.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(Js,{checked:Ce.is_published,onCheckedChange:Je=>Se.mutate({id:Ce.id,is_published:Je})})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>ae(Ce),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ie.mutate(Ce.id),className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})]})})]},Ce.id))})]})})})]})})};function ubt(){var Se,oe,ae;const t=Qr(),[e,n]=Pd(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,h]=P.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,x]=P.useState(null),[v,w]=P.useState(""),[k,C]=P.useState([]),[S,T]=P.useState([]),[I,A]=P.useState(null),{data:D,isLoading:$}=rr({queryKey:["resource-kits"],queryFn:async()=>{const{data:Ne,error:Te}=await ee.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Te)throw Te;return Ne}}),{data:F}=rr({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Ne,error:Te}=await ee.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Te)throw Te;return Ne}}),{data:q}=rr({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Ne,error:Te}=await ee.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Te)throw Te;return Ne}});P.useEffect(()=>{const Ne=e.get("edit");if(Ne&&D&&D.length>0&&F&&q){const Te=D.find(Be=>Be.id===Ne);Te&&(K(Te),n({},{replace:!0}))}},[D,F,q,e]);const W=()=>{h({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),w(""),C([]),T([]),c(null)},K=Ne=>{c(Ne),h({name:Ne.name,description:Ne.description||"",publish_date:Ne.publish_date.split("T")[0],is_published:Ne.is_published}),w(Ne.featured_image_url||"");const Te=(F==null?void 0:F.filter(Le=>Le.kit_id===Ne.id))||[];C(Te.map(Le=>({id:Le.id,name:Le.name,file_url:Le.file_url,file_type:Le.file_type,file_size:Le.file_size,sort_order:Le.sort_order})));const Be=(q==null?void 0:q.filter(Le=>Le.kit_id===Ne.id))||[];T(Be.map(Le=>({id:Le.id,title:Le.title,canva_share_link:Le.canva_share_link,sort_order:Le.sort_order}))),i(!0)},Z=Ne=>{var Be;const Te=(Be=Ne.target.files)==null?void 0:Be[0];Te&&(x(Te),w(URL.createObjectURL(Te)))},re=()=>{C([...k,{name:"",file_url:"",sort_order:k.length}])},he=Ne=>{C(k.filter((Te,Be)=>Be!==Ne))},ue=(Ne,Te,Be)=>{const Le=[...k];Le[Ne]={...Le[Ne],[Te]:Be},C(Le)},je=()=>{T([...S,{title:"",canva_share_link:"",sort_order:S.length}])},ne=Ne=>{T(S.filter((Te,Be)=>Be!==Ne))},ye=(Ne,Te,Be)=>{const Le=[...S];Le[Ne]={...Le[Ne],[Te]:Be},T(Le)},ie=(Ne,Te)=>{var Le;const Be=(Le=Te.target.files)==null?void 0:Le[0];if(Be){const Qe=[...k],Fe=Be.name.replace(/\.[^/.]+$/,"");Qe[Ne]={...Qe[Ne],file:Be,file_type:Be.type,file_size:Be.size,name:Qe[Ne].name||Fe},C(Qe)}},me=dr({mutationFn:async()=>{let Ne=(o==null?void 0:o.featured_image_url)||null;if(m){const Fe=m.name.split(".").pop(),Ce=`${Date.now()}.${Fe}`,{error:Je}=await ee.storage.from("resource-kits").upload(`featured/${Ce}`,m);if(Je)throw Je;const{data:Ae}=ee.storage.from("resource-kits").getPublicUrl(`featured/${Ce}`);Ne=Ae.publicUrl}const Te={name:a.name,description:a.description||null,featured_image_url:Ne,publish_date:a.publish_date,is_published:a.is_published};let Be;const Le=!o,Qe=(o==null?void 0:o.is_published)||!1;if(o){const{error:Fe}=await ee.from("resource_kits").update(Te).eq("id",o.id);if(Fe)throw Fe;Be=o.id;const Ce=(F==null?void 0:F.filter(nt=>nt.kit_id===o.id).map(nt=>nt.id))||[],Je=k.filter(nt=>nt.id).map(nt=>nt.id),Ae=Ce.filter(nt=>!Je.includes(nt));Ae.length>0&&await ee.from("resource_kit_files").delete().in("id",Ae);const Ye=(q==null?void 0:q.filter(nt=>nt.kit_id===o.id).map(nt=>nt.id))||[],ge=S.filter(nt=>nt.id).map(nt=>nt.id),ft=Ye.filter(nt=>!ge.includes(nt));ft.length>0&&await ee.from("resource_kit_links").delete().in("id",ft)}else{const{data:Fe,error:Ce}=await ee.from("resource_kits").insert(Te).select().single();if(Ce)throw Ce;Be=Fe.id}for(let Fe=0;Fe{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),t.invalidateQueries({queryKey:["resource-kit-links"]}),He.success(o?"Resource kit updated":"Resource kit created"),Ne.isPublished&&(Ne.isNewKit||!Ne.wasPublished)&&abt(Ne.kitName,Ne.kitId),i(!1),W()},onError:Ne=>{He.error("Failed to save resource kit: "+Ne.message)}}),fe=dr({mutationFn:async Ne=>{const{error:Te}=await ee.from("resource_kits").delete().eq("id",Ne);if(Te)throw Te},onSuccess:()=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),He.success("Resource kit deleted")},onError:Ne=>{He.error("Failed to delete: "+Ne.message)}}),ve=Ne=>{if(Ne.preventDefault(),!a.name){He.error("Please enter a name");return}me.mutate()},Ie=Ne=>(F==null?void 0:F.filter(Te=>Te.kit_id===Ne).length)||0;return r.jsx(Dr,{title:"Toolbox Management",description:"Create and manage resource kits for agents",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.length)||0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.filter(Ne=>Ne.is_published).length)||0})})]})]}),r.jsxs(te,{onClick:()=>{W(),i(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Files"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:$?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(D==null?void 0:D.length)===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):D==null?void 0:D.map(Ne=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ne.featured_image_url?r.jsx("img",{src:Ne.featured_image_url,alt:Ne.name,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(El,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ne.name}),Ne.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ne.description})]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),Ie(Ne.id)]})}),r.jsx(yt,{children:un(new Date(Ne.publish_date),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ne.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Ne.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{const Te=(F==null?void 0:F.filter(Le=>Le.kit_id===Ne.id))||[],Be=(q==null?void 0:q.filter(Le=>Le.kit_id===Ne.id))||[];A({...Ne,files:Te,links:Be})},children:r.jsx(Al,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>K(Ne),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&fe.mutate(Ne.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},Ne.id))})]})})}),r.jsx(Ur,{open:s,onOpenChange:i,children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:ve,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[v?r.jsx("img",{src:v,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(El,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(xt,{type:"file",accept:"image/*",onChange:Z})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Name *"}),r.jsx(xt,{id:"name",value:a.name,onChange:Ne=>h({...a,name:Ne.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:a.description,onChange:Ne=>h({...a,description:Ne}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(xt,{id:"publish_date",type:"date",value:a.publish_date,onChange:Ne=>h({...a,publish_date:Ne.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Js,{checked:a.is_published,onCheckedChange:Ne=>h({...a,is_published:Ne})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:a.is_published?"Visible to agents":"Hidden from agents"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Xe,{children:"Resource Files"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:re,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),k.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No files added yet. Click "Add File" to include resources.'}):r.jsx("div",{className:"space-y-3",children:k.map((Ne,Te)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["File ",Te+1]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>he(Te),children:r.jsx(Es,{className:"h-4 w-4"})})]}),r.jsx(xt,{placeholder:"File name (e.g., Getting Started Guide)",value:Ne.name,onChange:Be=>ue(Te,"name",Be.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xt,{type:"file",onChange:Be=>ie(Te,Be),className:"flex-1"}),Ne.file_url&&!Ne.file&&r.jsx("a",{href:Ne.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Ne.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Te))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Xe,{children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:je,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),S.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No Canva links added yet. Click "Add Canva Link" to include templates.'}):r.jsx("div",{className:"space-y-3",children:S.map((Ne,Te)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["Canva Link ",Te+1]}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ne(Te),children:r.jsx(Es,{className:"h-4 w-4"})})]}),r.jsx(xt,{placeholder:"Link title (e.g., Social Media Post Template)",value:Ne.title,onChange:Be=>ye(Te,"title",Be.target.value)}),r.jsx(xt,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Ne.canva_share_link,onChange:Be=>ye(Te,"canva_share_link",Be.target.value)})]},Te))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:me.isPending,children:me.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Ur,{open:!!I,onOpenChange:()=>A(null),children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:I==null?void 0:I.name})}),r.jsxs("div",{className:"space-y-4",children:[(I==null?void 0:I.featured_image_url)&&r.jsx("img",{src:I.featured_image_url,alt:I.name,className:"w-full h-48 object-cover rounded-lg"}),(I==null?void 0:I.description)&&r.jsx("p",{className:"text-muted-foreground",children:I.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((Se=I==null?void 0:I.files)==null?void 0:Se.length)||0,")"]}),((oe=I==null?void 0:I.files)==null?void 0:oe.length)===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No files in this kit"}):r.jsx("div",{className:"space-y-2",children:(ae=I==null?void 0:I.files)==null?void 0:ae.map(Ne=>r.jsxs("a",{href:Ne.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(Si,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Ne.name})]},Ne.id))})]}),(I==null?void 0:I.links)&&I.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",I.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:I.links.map(Ne=>r.jsxs("a",{href:Ne.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(bo,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Ne.title})]},Ne.id))})]})]})]})})]})})}const hbt=()=>{const{user:t}=zr(),{toast:e}=ua(),n=Qr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,h]=P.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[m,x]=P.useState(null),[v,w]=P.useState(""),{data:k=[],isLoading:C}=rr({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("social_swag").select("*").order("publish_date",{ascending:!1});if(Z)throw Z;const{data:re,error:he}=await ee.from("social_swag_links").select("*").order("sort_order");if(he)throw he;return K.map(je=>({...je,links:(re==null?void 0:re.filter(ne=>ne.swag_id===je.id))||[]}))}}),S=dr({mutationFn:async K=>{let Z=K.existingImageUrl;if(K.image){const ye=K.image.name.split(".").pop(),ie=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ye}`,{error:me}=await ee.storage.from("template-previews").upload(ie,K.image);if(me)throw me;const{data:fe}=ee.storage.from("template-previews").getPublicUrl(ie);Z=fe.publicUrl}const re={title:K.item.title,description:K.item.description||null,preview_image_url:Z,publish_date:K.item.publish_date?new Date(K.item.publish_date).toISOString():new Date().toISOString(),is_published:K.item.is_published,created_by:t==null?void 0:t.id};let he=K.itemId;const ue=!he,je=(o==null?void 0:o.is_published)||!1;if(he){const{error:ye}=await ee.from("social_swag").update(re).eq("id",he);if(ye)throw ye;await ee.from("social_swag_links").delete().eq("swag_id",he)}else{const{data:ye,error:ie}=await ee.from("social_swag").insert(re).select().single();if(ie)throw ie;he=ye.id}const ne=K.item.links.filter(ye=>ye.title.trim()&&ye.canva_share_link.trim());if(ne.length>0){const ye=ne.map((me,fe)=>({swag_id:he,title:me.title.trim(),canva_share_link:me.canva_share_link.trim(),sort_order:fe})),{error:ie}=await ee.from("social_swag_links").insert(ye);if(ie)throw ie}return{itemId:he,itemTitle:K.item.title,isNewItem:ue,wasPublished:je,isPublished:K.item.is_published}},onSuccess:K=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),e({title:o?"Item updated":"Item created"}),K.isPublished&&(K.isNewItem||!K.wasPublished)&&Qhe(K.itemTitle,K.itemId),i(!1),I()},onError:K=>{e({title:"Error saving item",description:K.message,variant:"destructive"})}}),T=dr({mutationFn:async K=>{const{error:Z}=await ee.from("social_swag").delete().eq("id",K);if(Z)throw Z},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),e({title:"Item deleted"})},onError:K=>{e({title:"Error deleting item",description:K.message,variant:"destructive"})}}),I=()=>{h({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),w(""),c(null)},A=K=>{c(K),h({title:K.title,description:K.description||"",publish_date:K.publish_date?new Date(K.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:K.is_published,links:K.links&&K.links.length>0?K.links.map(Z=>({id:Z.id,title:Z.title,canva_share_link:Z.canva_share_link,sort_order:Z.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),w(K.preview_image_url||""),i(!0)},D=K=>{var re;const Z=(re=K.target.files)==null?void 0:re[0];Z&&(x(Z),w(URL.createObjectURL(Z)))},$=()=>{h({...a,links:[...a.links,{title:"",canva_share_link:"",sort_order:a.links.length}]})},F=K=>{if(a.links.length<=1)return;const Z=a.links.filter((re,he)=>he!==K);h({...a,links:Z})},q=(K,Z,re)=>{const he=[...a.links];he[K]={...he[K],[Z]:re},h({...a,links:he})},W=K=>{if(K.preventDefault(),!a.title.trim()){e({title:"Title is required",variant:"destructive"});return}S.mutate({item:a,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Dr,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Manage Social Swag",description:"Create and manage social media content"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.filter(K=>K.is_published).length})})]})]}),r.jsxs(Ur,{open:s,onOpenChange:K=>{i(K),K||I()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:W,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",value:a.title,onChange:K=>h({...a,title:K.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:a.description,onChange:K=>h({...a,description:K}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(xt,{id:"publish_date",type:"date",value:a.publish_date,onChange:K=>h({...a,publish_date:K.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Js,{id:"is_published",checked:a.is_published,onCheckedChange:K=>h({...a,is_published:K})}),r.jsx(Xe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Preview Image"}),v?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:v,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),w("")},children:r.jsx(Es,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Wo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(xt,{type:"file",accept:"image/*",onChange:D,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:$,children:[r.jsx(Mn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),a.links.map((K,Z)=>r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",Z+1]}),a.links.length>1&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>F(Z),children:r.jsx(Es,{className:"h-3 w-3"})})]}),r.jsx(xt,{placeholder:"Link title (e.g., Instagram Post)",value:K.title,onChange:re=>q(Z,"title",re.target.value)}),r.jsx(xt,{placeholder:"Canva share link",value:K.canva_share_link,onChange:re=>q(Z,"canva_share_link",re.target.value)})]})},Z))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:S.isPending,children:S.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:C?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):k.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No items yet. Click "Add Item" to create your first one.'}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-16",children:"Preview"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Links"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:k.map(K=>{var Z;return r.jsxs(Er,{children:[r.jsx(yt,{children:K.preview_image_url?r.jsx("img",{src:K.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Wo,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(yt,{className:"font-medium",children:K.title}),r.jsxs(yt,{children:[((Z=K.links)==null?void 0:Z.length)||0," links"]}),r.jsx(yt,{children:new Date(K.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(Ft,{variant:K.is_published?"default":"secondary",children:K.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${K.id}`,"_blank"),children:r.jsx(Al,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>A(K),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&T.mutate(K.id)},children:r.jsx(es,{className:"h-4 w-4"})})]})})]},K.id)})})]})})})]})})},fbt=()=>{const t=Qr(),[e,n]=P.useState("all"),[s,i]=P.useState(!1),[o,c]=P.useState(un(new Date,"yyyy-MM")),[a,h]=P.useState([]),[m,x]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState(!1),[S,T]=P.useState(un(new Date,"yyyy-MM")),[I,A]=P.useState(null),[D,$]=P.useState(""),[F,q]=P.useState(""),[W,K]=P.useState(""),[Z,re]=P.useState(!1),{data:he=[],isLoading:ue}=rr({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Je)throw Je;return Ce}}),{data:je=[]}=rr({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Je)throw Je;return Ce}}),{data:ne=[]}=rr({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Ce,error:Je}=await ee.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Je)throw Je;return Ce}}),ye=[...new Set(he.map(Ce=>Ce.month))].sort((Ce,Je)=>Je.localeCompare(Ce)),ie=e==="all"?he:he.filter(Ce=>Ce.month===e),me=Ce=>{const Je=Qge(Ce,"yyyy-MM",new Date);return un(Je,"MMMM yyyy")},fe=Ce=>{const Ae=Array.from(Ce.target.files||[]).slice(0,16-a.length).map(Ye=>({file:Ye,preview:URL.createObjectURL(Ye),caption:""}));h(Ye=>[...Ye,...Ae].slice(0,16))},ve=Ce=>{h(Je=>{const Ae=[...Je];return URL.revokeObjectURL(Ae[Ce].preview),Ae.splice(Ce,1),Ae})},Ie=(Ce,Je)=>{h(Ae=>{const Ye=[...Ae];return Ye[Ce]={...Ye[Ce],caption:Je},Ye})},Se=async()=>{if(a.length===0){He.error("Please add at least one image");return}if(a.filter(Je=>!Je.caption.trim()).length>0){He.error("Please add captions to all images");return}x(!0);try{for(let Je=0;Je{const Je=Ce.image_url.split("/social-swag-2/");Je[1]&&await ee.storage.from("social-swag-2").remove([Je[1]]);const{error:Ae}=await ee.from("social_swag_2").delete().eq("id",Ce.id);if(Ae)throw Ae},onSuccess:()=>{He.success("Image deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{He.error("Failed to delete image")}}),ae=dr({mutationFn:async({month:Ce,link:Je})=>{const{error:Ae}=await ee.from("social_swag_2_months").upsert({month:Ce,canva_link:Je||null},{onConflict:"month"});if(Ae)throw Ae},onSuccess:()=>{He.success("Canva link updated"),w(null),t.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{He.error("Failed to update Canva link")}}),Ne=Ce=>{var Je;return((Je=je.find(Ae=>Ae.month===Ce))==null?void 0:Je.canva_link)||""},Te=Ce=>ne.find(Je=>Je.month===Ce)||null,Be=Ce=>{var Ae;const Je=(Ae=Ce.target.files)==null?void 0:Ae[0];Je&&(A(Je),$(URL.createObjectURL(Je)))},Le=()=>{D&&URL.revokeObjectURL(D),A(null),$(""),q(""),K("")},Qe=async()=>{if(!I){He.error("Please select an image");return}re(!0);try{const Ce=I.name.split(".").pop(),Je=`reels/${S}-${Date.now()}.${Ce}`,{error:Ae}=await ee.storage.from("social-swag-2").upload(Je,I);if(Ae)throw Ae;const{data:{publicUrl:Ye}}=ee.storage.from("social-swag-2").getPublicUrl(Je),{error:ge}=await ee.from("social_swag_2_reels").upsert({month:S,image_url:Ye,canva_link:W||null,caption:F||null},{onConflict:"month"});if(ge)throw ge;He.success("Reel uploaded successfully!"),Qhe(`${me(S)} Reel`,"social-swag-2"),Le(),C(!1),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Ce){console.error("Reel upload error:",Ce),He.error("Failed to upload reel")}finally{re(!1)}},Fe=dr({mutationFn:async Ce=>{const Je=Ce.image_url.split("/social-swag-2/");Je[1]&&await ee.storage.from("social-swag-2").remove([Je[1]]);const{error:Ae}=await ee.from("social_swag_2_reels").delete().eq("id",Ce.id);if(Ae)throw Ae},onSuccess:()=>{He.success("Reel deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{He.error("Failed to delete reel")}});return r.jsx(Dr,{title:"Admin - Social Swag 2.0",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Social Swag 2.0"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage monthly social media images and captions"})]}),r.jsxs(Ur,{open:s,onOpenChange:i,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Br,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Month"}),r.jsx(xt,{type:"month",value:o,onChange:Ce=>c(Ce.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{children:["Images (",a.length,"/16)"]}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:fe,className:"hidden",id:"swag-upload",disabled:a.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(Ao,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select images (max 16)"})]})]})]}),a.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map((Ce,Je)=>r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"relative aspect-[4/5] rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:Ce.preview,alt:`Upload ${Je+1}`,className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>ve(Je),children:r.jsx(Es,{className:"h-3 w-3"})})]}),r.jsx(gs,{placeholder:"Caption...",value:Ce.caption,onChange:Ae=>Ie(Je,Ae.target.value),className:"text-xs h-20"})]},Je))}),r.jsx(te,{onClick:Se,disabled:m||a.length===0,className:"w-full gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-4 w-4"}),"Upload ",a.length," Images"]})})]})]})]}),r.jsxs(Ur,{open:k,onOpenChange:Ce=>{C(Ce),Ce||Le()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"gap-2",children:[r.jsx(kd,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Br,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Month"}),r.jsx(xt,{type:"month",value:S,onChange:Ce=>T(Ce.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Reel Preview Image"}),D?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:D,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(D),A(null),$("")},children:r.jsx(Es,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:Be,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(kd,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Canva Download Link"}),r.jsx(xt,{value:W,onChange:Ce=>K(Ce.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Caption"}),r.jsx(gs,{value:F,onChange:Ce=>q(Ce.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(te,{onClick:Qe,disabled:Z||!I,className:"w-full gap-2",children:Z?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:he.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ye.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Oa,{value:e,onValueChange:n,children:r.jsxs(Ta,{children:[r.jsx(xn,{value:"all",children:"All"}),ye.map(Ce=>r.jsx(xn,{value:Ce,children:me(Ce)},Ce))]})}),e!=="all"&&r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(bo,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Xe,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",me(e)]}),(v==null?void 0:v.month)===e?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(xt,{value:v.link,onChange:Ce=>w({...v,link:Ce.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(te,{size:"sm",onClick:()=>ae.mutate(v),children:"Save"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>w(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:Ne(e)||"No link set"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>w({month:e,link:Ne(e)}),children:"Edit"})]})]})]})})}),e!=="all"&&r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(kd,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Xe,{className:"text-sm text-muted-foreground",children:["Reel for ",me(e)]}),(()=>{const Ce=Te(e);return Ce?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Ce.image_url,alt:"Reel preview",className:"w-16 h-28 object-cover rounded"}),r.jsxs("div",{className:"flex-1 text-sm",children:[r.jsx("p",{className:"line-clamp-2",children:Ce.caption||"No caption"}),Ce.canva_link&&r.jsx("a",{href:Ce.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(te,{variant:"destructive",size:"sm",onClick:()=>Fe.mutate(Ce),children:r.jsx(es,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),ue?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):ie.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wo,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images yet. Upload some!"})]}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:ie.map(Ce=>r.jsxs(Ze,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:Ce.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(te,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>oe.mutate(Ce),children:r.jsx(es,{className:"h-4 w-4"})})]}),r.jsx(et,{className:"p-3",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:Ce.caption})})]},Ce.id))})]})})},pbt=()=>{const{toast:t}=ua(),e=Qr(),[n,s]=P.useState("categories"),[i,o]=P.useState(!1),[c,a]=P.useState(null),[h,m]=P.useState({name:"",description:"",icon:""}),[x,v]=P.useState(!1),[w,k]=P.useState(null),[C,S]=P.useState({name:"",description:"",icon:""}),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState(""),{data:q=[],isLoading:W}=rr({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Fe,error:Ce}=await ee.from("community_categories").select("*").order("sort_order");if(Ce)throw Ce;return Fe}}),{data:K=[],isLoading:Z}=rr({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Fe,error:Ce}=await ee.from("community_private_groups").select("*").order("sort_order");if(Ce)throw Ce;return Fe}}),{data:re=[]}=rr({queryKey:["admin-group-members",A==null?void 0:A.id],queryFn:async()=>{if(!A)return[];const{data:Fe,error:Ce}=await ee.from("community_private_group_members").select("*").eq("group_id",A.id);if(Ce)throw Ce;return Fe},enabled:!!A}),{data:he=[]}=rr({queryKey:["admin-all-profiles"],queryFn:async()=>{let Ce=[],Je=0,Ae=!0;for(;Ae;){const{data:Ye,error:ge}=await ee.from("profiles").select("id, name, email, brokerage_id").order("name").range(Je,Je+1e3-1);if(ge)throw ge;Ye&&Ye.length>0?(Ce=[...Ce,...Ye],Je+=1e3,Ae=Ye.length===1e3):Ae=!1}return Ce}}),{data:ue=[]}=rr({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Fe,error:Ce}=await ee.from("brokerages").select("*").order("name");if(Ce)throw Ce;return Fe}}),je=dr({mutationFn:async Fe=>{if(Fe.id){const{error:Ce}=await ee.from("community_categories").update({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null}).eq("id",Fe.id);if(Ce)throw Ce}else{const Ce=Math.max(...q.map(Ae=>Ae.sort_order),0),{error:Je}=await ee.from("community_categories").insert({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null,sort_order:Ce+1});if(Je)throw Je}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),a(null),m({name:"",description:"",icon:""}),t({title:c?"Category updated!":"Category created!"})},onError:Fe=>{t({title:"Error",description:Fe.message,variant:"destructive"})}}),ne=dr({mutationFn:async Fe=>{const{error:Ce}=await ee.from("community_categories").delete().eq("id",Fe);if(Ce)throw Ce},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),t({title:"Category deleted"})}}),ye=dr({mutationFn:async({id:Fe,direction:Ce})=>{const Je=q.findIndex(Ae=>Ae.id===Fe);if(Ce==="up"&&Je>0){const Ae=q[Je-1],Ye=q[Je];await ee.from("community_categories").update({sort_order:Ye.sort_order}).eq("id",Ae.id),await ee.from("community_categories").update({sort_order:Ae.sort_order}).eq("id",Ye.id)}else if(Ce==="down"&&Jee.invalidateQueries({queryKey:["admin-community-categories"]})}),ie=dr({mutationFn:async Fe=>{if(Fe.id){const{error:Ce}=await ee.from("community_private_groups").update({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null}).eq("id",Fe.id);if(Ce)throw Ce}else{const Ce=Math.max(...K.map(Ae=>Ae.sort_order),0),{error:Je}=await ee.from("community_private_groups").insert({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null,sort_order:Ce+1});if(Je)throw Je}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),v(!1),k(null),S({name:"",description:"",icon:""}),t({title:w?"Private group updated!":"Private group created!"})},onError:Fe=>{t({title:"Error",description:Fe.message,variant:"destructive"})}}),me=dr({mutationFn:async Fe=>{const{error:Ce}=await ee.from("community_private_groups").delete().eq("id",Fe);if(Ce)throw Ce},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),t({title:"Private group deleted"})}}),fe=dr({mutationFn:async({id:Fe,direction:Ce})=>{const Je=K.findIndex(Ae=>Ae.id===Fe);if(Ce==="up"&&Je>0){const Ae=K[Je-1],Ye=K[Je];await ee.from("community_private_groups").update({sort_order:Ye.sort_order}).eq("id",Ae.id),await ee.from("community_private_groups").update({sort_order:Ae.sort_order}).eq("id",Ye.id)}else if(Ce==="down"&&Jee.invalidateQueries({queryKey:["admin-private-groups"]})}),ve=dr({mutationFn:async({groupId:Fe,userId:Ce,isMember:Je})=>{if(Je){const{error:Ae}=await ee.from("community_private_group_members").delete().eq("group_id",Fe).eq("user_id",Ce);if(Ae)throw Ae}else{const{error:Ae}=await ee.from("community_private_group_members").insert({group_id:Fe,user_id:Ce});if(Ae)throw Ae}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",A==null?void 0:A.id]})}}),Ie=dr({mutationFn:async({groupId:Fe,brokerageId:Ce,isMember:Je})=>{if(Je){const{error:Ae}=await ee.from("community_private_group_members").delete().eq("group_id",Fe).eq("brokerage_id",Ce);if(Ae)throw Ae}else{const{error:Ae}=await ee.from("community_private_group_members").insert({group_id:Fe,brokerage_id:Ce});if(Ae)throw Ae}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",A==null?void 0:A.id]})}}),Se=Fe=>{a(Fe),m({name:Fe.name,description:Fe.description||"",icon:Fe.icon||""}),o(!0)},oe=()=>{a(null),m({name:"",description:"",icon:""}),o(!0)},ae=Fe=>{k(Fe),S({name:Fe.name,description:Fe.description||"",icon:Fe.icon||""}),v(!0)},Ne=()=>{k(null),S({name:"",description:"",icon:""}),v(!0)},Te=Fe=>{D(Fe),F(""),I(!0)},Be=Fe=>re.some(Ce=>Ce.user_id===Fe),Le=Fe=>re.some(Ce=>Ce.brokerage_id===Fe),Qe=he.filter(Fe=>Fe.name.toLowerCase().includes($.toLowerCase())||Fe.email.toLowerCase().includes($.toLowerCase()));return r.jsx(Dr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(Oa,{value:n,onValueChange:s,children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"categories",children:"Public Categories"}),r.jsxs(xn,{value:"private-groups",children:[r.jsx(Uf,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(Un,{value:"categories",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories visible to all community members"}),r.jsxs(te,{onClick:oe,children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-[50px]",children:"Order"}),r.jsx(Mt,{className:"w-[80px]",children:"Icon"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:W?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):q.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):q.map((Fe,Ce)=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===0,onClick:()=>ye.mutate({id:Fe.id,direction:"up"}),children:"↑"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===q.length-1,onClick:()=>ye.mutate({id:Fe.id,direction:"down"}),children:"↓"})]})}),r.jsx(yt,{className:"text-2xl",children:Fe.icon||"📁"}),r.jsx(yt,{className:"font-medium",children:Fe.name}),r.jsx(yt,{className:"text-muted-foreground",children:Fe.description||"—"}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Se(Fe),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ne.mutate(Fe.id)},children:r.jsx(es,{className:"h-4 w-4"})})]})})]},Fe.id))})]})})})]}),r.jsxs(Un,{value:"private-groups",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Private groups visible only to assigned members or brokerages"}),r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(na,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(te,{onClick:Ne,children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-[50px]",children:"Order"}),r.jsx(Mt,{className:"w-[80px]",children:"Icon"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"w-[120px]",children:"Members"}),r.jsx(Mt,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Vs,{children:Z?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):K.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):K.map((Fe,Ce)=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===0,onClick:()=>fe.mutate({id:Fe.id,direction:"up"}),children:"↑"}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Ce===K.length-1,onClick:()=>fe.mutate({id:Fe.id,direction:"down"}),children:"↓"})]})}),r.jsx(yt,{className:"text-2xl",children:Fe.icon||"🔒"}),r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Fe.name,Fe.brokerage_id?r.jsxs(Ft,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:[r.jsx(Uf,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(yt,{className:"text-muted-foreground",children:Fe.description||"—"}),r.jsx(yt,{children:r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>Te(Fe),children:[r.jsx(fs,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[!Fe.brokerage_id&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ae(Fe),children:r.jsx(ya,{className:"h-4 w-4"})}),!Fe.brokerage_id&&r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&me.mutate(Fe.id)},children:r.jsx(es,{className:"h-4 w-4"})}),Fe.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Fe.id))})]})})})]})]}),r.jsx(Ur,{open:i,onOpenChange:o,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:c?"Edit Category":"Create Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(xt,{value:h.icon,onChange:Fe=>m(Ce=>({...Ce,icon:Fe.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(xt,{value:h.name,onChange:Fe=>m(Ce=>({...Ce,name:Fe.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(gs,{value:h.description,onChange:Fe=>m(Ce=>({...Ce,description:Fe.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{onClick:()=>je.mutate({...h,id:c==null?void 0:c.id}),disabled:!h.name.trim(),children:c?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Ur,{open:x,onOpenChange:v,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:w?"Edit Private Group":"Create Private Group"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(xt,{value:C.icon,onChange:Fe=>S(Ce=>({...Ce,icon:Fe.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(xt,{value:C.name,onChange:Fe=>S(Ce=>({...Ce,name:Fe.target.value})),placeholder:"e.g., Pioneers",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(gs,{value:C.description,onChange:Fe=>S(Ce=>({...Ce,description:Fe.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),r.jsx(te,{onClick:()=>ie.mutate({...C,id:w==null?void 0:w.id}),disabled:!C.name.trim(),children:w?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Ur,{open:T,onOpenChange:I,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Manage Members: ",A==null?void 0:A.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Oa,{defaultValue:"brokerages",children:[r.jsxs(Ta,{className:"w-full",children:[r.jsx(xn,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(xn,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(Un,{value:"brokerages",className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select brokerages to grant all their agents access to this private group."}),r.jsx(_l,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[ue.map(Fe=>r.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(vc,{checked:Le(Fe.id),onCheckedChange:()=>{A&&Ie.mutate({groupId:A.id,brokerageId:Fe.id,isMember:Le(Fe.id)})}}),r.jsx("span",{className:"font-medium",children:Fe.name})]}),r.jsxs(Ft,{variant:"secondary",children:[he.filter(Ce=>Ce.brokerage_id===Fe.id).length," agents"]})]},Fe.id)),ue.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(Un,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search users...",value:$,onChange:Fe=>F(Fe.target.value),className:"pl-9"})]}),r.jsx(_l,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Qe.map(Fe=>r.jsx("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(vc,{checked:Be(Fe.id),onCheckedChange:()=>{A&&ve.mutate({groupId:A.id,userId:Fe.id,isMember:Be(Fe.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Fe.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Fe.email})]})]})},Fe.id)),Qe.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(te,{onClick:()=>I(!1),children:"Done"})})]})]})})]})})},$Ne=t=>{switch(t){case"academy_video":return r.jsx(wc,{className:"h-3 w-3"});case"template":return r.jsx(Si,{className:"h-3 w-3"});case"toolbox":return r.jsx(El,{className:"h-3 w-3"});case"newsletter":return r.jsx(Dx,{className:"h-3 w-3"});case"social_swag":return r.jsx(As,{className:"h-3 w-3"});default:return r.jsx($s,{className:"h-3 w-3"})}},mbt=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}},gbt=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}},xbt=()=>{const{toast:t}=ua(),[e,n]=P.useState([]),[s,i]=P.useState([]),[o,c]=P.useState([]),[a,h]=P.useState(!0),[m,x]=P.useState(""),[v,w]=P.useState(null),[k,C]=P.useState([]),[S,T]=P.useState([]);P.useEffect(()=>{I()},[]);const I=async()=>{try{h(!0);const{data:F,error:q}=await ee.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(q)throw q;const{data:W,error:K}=await ee.from("content_engagement_logs").select(` id, user_id, resource_type, resource_id, resource_title, action_type, created_at `).order("created_at",{ascending:!1}).limit(5e3);if(K)throw K;const Z=[...new Set((W==null?void 0:W.map(ie=>ie.user_id))||[])],{data:re}=await ee.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",Z),he=new Map((re==null?void 0:re.map(ie=>[ie.id,ie]))||[]),ue=(F==null?void 0:F.map(ie=>{var me,fe,ve,Ie;return{id:ie.id,user_id:ie.user_id,app_name:ie.app_name,launched_at:ie.launched_at,user_name:((me=ie.profiles)==null?void 0:me.name)||"Unknown",user_email:((fe=ie.profiles)==null?void 0:fe.email)||"Unknown",brokerage_name:((Ie=(ve=ie.profiles)==null?void 0:ve.brokerages)==null?void 0:Ie.name)||null}}))||[],je=(W==null?void 0:W.map(ie=>{var fe;const me=he.get(ie.user_id);return{id:ie.id,user_id:ie.user_id,resource_type:ie.resource_type,resource_id:ie.resource_id,resource_title:ie.resource_title,action_type:ie.action_type,created_at:ie.created_at,user_name:(me==null?void 0:me.name)||"Unknown",user_email:(me==null?void 0:me.email)||"Unknown",brokerage_name:((fe=me==null?void 0:me.brokerages)==null?void 0:fe.name)||null}}))||[];n(ue),i(je);const ne=new Map;ue.forEach(ie=>{if(!ne.has(ie.user_id))ne.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:"app",last_activity_name:ie.app_name,last_activity_at:ie.launched_at,total_app_launches:1,total_content_views:0});else{const me=ne.get(ie.user_id);me.total_app_launches++,new Date(ie.launched_at)>new Date(me.last_activity_at)&&(me.last_activity_type="app",me.last_activity_name=ie.app_name,me.last_activity_at=ie.launched_at)}}),je.forEach(ie=>{if(!ne.has(ie.user_id))ne.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:ie.resource_type,last_activity_name:ie.resource_title,last_activity_at:ie.created_at,total_app_launches:0,total_content_views:1});else{const me=ne.get(ie.user_id);me.total_content_views++,new Date(ie.created_at)>new Date(me.last_activity_at)&&(me.last_activity_type=ie.resource_type,me.last_activity_name=ie.resource_title,me.last_activity_at=ie.created_at)}});const ye=Array.from(ne.values()).sort((ie,me)=>new Date(me.last_activity_at).getTime()-new Date(ie.last_activity_at).getTime());c(ye)}catch(F){console.error("Error loading activity:",F),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{h(!1)}},A=F=>{w({id:F.user_id,name:F.user_name,email:F.user_email});const q=e.filter(K=>K.user_id===F.user_id),W=s.filter(K=>K.user_id===F.user_id);C(q),T(W)},D=()=>{w(null),C([]),T([])},$=o.filter(F=>{var W;if(!m)return!0;const q=m.toLowerCase();return F.user_name.toLowerCase().includes(q)||F.user_email.toLowerCase().includes(q)||((W=F.brokerage_name)==null?void 0:W.toLowerCase().includes(q))});return a?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"User Activity"}),r.jsx(In,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name, email, or brokerage...",value:m,onChange:F=>x(F.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"User"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(Mt,{children:"Last Activity"}),r.jsx(Mt,{children:"Last Active"}),r.jsx(Mt,{className:"text-right",children:"Apps"}),r.jsx(Mt,{className:"text-right",children:"Content"})]})}),r.jsx(Vs,{children:$.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):$.map(F=>r.jsxs(Er,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>A(F),children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:F.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:F.user_email})]})}),r.jsx(yt,{children:F.brokerage_name?r.jsx(Ft,{variant:"outline",children:F.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(yt,{children:r.jsx("div",{className:"flex items-center gap-2",children:F.last_activity_type==="app"?r.jsxs(Ft,{variant:"secondary",children:[r.jsx($s,{className:"h-3 w-3 mr-1"}),F.last_activity_name]}):r.jsxs(Ft,{variant:"outline",className:"flex items-center gap-1",children:[$Ne(F.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:F.last_activity_name})]})})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:Qd(new Date(F.last_activity_at),{addSuffix:!0})}),r.jsx(yt,{className:"text-right",children:r.jsx(Ft,{variant:"outline",children:F.total_app_launches})}),r.jsx(yt,{className:"text-right",children:r.jsx(Ft,{variant:"outline",children:F.total_content_views})})]},F.user_id))})]})})]})]}),r.jsx(Ur,{open:!!v,onOpenChange:F=>!F&&D(),children:r.jsxs(Br,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:[v==null?void 0:v.name,"'s Activity"]}),r.jsx(us,{children:v==null?void 0:v.email})]}),r.jsxs(Oa,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-2",children:[r.jsxs(xn,{value:"content",children:["Content (",S.length,")"]}),r.jsxs(xn,{value:"apps",children:["App Launches (",k.length,")"]})]}),r.jsx(Un,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Vs,{children:S.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):S.map(F=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs(Ft,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[$Ne(F.resource_type),mbt(F.resource_type)]})}),r.jsx(yt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:F.resource_title})}),r.jsx(yt,{children:r.jsx(Ft,{variant:"secondary",children:gbt(F.action_type)})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:Qd(new Date(F.created_at),{addSuffix:!0})})]},F.id))})]})})}),r.jsx(Un,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Vs,{children:k.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):k.map(F=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsx(Ft,{variant:"secondary",children:F.app_name})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:Qd(new Date(F.launched_at),{addSuffix:!0})})]},F.id))})]})})})]})]})})]})},ybt=()=>{const{toast:t}=ua(),[e,n]=P.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,i]=P.useState(!0);P.useEffect(()=>{o()},[]);const o=async()=>{try{i(!0);const{count:c}=await ee.from("profiles").select("*",{count:"exact",head:!0}),{count:a}=await ee.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),h=(c||0)-(a||0),{count:m}=await ee.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}),v=new Date;v.setDate(v.getDate()-7);const{count:w}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",v.toISOString()),k=new Date;k.setMonth(k.getMonth()-1);const{count:C}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",k.toISOString()),{data:S}=await ee.from("activity_logs").select("user_id").gte("launched_at",v.toISOString()),T=new Set(S==null?void 0:S.map(I=>I.user_id)).size;n({totalUsers:c||0,activeUsers:a||0,pendingUsers:h,totalBrokerages:m||0,totalLaunches:x||0,launchesThisWeek:w||0,launchesThisMonth:C||0,uniqueActiveThisWeek:T})}catch(c){console.error("Error loading analytics:",c),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{i(!1)}};return s?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(fs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.activeUsers," active, ",e.pendingUsers," pending"]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:e.totalUsers>0?`${Math.round(e.activeUsers/e.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(na,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(cg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(cg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(cg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(qf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},UNe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},qNe={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 aze({brokerageOnly:t=!1,brokerageId:e}){const[n,s]=P.useState([]),[i,o]=P.useState(!0),[c,a]=P.useState(""),[h,m]=P.useState("all");P.useEffect(()=>{x()},[e]);const x=async()=>{o(!0);try{let I=[];if(t&&e){const{data:Z}=await ee.from("profiles").select("id").eq("brokerage_id",e);if(I=(Z==null?void 0:Z.map(re=>re.id))||[],I.length===0){s([]),o(!1);return}}let A=ee.from("resource_shares").select("*").order("created_at",{ascending:!1});t&&I.length>0&&(A=A.or(`sender_id.in.(${I.join(",")}),recipient_id.in.(${I.join(",")})`));const{data:D,error:$}=await A;if($)throw $;const F=new Set;D==null||D.forEach(Z=>{F.add(Z.sender_id),F.add(Z.recipient_id)});const{data:q}=await ee.from("profiles").select("id, name, email").in("id",Array.from(F)),W=new Map((q==null?void 0:q.map(Z=>[Z.id,Z]))||[]),K=(D==null?void 0:D.map(Z=>({...Z,sender:W.get(Z.sender_id),recipient:W.get(Z.recipient_id)})))||[];s(K)}catch(I){console.error("Error loading shares:",I)}finally{o(!1)}},v=n.filter(I=>{var $,F;const A=c===""||I.resource_title.toLowerCase().includes(c.toLowerCase())||(($=I.sender)==null?void 0:$.name.toLowerCase().includes(c.toLowerCase()))||((F=I.recipient)==null?void 0:F.name.toLowerCase().includes(c.toLowerCase())),D=h==="all"||I.resource_type===h;return A&&D}),w=n.length,k=new Set(n.map(I=>I.sender_id)).size,C=new Set(n.map(I=>I.recipient_id)).size,S=n.length>0?Math.round(n.filter(I=>I.is_read).length/n.length*100):0,T=n.reduce((I,A)=>(I[A.resource_type]=(I[A.resource_type]||0)+1,I),{});return i?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((I,A)=>r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Kr,{className:"h-4 w-20"})}),r.jsx(et,{children:r.jsx(Kr,{className:"h-8 w-16"})})]},A))}),r.jsx(Ze,{children:r.jsx(et,{className:"p-6",children:r.jsx(Kr,{className:"h-[300px]"})})})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(Xd,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:w})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(fs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:k})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(qf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:C})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[S,"%"]})})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(T).map(([I,A])=>r.jsxs(Ft,{variant:"secondary",className:qNe[I],children:[UNe[I],": ",A]},I)),Object.keys(T).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Share History"}),r.jsxs(In,{children:["All resource shares ",t?"in your brokerage":"across the platform"]})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by resource, sender, or recipient...",value:c,onChange:I=>a(I.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:h,onValueChange:m,children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Resource type"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Types"}),r.jsx(tr,{value:"event",children:"Events"}),r.jsx(tr,{value:"template",children:"Templates"}),r.jsx(tr,{value:"academy_video",children:"Academy Videos"}),r.jsx(tr,{value:"resource_kit",children:"Resource Kits"}),r.jsx(tr,{value:"newsletter",children:"Newsletters"}),r.jsx(tr,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(_l,{className:"h-[400px]",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Sender"}),r.jsx(Mt,{children:"Recipient"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Date"})]})}),r.jsx(Vs,{children:v.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):v.map(I=>{var A,D;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium max-w-[200px] truncate",children:I.resource_title}),r.jsx(yt,{children:r.jsx(Ft,{variant:"secondary",className:qNe[I.resource_type],children:UNe[I.resource_type]})}),r.jsx(yt,{children:((A=I.sender)==null?void 0:A.name)||"Unknown"}),r.jsx(yt,{children:((D=I.recipient)==null?void 0:D.name)||"Unknown"}),r.jsx(yt,{children:r.jsx(Ft,{variant:I.is_read?"default":"outline",children:I.is_read?"Read":"Unread"})}),r.jsx(yt,{className:"text-muted-foreground",children:un(new Date(I.created_at),"MMM d, yyyy")})]},I.id)})})]})})]})]})]})}const vbt=()=>r.jsx(Dr,{title:"Analytics",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analytics & Activity"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Platform-wide usage statistics and user activity"})]}),r.jsxs(Oa,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"analytics",children:"Analytics"}),r.jsx(xn,{value:"activity",children:"Activity"}),r.jsx(xn,{value:"shares",children:"Shares"})]}),r.jsx(Un,{value:"analytics",className:"space-y-4",children:r.jsx(ybt,{})}),r.jsx(Un,{value:"activity",className:"space-y-4",children:r.jsx(xbt,{})}),r.jsx(Un,{value:"shares",className:"space-y-4",children:r.jsx(aze,{})})]})]})});function _bt(){const t=Qr(),[e,n]=P.useState(!1),[s,i]=P.useState(null),[o,c]=P.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[a,h]=P.useState(null),[m,x]=P.useState(""),[v,w]=P.useState([]),[k,C]=P.useState([]),[S,T]=P.useState([]),[I,A]=P.useState(!1),[D,$]=P.useState(null),[F,q]=P.useState(""),{data:W,isLoading:K}=rr({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Ae,error:Ye}=await ee.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Ye)throw Ye;return Ae}}),{data:Z}=rr({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Ae,error:Ye}=await ee.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ae}}),{data:re}=rr({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Ae,error:Ye}=await ee.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ae}}),{data:he}=rr({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Ae,error:Ye}=await ee.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ae}}),{data:ue,isLoading:je}=rr({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Ae,error:Ye}=await ee.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ae}}),ne=()=>{c({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),h(null),x(""),w([]),C([]),T([]),i(null),q("")},ye=Ae=>{i(Ae),c({title:Ae.title,description:Ae.description||"",publish_date:Ae.publish_date.split("T")[0],is_published:Ae.is_published,category_id:Ae.category_id||""}),x(Ae.preview_image_url||""),q("");const Ye=(Z==null?void 0:Z.filter(nt=>nt.resource_id===Ae.id))||[];w(Ye.map(nt=>({id:nt.id,name:nt.name,file_url:nt.file_url,file_size:nt.file_size,sort_order:nt.sort_order})));const ge=(re==null?void 0:re.filter(nt=>nt.resource_id===Ae.id))||[];C(ge.map(nt=>({id:nt.id,title:nt.title,video_url:nt.video_url,sort_order:nt.sort_order})));const ft=(he==null?void 0:he.filter(nt=>nt.resource_id===Ae.id))||[];T(ft.map(nt=>({id:nt.id,title:nt.title,canva_share_link:nt.canva_share_link,sort_order:nt.sort_order}))),n(!0)},ie=Ae=>{var ge;const Ye=(ge=Ae.target.files)==null?void 0:ge[0];Ye&&(h(Ye),x(URL.createObjectURL(Ye)))},me=()=>{w([...v,{name:"",file_url:"",sort_order:v.length}])},fe=Ae=>{w(v.filter((Ye,ge)=>ge!==Ae))},ve=(Ae,Ye,ge)=>{const ft=[...v];if(Ye==="file"&&ge instanceof File){const nt=ge.name.replace(/\.[^/.]+$/,"");ft[Ae]={...ft[Ae],file:ge,file_size:ge.size,name:ft[Ae].name||nt}}else ft[Ae]={...ft[Ae],[Ye]:ge};w(ft)},Ie=()=>{C([...k,{title:"",video_url:"",sort_order:k.length}])},Se=Ae=>{C(k.filter((Ye,ge)=>ge!==Ae))},oe=(Ae,Ye,ge)=>{const ft=[...k];Ye==="file"&&ge instanceof File?ft[Ae]={...ft[Ae],file:ge}:ft[Ae]={...ft[Ae],[Ye]:ge},C(ft)},ae=()=>{T([...S,{title:"",canva_share_link:"",sort_order:S.length}])},Ne=Ae=>{T(S.filter((Ye,ge)=>ge!==Ae))},Te=(Ae,Ye,ge)=>{const ft=[...S];ft[Ae]={...ft[Ae],[Ye]:ge},T(ft)},Be=async(Ae,Ye)=>{try{const ge=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:Ae.name}});if(ge.error)throw ge.error;const{videoId:ft,uploadUrl:nt,libraryId:Ve}=ge.data,Me=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ft,libraryId:Ve}});if(Me.error)throw Me.error;const{uploadUrl:rt,apiKey:Re}=Me.data,Ge=new XMLHttpRequest;return Ge.open("PUT",rt,!0),Ge.setRequestHeader("AccessKey",Re),Ge.upload.onprogress=tt=>{if(tt.lengthComputable){const Et=Math.round(tt.loaded/tt.total*100),Lt=[...k];Lt[Ye]={...Lt[Ye],uploadProgress:Et},C(Lt)}},await new Promise((tt,Et)=>{Ge.onload=()=>Ge.status>=200&&Ge.status<300?tt():Et(new Error("Upload failed")),Ge.onerror=()=>Et(new Error("Upload failed")),Ge.send(Ae)}),`https://iframe.mediadelivery.net/embed/${Ve}/${ft}`}catch(ge){throw console.error("Bunny upload error:",ge),ge}},Le=dr({mutationFn:async Ae=>{const{data:Ye,error:ge}=await ee.from("brokerage_resource_categories").insert({name:Ae,sort_order:(ue==null?void 0:ue.length)||0}).select().single();if(ge)throw ge;return Ye},onSuccess:Ae=>{t.invalidateQueries({queryKey:["brokerage-resource-categories"]}),c({...o,category_id:Ae.id}),q(""),He.success("Category created")},onError:Ae=>{He.error("Failed to create category: "+Ae.message)}}),Qe=dr({mutationFn:async()=>{A(!0);let Ae=(s==null?void 0:s.preview_image_url)||null;if(a){const ft=a.name.split(".").pop(),nt=`${Date.now()}.${ft}`,{error:Ve}=await ee.storage.from("brokerage-resources").upload(`previews/${nt}`,a);if(Ve)throw Ve;const{data:Me}=ee.storage.from("brokerage-resources").getPublicUrl(`previews/${nt}`);Ae=Me.publicUrl}const Ye={title:o.title,description:o.description||null,preview_image_url:Ae,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let ge;if(s){const{error:ft}=await ee.from("brokerage_resources").update(Ye).eq("id",s.id);if(ft)throw ft;ge=s.id;const nt=(Z==null?void 0:Z.filter(Ot=>Ot.resource_id===s.id).map(Ot=>Ot.id))||[],Ve=v.filter(Ot=>Ot.id).map(Ot=>Ot.id),Me=nt.filter(Ot=>!Ve.includes(Ot));Me.length>0&&await ee.from("brokerage_resource_pdfs").delete().in("id",Me);const rt=(re==null?void 0:re.filter(Ot=>Ot.resource_id===s.id).map(Ot=>Ot.id))||[],Re=k.filter(Ot=>Ot.id).map(Ot=>Ot.id),Ge=rt.filter(Ot=>!Re.includes(Ot));Ge.length>0&&await ee.from("brokerage_resource_videos").delete().in("id",Ge);const tt=(he==null?void 0:he.filter(Ot=>Ot.resource_id===s.id).map(Ot=>Ot.id))||[],Et=S.filter(Ot=>Ot.id).map(Ot=>Ot.id),Lt=tt.filter(Ot=>!Et.includes(Ot));Lt.length>0&&await ee.from("brokerage_resource_links").delete().in("id",Lt)}else{const{data:ft,error:nt}=await ee.from("brokerage_resources").insert(Ye).select().single();if(nt)throw nt;ge=ft.id}for(let ft=0;ft{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),He.success(s?"Resource updated":"Resource created"),n(!1),ne(),A(!1)},onError:Ae=>{He.error("Failed to save resource: "+Ae.message),A(!1)}}),Fe=dr({mutationFn:async Ae=>{const{error:Ye}=await ee.from("brokerage_resources").delete().eq("id",Ae);if(Ye)throw Ye},onSuccess:()=>{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),He.success("Resource deleted")},onError:Ae=>{He.error("Failed to delete: "+Ae.message)}}),Ce=Ae=>{if(Ae.preventDefault(),!o.title){He.error("Please enter a title");return}Qe.mutate()},Je=Ae=>{const Ye=(Z==null?void 0:Z.filter(nt=>nt.resource_id===Ae).length)||0,ge=(re==null?void 0:re.filter(nt=>nt.resource_id===Ae).length)||0,ft=(he==null?void 0:he.filter(nt=>nt.resource_id===Ae).length)||0;return{pdfCount:Ye,videoCount:ge,linkCount:ft}};return r.jsx(Dr,{title:"Brokerage Resources Management",description:"Create and manage resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(W==null?void 0:W.length)||0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(W==null?void 0:W.filter(Ae=>Ae.is_published).length)||0})})]})]}),r.jsxs(te,{onClick:()=>{ne(),n(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Content"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:K?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(W==null?void 0:W.length)===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):W==null?void 0:W.map(Ae=>{const{pdfCount:Ye,videoCount:ge,linkCount:ft}=Je(Ae.id),nt=ue==null?void 0:ue.find(Ve=>Ve.id===Ae.category_id);return r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ae.preview_image_url?r.jsx("img",{src:Ae.preview_image_url,alt:Ae.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(hh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ae.title}),Ae.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ae.description})]})]})}),r.jsx(yt,{children:nt?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:nt.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Si,{className:"h-3.5 w-3.5"}),Ye]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wi,{className:"h-3.5 w-3.5"}),ge]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(bo,{className:"h-3.5 w-3.5"}),ft]})]})}),r.jsx(yt,{children:un(new Date(Ae.publish_date),"MMM d, yyyy")}),r.jsx(yt,{children:r.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":"bg-yellow-100 text-yellow-800"}`,children:Ae.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{const Ve=(Z==null?void 0:Z.filter(Re=>Re.resource_id===Ae.id))||[],Me=(re==null?void 0:re.filter(Re=>Re.resource_id===Ae.id))||[],rt=(he==null?void 0:he.filter(Re=>Re.resource_id===Ae.id))||[];$({...Ae,pdfs:Ve,videos:Me,links:rt})},children:r.jsx(Al,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ye(Ae),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Fe.mutate(Ae.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},Ae.id)})})]})})}),r.jsx(Ur,{open:e,onOpenChange:n,children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:Ce,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[m?r.jsx("img",{src:m,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(hh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(xt,{type:"file",accept:"image/*",onChange:ie})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",value:o.title,onChange:Ae=>c({...o,title:Ae.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{className:"flex items-center gap-2",children:[r.jsx(aj,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:o.category_id,onValueChange:Ae=>c({...o,category_id:Ae}),children:[r.jsx(yn,{className:"flex-1",children:r.jsx(bn,{placeholder:"Select a category"})}),r.jsx(vn,{children:ue==null?void 0:ue.map(Ae=>r.jsx(tr,{value:Ae.id,children:Ae.name},Ae.id))})]}),o.category_id&&r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>c({...o,category_id:""}),children:r.jsx(Es,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{placeholder:"Or create new category...",value:F,onChange:Ae=>q(Ae.target.value),className:"flex-1"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",disabled:!F.trim()||Le.isPending,onClick:()=>Le.mutate(F.trim()),children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:o.description,onChange:Ae=>c({...o,description:Ae}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(xt,{id:"publish_date",type:"date",value:o.publish_date,onChange:Ae=>c({...o,publish_date:Ae.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Js,{checked:o.is_published,onCheckedChange:Ae=>c({...o,is_published:Ae})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xe,{className:"flex items-center gap-2",children:[r.jsx(Si,{className:"h-4 w-4"}),"PDF Documents (",v.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:me,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),v.map((Ae,Ye)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(xt,{placeholder:"PDF Name",value:Ae.name,onChange:ge=>ve(Ye,"name",ge.target.value),className:"flex-1"}),r.jsx(xt,{type:"file",accept:".pdf",onChange:ge=>{var nt;const ft=(nt=ge.target.files)==null?void 0:nt[0];ft&&ve(Ye,"file",ft)},className:"flex-1"}),Ae.file_url&&!Ae.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>fe(Ye),children:r.jsx(Es,{className:"h-4 w-4"})})]},Ye))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xe,{className:"flex items-center gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Videos (",k.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ie,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),k.map((Ae,Ye)=>r.jsxs("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xt,{placeholder:"Video Title",value:Ae.title,onChange:ge=>oe(Ye,"title",ge.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>Se(Ye),children:r.jsx(Es,{className:"h-4 w-4"})})]}),r.jsx(xt,{type:"file",accept:"video/*",onChange:ge=>{var nt;const ft=(nt=ge.target.files)==null?void 0:nt[0];ft&&oe(Ye,"file",ft)}}),Ae.uploadProgress!==void 0&&Ae.uploadProgress>0&&r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Ae.uploadProgress}%`}})}),Ae.video_url&&!Ae.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},Ye))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Xe,{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-4 w-4"}),"Canva Links (",S.length,")"]}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:ae,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),S.map((Ae,Ye)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(xt,{placeholder:"Link Title",value:Ae.title,onChange:ge=>Te(Ye,"title",ge.target.value),className:"flex-1"}),r.jsx(xt,{placeholder:"Canva Share Link",value:Ae.canva_share_link,onChange:ge=>Te(Ye,"canva_share_link",ge.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>Ne(Ye),children:r.jsx(Es,{className:"h-4 w-4"})})]},Ye))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:Qe.isPending||I,children:Qe.isPending||I?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Ur,{open:!!D,onOpenChange:()=>$(null),children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:D==null?void 0:D.title})}),D&&r.jsxs("div",{className:"space-y-4",children:[D.preview_image_url&&r.jsx("img",{src:D.preview_image_url,alt:D.title,className:"w-full h-48 object-cover rounded-lg"}),D.description&&r.jsx("p",{className:"text-muted-foreground",children:D.description}),D.pdfs&&D.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Si,{className:"h-4 w-4"}),"PDF Documents (",D.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:D.pdfs.map(Ae=>r.jsx("a",{href:Ae.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Ae.name},Ae.id))})]}),D.videos&&D.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Videos (",D.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:D.videos.map(Ae=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Ae.title})},Ae.id))})]}),D.links&&D.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(bo,{className:"h-4 w-4"}),"Canva Links (",D.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:D.links.map(Ae=>r.jsx("a",{href:Ae.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Ae.title},Ae.id))})]})]})]})})]})})}const oze=[{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 bbt(){const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[c,a]=P.useState(!1),[h,m]=P.useState(null),[x,v]=P.useState(!1),[w,k]=P.useState(!1),[C,S]=P.useState(""),[T,I]=P.useState(""),[A,D]=P.useState(""),[$,F]=P.useState(""),[q,W]=P.useState("Learn More"),[K,Z]=P.useState("top"),[re,he]=P.useState(""),[ue,je]=P.useState(!0),[ne,ye]=P.useState(""),[ie,me]=P.useState("");P.useEffect(()=>{fe()},[]);const fe=async()=>{try{const{data:Le,error:Qe}=await ee.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Qe)throw Qe;e(Le||[])}catch(Le){He.error("Failed to load banners: "+Le.message)}finally{s(!1)}},ve=()=>{S(""),I(""),D(""),F(""),W("Learn More"),Z("top"),he(""),je(!0),ye(""),me(""),m(null)},Ie=Le=>{m(Le),S(Le.title),I(Le.description||""),D(Le.image_url),F(Le.link_url||""),W(Le.link_text||"Learn More"),Z(Le.placement),he(Le.section_after||""),je(Le.is_active),ye(Le.start_date?un(new Date(Le.start_date),"yyyy-MM-dd'T'HH:mm"):""),me(Le.end_date?un(new Date(Le.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},Se=async Le=>{var Fe;const Qe=(Fe=Le.target.files)==null?void 0:Fe[0];if(Qe){v(!0);try{const Ce=Qe.name.split(".").pop(),Je=`${Date.now()}.${Ce}`,{error:Ae}=await ee.storage.from("banner-images").upload(Je,Qe);if(Ae)throw Ae;const{data:{publicUrl:Ye}}=ee.storage.from("banner-images").getPublicUrl(Je);D(Ye),He.success("Image uploaded successfully")}catch(Ce){He.error("Failed to upload image: "+Ce.message)}finally{v(!1)}}},oe=async()=>{if(!C.trim()||!A){He.error("Please fill in required fields (title and image)");return}k(!0);try{const Le={title:C.trim(),description:T.trim()||null,image_url:A,link_url:$.trim()||null,link_text:q.trim()||"Learn More",placement:K,section_after:K==="between"?re:null,is_active:ue,start_date:ne?new Date(ne).toISOString():null,end_date:ie?new Date(ie).toISOString():null};if(h){const{error:Qe}=await ee.from("dashboard_banners").update(Le).eq("id",h.id);if(Qe)throw Qe;He.success("Banner updated successfully")}else{const Qe=t.filter(Ce=>Ce.placement===K).length,{error:Fe}=await ee.from("dashboard_banners").insert({...Le,sort_order:Qe});if(Fe)throw Fe;He.success("Banner created successfully")}o(!1),ve(),fe()}catch(Le){He.error("Failed to save banner: "+Le.message)}finally{k(!1)}},ae=async()=>{if(h)try{const{error:Le}=await ee.from("dashboard_banners").delete().eq("id",h.id);if(Le)throw Le;He.success("Banner deleted successfully"),a(!1),m(null),fe()}catch(Le){He.error("Failed to delete banner: "+Le.message)}},Ne=async Le=>{try{const{error:Qe}=await ee.from("dashboard_banners").update({is_active:!Le.is_active}).eq("id",Le.id);if(Qe)throw Qe;He.success(Le.is_active?"Banner deactivated":"Banner activated"),fe()}catch(Qe){He.error("Failed to update banner: "+Qe.message)}},Te=t.filter(Le=>Le.placement==="top"),Be=t.filter(Le=>Le.placement==="between");return n?r.jsx(Dr,{title:"Dashboard Management",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):r.jsxs(Dr,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Wo,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(In,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Ur,{open:i&&K==="top",onOpenChange:Le=>{Le||ve(),o(Le),Le&&Z("top")},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{onClick:()=>{ve(),Z("top")},children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:[h?"Edit":"Create"," Banner"]}),r.jsx(us,{children:"Configure the banner's content and display settings"})]}),r.jsx(VNe,{title:C,setTitle:S,description:T,setDescription:I,imageUrl:A,linkUrl:$,setLinkUrl:F,linkText:q,setLinkText:W,placement:K,setPlacement:Z,sectionAfter:re,setSectionAfter:he,isActive:ue,setIsActive:je,startDate:ne,setStartDate:ye,endDate:ie,setEndDate:me,handleImageUpload:Se,uploading:x,showPlacementOptions:!1}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>{o(!1),ve()},children:"Cancel"}),r.jsx(te,{onClick:oe,disabled:w,children:w?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Te.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hero banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Te.map(Le=>r.jsx(HNe,{banner:Le,onEdit:()=>Ie(Le),onDelete:()=>{m(Le),a(!0)},onToggleActive:()=>Ne(Le)},Le.id))})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Wo,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(In,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Ur,{open:i&&K==="between",onOpenChange:Le=>{Le||ve(),o(Le),Le&&Z("between")},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{onClick:()=>{ve(),Z("between")},children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:[h?"Edit":"Create"," Section Banner"]}),r.jsx(us,{children:"Configure where this banner appears between sections"})]}),r.jsx(VNe,{title:C,setTitle:S,description:T,setDescription:I,imageUrl:A,linkUrl:$,setLinkUrl:F,linkText:q,setLinkText:W,placement:K,setPlacement:Z,sectionAfter:re,setSectionAfter:he,isActive:ue,setIsActive:je,startDate:ne,setStartDate:ye,endDate:ie,setEndDate:me,handleImageUpload:Se,uploading:x,showPlacementOptions:!0}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>{o(!1),ve()},children:"Cancel"}),r.jsx(te,{onClick:oe,disabled:w,children:w?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Be.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No section banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Be.map(Le=>r.jsx(HNe,{banner:Le,onEdit:()=>Ie(Le),onDelete:()=>{m(Le),a(!0)},onToggleActive:()=>Ne(Le),showSection:!0},Le.id))})})]})]}),r.jsx(Ur,{open:c,onOpenChange:a,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Delete Banner"}),r.jsxs(us,{children:['Are you sure you want to delete "',h==null?void 0:h.title,'"? This action cannot be undone.']})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:ae,children:"Delete"})]})]})})]})}function VNe({title:t,setTitle:e,description:n,setDescription:s,imageUrl:i,linkUrl:o,setLinkUrl:c,linkText:a,setLinkText:h,placement:m,setPlacement:x,sectionAfter:v,setSectionAfter:w,isActive:k,setIsActive:C,startDate:S,setStartDate:T,endDate:I,setEndDate:A,handleImageUpload:D,uploading:$,showPlacementOptions:F}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",placeholder:"Banner headline...",value:t,onChange:q=>e(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",placeholder:"Optional banner description...",value:n,onChange:q=>s(q.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(xt,{type:"file",accept:"image/*",onChange:D,disabled:$,className:"flex-1"}),$&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),i&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:i,alt:"Preview",className:"w-full h-40 object-cover"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(xt,{id:"linkUrl",placeholder:"https://...",value:o,onChange:q=>c(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"linkText",children:"Button Text"}),r.jsx(xt,{id:"linkText",placeholder:"Learn More",value:a,onChange:q=>h(q.target.value)})]})]}),F&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Placement"}),r.jsxs(_n,{value:v,onValueChange:w,children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select section placement..."})}),r.jsx(vn,{children:oze.map(q=>r.jsx(tr,{value:q.value,children:q.label},q.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(xt,{id:"startDate",type:"datetime-local",value:S,onChange:q=>T(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(xt,{id:"endDate",type:"datetime-local",value:I,onChange:q=>A(q.target.value)})]})]}),r.jsx("div",{className:"flex items-center justify-between pt-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"isActive",checked:k,onCheckedChange:C}),r.jsx(Xe,{htmlFor:"isActive",children:"Active"})]})})]})}function HNe({banner:t,onEdit:e,onDelete:n,onToggleActive:s,showSection:i=!1}){var c;const o=(c=oze.find(a=>a.value===t.section_after))==null?void 0:c.label;return r.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors",children:[r.jsx(GS,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),r.jsx("img",{src:t.image_url,alt:t.title,className:"w-24 h-14 object-cover rounded"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"font-medium truncate",children:t.title}),!t.is_active&&r.jsx(Ft,{variant:"secondary",children:"Inactive"}),t.start_date&&new Date(t.start_date)>new Date&&r.jsx(Ft,{variant:"outline",children:"Scheduled"})]}),t.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.description}),i&&o&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.link_url&&r.jsx("a",{href:t.link_url,target:"_blank",rel:"noopener noreferrer",children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx($s,{className:"h-4 w-4"})})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:s,children:t.is_active?r.jsx(Al,{className:"h-4 w-4"}):r.jsx(Qw,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:e,children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})]})}const CL={open:{label:"Open",icon:Gi,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Wl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Ba,color:"bg-green-500"},closed:{label:"Closed",icon:Oc,color:"bg-muted-foreground"}},WNe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function wbt(){var q,W;const{user:t}=zr(),e=Qr(),[n,s]=P.useState(null),[i,o]=P.useState(""),[c,a]=P.useState("all"),[h,m]=P.useState("all"),[x,v]=P.useState(!1),{data:w=[],isLoading:k}=rr({queryKey:["admin-support-tickets",c,h],queryFn:async()=>{let K=ee.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});c!=="all"&&(K=K.eq("status",c)),h!=="all"&&(K=K.eq("category",h));const{data:Z,error:re}=await K;if(re)throw re;return Z}}),{data:C=[]}=rr({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("user_roles").select("user_id").eq("role","admin");if(Z)throw Z;const re=K.map(ie=>ie.user_id),{data:he,error:ue}=await ee.from("profiles").select("id, name, email").in("id",re);if(ue)throw ue;const{data:je,error:ne}=await ee.from("support_notification_settings").select("user_id, receive_notifications");if(ne)throw ne;const ye=new Map((je==null?void 0:je.map(ie=>[ie.user_id,ie.receive_notifications]))||[]);return he.map(ie=>({...ie,receives_notifications:ye.get(ie.id)||!1}))}}),{data:S=[]}=rr({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:K,error:Z}=await ee.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(Z)throw Z;return K},enabled:!!n}),T=dr({mutationFn:async({userId:K,enabled:Z})=>{const{data:re}=await ee.from("support_notification_settings").select("id").eq("user_id",K).maybeSingle();if(re){const{error:he}=await ee.from("support_notification_settings").update({receive_notifications:Z}).eq("user_id",K);if(he)throw he}else{const{error:he}=await ee.from("support_notification_settings").insert({user_id:K,receive_notifications:Z});if(he)throw he}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-users-notifications"]}),He.success("Notification settings updated")},onError:()=>{He.error("Failed to update settings")}}),I=dr({mutationFn:async({ticketId:K,status:Z})=>{const{error:re}=await ee.from("support_tickets").update({status:Z}).eq("id",K);if(re)throw re},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),He.success("Status updated")},onError:()=>{He.error("Failed to update status")}}),A=dr({mutationFn:async({ticketId:K,assignedTo:Z})=>{const{error:re}=await ee.from("support_tickets").update({assigned_to:Z}).eq("id",K);if(re)throw re},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),He.success("Ticket assigned")},onError:()=>{He.error("Failed to assign ticket")}}),D=dr({mutationFn:async K=>{var re,he;if(!n||!t)throw new Error("Missing data");const{error:Z}=await ee.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:K,is_admin_reply:!0});if(Z)throw Z;try{await ee.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:K,userEmail:(re=n.profiles)==null?void 0:re.email,userName:(he=n.profiles)==null?void 0:he.name}})}catch(ue){console.error("Failed to send reply notification:",ue)}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),He.success("Reply sent!")},onError:()=>{He.error("Failed to send reply")}}),$=()=>{i.trim()&&D.mutate(i)};P.useEffect(()=>{const K=ee.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{ee.removeChannel(K)}},[e]);const F=w.filter(K=>K.status==="open").length;return n?(CL[n.status].icon,r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Ga,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ft,{variant:"secondary",children:WNe[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((q=n.profiles)==null?void 0:q.name)||"Unknown"," (",(W=n.profiles)==null?void 0:W.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm",children:"Status"})}),r.jsx(et,{children:r.jsxs(_n,{value:n.status,onValueChange:K=>{I.mutate({ticketId:n.id,status:K}),s({...n,status:K})},children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"open",children:"Open"}),r.jsx(tr,{value:"in_progress",children:"In Progress"}),r.jsx(tr,{value:"resolved",children:"Resolved"}),r.jsx(tr,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm",children:"Assigned To"})}),r.jsx(et,{children:r.jsxs(_n,{value:n.assigned_to||"unassigned",onValueChange:K=>{const Z=K==="unassigned"?null:K;A.mutate({ticketId:n.id,assignedTo:Z}),s({...n,assigned_to:Z})},children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Unassigned"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"unassigned",children:"Unassigned"}),C.map(K=>r.jsx(tr,{value:K.id,children:K.name},K.id))]})]})})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(In,{children:["Created on ",un(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(_l,{className:"h-[300px] pr-4",children:S.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:S.map(K=>{var Z,re;return r.jsxs("div",{className:`p-4 rounded-lg ${K.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:K.is_admin_reply?`${((Z=K.profiles)==null?void 0:Z.name)||"Admin"} (Support)`:((re=K.profiles)==null?void 0:re.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(K.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:K.content})]},K.id)})})}),r.jsx(Gd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(gs,{placeholder:"Type your reply...",value:i,onChange:K=>o(K.target.value),className:"min-h-[80px]"}),r.jsx(te,{onClick:$,disabled:!i.trim()||D.isPending,className:"self-end",children:r.jsx(To,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Support Tickets"}),r.jsxs("p",{className:"text-muted-foreground",children:["Manage support requests from agents",F>0&&r.jsxs(Ft,{variant:"destructive",className:"ml-2",children:[F," open"]})]})]}),r.jsxs(Ur,{open:x,onOpenChange:v,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(od,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Email Notification Settings"}),r.jsx(us,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:C.map(K=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:K.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:K.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[K.receives_notifications?r.jsx(dg,{className:"h-4 w-4 text-primary"}):r.jsx(Ww,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Js,{checked:K.receives_notifications,onCheckedChange:Z=>T.mutate({userId:K.id,enabled:Z})})]})]},K.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(Oa,{value:c,onValueChange:a,className:"w-auto",children:r.jsxs(Ta,{children:[r.jsx(xn,{value:"all",children:"All"}),r.jsx(xn,{value:"open",children:"Open"}),r.jsx(xn,{value:"in_progress",children:"In Progress"}),r.jsx(xn,{value:"resolved",children:"Resolved"}),r.jsx(xn,{value:"closed",children:"Closed"})]})}),r.jsxs(_n,{value:h,onValueChange:m,children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"All Categories"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Categories"}),r.jsx(tr,{value:"general",children:"General Support"}),r.jsx(tr,{value:"technology",children:"Technology Support"}),r.jsx(tr,{value:"crm",children:"CRM Support"}),r.jsx(tr,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:k?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):w.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Wl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):r.jsx("div",{className:"space-y-3",children:w.map(K=>{var re,he;const Z=CL[K.status].icon;return r.jsx(Ze,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(K),children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:K.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Ft,{variant:"outline",className:"text-xs",children:WNe[K.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(re=K.profiles)==null?void 0:re.name," • ",un(new Date(K.created_at),"MMM d, yyyy")]}),K.assigned_to&&r.jsxs(Ft,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(jc,{className:"h-3 w-3"}),((he=C.find(ue=>ue.id===K.assigned_to))==null?void 0:he.name)||"Assigned"]})]})]}),r.jsxs(Ft,{className:CL[K.status].color,children:[r.jsx(Z,{className:"h-3 w-3 mr-1"}),CL[K.status].label]})]})})},K.id)})})})]})]})})}const jbt=Id.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function kbt({content:t,onChange:e,variables:n}){const s=$Fe({extensions:[GFe,nze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),sze.configure({types:["heading","paragraph"]}),ize,jbt],content:t,onUpdate:({editor:c})=>{e(c.getHTML())}});P.useEffect(()=>{s&&t!==s.getHTML()&&s.commands.setContent(t)},[t,s]);const i=c=>{s&&s.chain().focus().insertContent(`{{${c.key}}}`).run()},o=()=>{if(!s)return;const c=s.getAttributes("link").href,a=window.prompt("URL",c);if(a!==null){if(a===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:a}).run()}};return s?r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b bg-muted/30",children:[r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(qS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(XS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx($f,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(t4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx($S,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(BS,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(US,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(bo,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(Yw,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(c4,{className:"h-4 w-4"})}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(o4,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(HT,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(ep,{align:"end",className:"w-64",children:n.map(c=>r.jsxs(co,{onClick:()=>i(c),className:"flex flex-col items-start",children:[r.jsx("span",{className:"font-medium",children:c.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${c.key}}}`}),c.description&&r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:c.description})]},c.key))})]})]}),r.jsx(zFe,{editor:s,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),n.length>0&&r.jsxs("div",{className:"border-t p-3 bg-muted/20",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available variables (click to copy):"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(c=>r.jsx(Ft,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 font-mono text-xs",onClick:()=>{navigator.clipboard.writeText(`{{${c.key}}}`)},children:`{{${c.key}}}`},c.key))})]})]}):null}function Nbt(){const t=Qr(),[e,n]=P.useState(null),[s,i]=P.useState(null),[o,c]=P.useState(""),[a,h]=P.useState(""),[m,x]=P.useState(""),[v,w]=P.useState(!0),[k,C]=P.useState("visual"),{data:S,isLoading:T}=rr({queryKey:["email-templates"],queryFn:async()=>{const{data:F,error:q}=await ee.from("email_templates").select("*").order("name");if(q)throw q;return F.map(W=>({...W,available_variables:W.available_variables||[]}))}}),I=dr({mutationFn:async F=>{const{error:q}=await ee.from("email_templates").update({subject:F.subject,body_html:F.body_html,description:F.description,is_active:F.is_active}).eq("id",F.id);if(q)throw q},onSuccess:()=>{t.invalidateQueries({queryKey:["email-templates"]}),He.success("Email template updated successfully"),n(null)},onError:F=>{He.error("Failed to update template: "+F.message)}}),A=F=>{n(F),c(F.subject),h(F.body_html),x(F.description||""),w(F.is_active),C("visual")},D=()=>{e&&I.mutate({id:e.id,subject:o,body_html:a,description:m,is_active:v})},$=(F,q)=>{let W=F;return q.forEach(K=>{const Z=`{{${K.key}}}`,re=`[${K.label}]`;W=W.replace(new RegExp(Z.replace(/[{}]/g,"\\$&"),"g"),re)}),W};return e?r.jsxs(Dr,{title:"Edit Email Template",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(te,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(te,{variant:"outline",onClick:()=>i(e),children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(te,{onClick:D,disabled:I.isPending,children:[r.jsx(hg,{className:"h-4 w-4 mr-2"}),I.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(oi,{className:"h-5 w-5"}),e.name]}),r.jsxs(In,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:e.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xe,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Js,{id:"active-toggle",checked:v,onCheckedChange:w})]})]})}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",value:m,onChange:F=>x(F.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"subject",children:"Email Subject"}),r.jsx(xt,{id:"subject",value:o,onChange:F=>c(F.target.value),placeholder:"Email subject line"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{children:"Email Body"}),r.jsx(Oa,{value:k,onValueChange:F=>C(F),children:r.jsxs(Ta,{className:"h-8",children:[r.jsxs(xn,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(i4,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(xn,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(Yw,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),k==="visual"?r.jsx(kbt,{content:a,onChange:h,variables:e.available_variables}):r.jsx(gs,{value:a,onChange:F=>h(F.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Ur,{open:!!s,onOpenChange:()=>i(null),children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Email Preview"}),r.jsxs(us,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:$(a,e.available_variables)}})})]})})]}):r.jsx(Dr,{title:"Email Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),T?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((F,q)=>r.jsx(Ze,{children:r.jsxs(Wt,{children:[r.jsx(Kr,{className:"h-5 w-48"}),r.jsx(Kr,{className:"h-4 w-96"})]})},q))}):r.jsx("div",{className:"grid gap-4",children:S==null?void 0:S.map(F=>r.jsxs(Ze,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Xt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(oi,{className:"h-5 w-5 text-muted-foreground"}),F.name,!F.is_active&&r.jsx(Ft,{variant:"secondary",children:"Inactive"})]}),r.jsx(In,{children:F.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>i(F),children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(te,{size:"sm",onClick:()=>A(F),children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:F.subject})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:F.available_variables.map(q=>r.jsx(Ft,{variant:"outline",className:"font-mono text-xs",children:`{{${q.key}}}`},q.key))})]})]})})]},F.id))}),r.jsx(Ur,{open:!!s&&!e,onOpenChange:()=>i(null),children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(us,{children:["Subject: ",s==null?void 0:s.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),s&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:$(s.body_html,s.available_variables)}})})]})})]})})}const Sbt=({brokerageId:t})=>{var po,Od;const{toast:e}=ua(),[n,s]=P.useState([]),[i,o]=P.useState(!0),[c,a]=P.useState(""),[h,m]=P.useState("all"),[x,v]=P.useState(new Set),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState({email:"",name:"",password:"",phone:""}),[$,F]=P.useState(!1),[q,W]=P.useState(null),[K,Z]=P.useState(!1),[re,he]=P.useState(!1),[ue,je]=P.useState(!1),[ne,ye]=P.useState(""),[ie,me]=P.useState(!1),[fe,ve]=P.useState([]),[Ie,Se]=P.useState(!1),[oe,ae]=P.useState(!1),[Ne,Te]=P.useState(null),[Be,Le]=P.useState({name:"",phone:"",email:""}),[Qe,Fe]=P.useState(!1),[Ce,Je]=P.useState(!1),[Ae,Ye]=P.useState(null),[ge,ft]=P.useState("asc"),[nt,Ve]=P.useState(!1),[Me,rt]=P.useState(null),[Re,Ge]=P.useState(!1),[tt,Et]=P.useState(null),[Lt,Ot]=P.useState(""),[Dt,kt]=P.useState(!1),[sr,Pr]=P.useState(null);P.useEffect(()=>{kn(),wn()},[t]);const wn=async()=>{try{const{data:vr,error:Vn}=await ee.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",t);if(Vn)throw Vn;ve((vr==null?void 0:vr.map(bt=>bt.user_id))||[])}catch(vr){console.error("Error loading brokerage managers:",vr)}},kn=async()=>{try{o(!0);const{data:vr,error:Vn}=await ee.functions.invoke("get-brokerage-agents",{body:{brokerageId:t}});if(Vn)throw Vn;s(vr.agents||[])}catch(vr){console.error("Error loading agents:",vr),e({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},pn=async()=>{if(!A.email||!A.name||!A.password){e({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}I(!0);try{const{data:{session:vr}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vr==null?void 0:vr.access_token}`},body:JSON.stringify({...A,brokerageId:t})}),bt=await Vn.json();if(!Vn.ok)throw new Error(bt.error||"Failed to create agent");e({title:"Success",description:`Agent ${A.email} created successfully`}),D({email:"",name:"",password:"",phone:""}),S(!1),kn()}catch(vr){console.error("Error creating agent:",vr),e({title:"Error",description:vr.message||"Failed to create agent",variant:"destructive"})}finally{I(!1)}},qn=async vr=>{try{const{data:{session:Vn}}=await ee.auth.getSession(),bt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vn==null?void 0:Vn.access_token}`},body:JSON.stringify({userId:vr})}),_e=await bt.json();if(!bt.ok)throw new Error(_e.error||"Failed to resend welcome email");e({title:"Success",description:"Welcome email sent successfully"})}catch(Vn){console.error("Error resending welcome email:",Vn),e({title:"Error",description:Vn.message||"Failed to resend welcome email",variant:"destructive"})}},Fs=async(vr,Vn)=>{try{const{error:bt}=await ee.functions.invoke("send-password-reset",{body:{email:vr,redirectTo:window.location.origin}});if(bt)throw bt;e({title:"Password Reset Sent",description:`Password reset email sent to ${Vn}`})}catch(bt){console.error("Error sending password reset:",bt),e({title:"Error",description:bt.message||"Failed to send password reset email",variant:"destructive"})}},_r=vr=>{W(vr),F(!0)},js=vr=>{Te(vr),Le({name:vr.name,phone:vr.phone||"",email:vr.email}),ae(!0)},Ii=async()=>{if(!Ne)return;if(!Be.name.trim()){e({title:"Error",description:"Name is required",variant:"destructive"});return}const vr=Be.email.trim().toLowerCase()!==Ne.email.toLowerCase();Fe(!0);try{if(vr){if(!Be.email.trim())throw new Error("Email is required");Je(!0);const{data:{session:bt}}=await ee.auth.getSession(),_e=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${bt==null?void 0:bt.access_token}`},body:JSON.stringify({agentId:Ne.id,newEmail:Be.email.trim(),brokerageId:t})}),De=await _e.json();if(Je(!1),!_e.ok)throw new Error(De.error||"Failed to update email")}const{error:Vn}=await ee.from("profiles").update({name:Be.name.trim(),phone:Be.phone.trim()||null}).eq("id",Ne.id);if(Vn)throw Vn;e({title:"Success",description:"Agent profile updated successfully"}),ae(!1),Te(null),kn()}catch(Vn){console.error("Error updating agent:",Vn),e({title:"Error",description:Vn.message||"Failed to update agent",variant:"destructive"})}finally{Fe(!1),Je(!1)}},fi=async()=>{if(!ne){e({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}me(!0);try{const{data:{session:vr}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vr==null?void 0:vr.access_token}`},body:JSON.stringify({userId:ne,role:"brokerage_manager",action:"add",brokerageId:t})}),bt=await Vn.json();if(!Vn.ok)throw new Error(bt.error||"Failed to add brokerage manager");e({title:"Success",description:"Brokerage manager added successfully"}),je(!1),ye(""),wn()}catch(vr){console.error("Error adding brokerage manager:",vr),e({title:"Error",description:vr.message||"Failed to add brokerage manager",variant:"destructive"})}finally{me(!1)}},Aa=async vr=>{try{const{data:{session:Vn}}=await ee.auth.getSession(),bt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vn==null?void 0:Vn.access_token}`},body:JSON.stringify({userId:vr,role:"brokerage_manager",action:"remove",brokerageId:t})}),_e=await bt.json();if(!bt.ok)throw new Error(_e.error||"Failed to remove brokerage manager");e({title:"Success",description:"Brokerage manager role removed"}),wn()}catch(Vn){console.error("Error removing brokerage manager:",Vn),e({title:"Error",description:Vn.message||"Failed to remove brokerage manager",variant:"destructive"})}},ca=vr=>fe.includes(vr),Yo=vr=>{Et(vr),Ot(""),Ge(!0)},Xo=async()=>{if(!(!tt||!Lt)){if(Lt.length<6){e({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}kt(!0);try{const{data:{session:vr}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vr==null?void 0:vr.access_token}`},body:JSON.stringify({agentId:tt.id,brokerageId:t,action:"set_password",newPassword:Lt})}),bt=await Vn.json();if(!Vn.ok)throw new Error(bt.error||"Failed to set password");e({title:"Success",description:`Password set for ${tt.name}`}),Ge(!1),Et(null),Ot("")}catch(vr){console.error("Error setting password:",vr),e({title:"Error",description:vr.message||"Failed to set password",variant:"destructive"})}finally{kt(!1)}}},Hs=async vr=>{Pr(vr.id);try{const{data:{session:Vn}}=await ee.auth.getSession(),bt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vn==null?void 0:Vn.access_token}`},body:JSON.stringify({agentId:vr.id,brokerageId:t,action:"claim_account"})}),_e=await bt.json();if(!bt.ok)throw new Error(_e.error||"Failed to claim account");e({title:"Success",description:`Account claimed for ${vr.name}`}),kn()}catch(Vn){console.error("Error claiming account:",Vn),e({title:"Error",description:Vn.message||"Failed to claim account",variant:"destructive"})}finally{Pr(null)}},Ki=async()=>{if(q){Z(!0);try{const{data:{session:vr}}=await ee.auth.getSession(),Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vr==null?void 0:vr.access_token}`},body:JSON.stringify({userId:q.id,brokerageId:t})}),bt=await Vn.json();if(!Vn.ok)throw new Error(bt.error||"Failed to remove agent");e({title:"Success",description:`${q.name} has been removed from your brokerage`}),F(!1),W(null),kn()}catch(vr){console.error("Error removing agent:",vr),e({title:"Error",description:vr.message||"Failed to remove agent",variant:"destructive"})}finally{Z(!1)}}},bs=vr=>{const Vn=vr.trim().split(" ");return Vn.length>1?Vn[Vn.length-1].toLowerCase():vr.toLowerCase()},Ci=vr=>{Ae===vr?ft(ge==="asc"?"desc":"asc"):(Ye(vr),ft("asc"))},Mi=vr=>Ae!==vr?r.jsx(Ex,{className:"ml-1 h-4 w-4"}):ge==="asc"?r.jsx(Ix,{className:"ml-1 h-4 w-4"}):r.jsx(Hw,{className:"ml-1 h-4 w-4"}),Eo=n.filter(vr=>{if(h==="active"&&!vr.claimed||h==="pending"&&vr.claimed)return!1;if(!c)return!0;const Vn=c.toLowerCase();return vr.name.toLowerCase().includes(Vn)||vr.email.toLowerCase().includes(Vn)}),ir=[...Eo].sort((vr,Vn)=>{if(!Ae)return 0;let bt=0;return Ae==="name"?bt=bs(vr.name).localeCompare(bs(Vn.name)):Ae==="status"&&(bt=vr.claimed===Vn.claimed?0:vr.claimed?-1:1),ge==="asc"?bt:-bt});Eo.filter(vr=>vr.claimed&&!ca(vr.id));const ho=vr=>{v(Vn=>{const bt=new Set(Vn);return bt.has(vr)?bt.delete(vr):bt.add(vr),bt})},Nc=()=>{x.size===ir.length?v(new Set):v(new Set(ir.map(vr=>vr.id)))},fo=()=>{v(new Set)},rs=async()=>{const vr=Array.from(x);if(vr.length===0)return;k(!0);let Vn=0,bt=0;try{const{data:{session:_e}}=await ee.auth.getSession();for(const De of vr)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_e==null?void 0:_e.access_token}`},body:JSON.stringify({userId:De})})).ok?Vn++:bt++}catch{bt++}Vn>0?e({title:"Success",description:`Welcome emails sent to ${Vn} agent${Vn>1?"s":""}${bt>0?` (${bt} failed)`:""}`}):e({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),fo()}catch(_e){console.error("Error bulk sending welcome emails:",_e),e({title:"Error",description:_e.message||"Failed to send welcome emails",variant:"destructive"})}finally{k(!1)}};return i?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Agents"}),r.jsx(In,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>je(!0),children:[r.jsx(lm,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(te,{variant:"outline",onClick:()=>he(!0),children:[r.jsx(J0,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(te,{onClick:()=>S(!0),children:[r.jsx(d1,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(et,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search agents...",value:c,onChange:vr=>a(vr.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:h,onValueChange:vr=>m(vr),children:[r.jsx(yn,{className:"w-[160px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Agents"}),r.jsx(tr,{value:"active",children:"Active"}),r.jsx(tr,{value:"pending",children:"Pending"})]})]})]}),x.size>0&&r.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[r.jsxs("span",{className:"text-sm font-medium",children:[x.size," agent",x.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(te,{size:"sm",variant:"outline",onClick:rs,disabled:w,children:[r.jsx(oi,{className:"mr-2 h-4 w-4"}),w?"Sending...":"Resend Welcome Email"]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:fo,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(vc,{checked:ir.length>0&&x.size===ir.length,onCheckedChange:Nc,"aria-label":"Select all"})}),r.jsx(Mt,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ci("name"),children:["Name (Last)",Mi("name")]})}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:r.jsxs(te,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ci("status"),children:["Status",Mi("status")]})}),r.jsx(Mt,{children:"Actions"})]})}),r.jsx(Vs,{children:ir.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):ir.map(vr=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsx(vc,{checked:x.has(vr.id),onCheckedChange:()=>ho(vr.id),"aria-label":`Select ${vr.name}`})}),r.jsx(yt,{className:"font-medium",children:vr.name}),r.jsx(yt,{children:vr.email}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[vr.claimed?r.jsx(Ft,{variant:"default",children:"Active"}):r.jsx(Ft,{variant:"secondary",children:"Pending"}),ca(vr.id)&&r.jsxs(Ft,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(RT,{className:"mr-1 h-3 w-3"}),"Manager"]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{rt(vr),Ve(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(bc,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>js(vr),title:"Edit agent",children:r.jsx(ya,{className:"h-4 w-4"})}),!vr.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>qn(vr.id),title:"Resend welcome email",children:r.jsx(oi,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Hs(vr),title:"Claim account for agent",disabled:sr===vr.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(oj,{className:"h-4 w-4"})})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Yo(vr),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(Uf,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Fs(vr.email,vr.name),title:"Send password reset email",children:r.jsx(nj,{className:"h-4 w-4"})}),ca(vr.id)&&r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Aa(vr.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(lm,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>_r(vr),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(es,{className:"h-4 w-4"})})]})})]},vr.id))})]})})]})]}),r.jsx(Ur,{open:C,onOpenChange:S,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Add New Agent"}),r.jsx(us,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",value:A.name,onChange:vr=>D({...A,name:vr.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"email",children:"Email"}),r.jsx(xt,{id:"email",type:"email",value:A.email,onChange:vr=>D({...A,email:vr.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(xt,{id:"phone",type:"tel",value:A.phone,onChange:vr=>D({...A,phone:vr.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"password",children:"Temporary Password"}),r.jsx(xt,{id:"password",type:"password",value:A.password,onChange:vr=>D({...A,password:vr.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(te,{onClick:pn,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Ur,{open:$,onOpenChange:F,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Remove Agent"}),r.jsxs(us,{children:["Are you sure you want to remove ",r.jsx("strong",{children:q==null?void 0:q.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Ki,disabled:K,children:K?"Removing...":"Remove Agent"})]})]})}),r.jsx(XDe,{open:re,onOpenChange:he,fixedBrokerageId:t,onSuccess:kn}),r.jsx(Ur,{open:ue,onOpenChange:je,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Add Brokerage Manager"}),r.jsx(us,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(Xe,{children:"Select Agent"}),r.jsxs(Jh,{open:Ie,onOpenChange:Se,children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":Ie,className:"w-full justify-between",children:[ne?((po=n.find(vr=>vr.id===ne))==null?void 0:po.name)+" ("+((Od=n.find(vr=>vr.id===ne))==null?void 0:Od.email)+")":"Select an agent to promote...",r.jsx(Zw,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(gh,{className:"w-full p-0",align:"start",children:r.jsxs(Mj,{children:[r.jsx(Tj,{placeholder:"Search by name or email..."}),r.jsxs(Aj,{className:"max-h-[200px]",children:[r.jsx(Ej,{children:"No eligible agents found."}),r.jsx(Ij,{children:n.filter(vr=>!ca(vr.id)).map(vr=>r.jsxs(Pj,{value:`${vr.name} ${vr.email}`,onSelect:()=>{ye(vr.id),Se(!1)},children:[r.jsx($a,{className:`mr-2 h-4 w-4 ${ne===vr.id?"opacity-100":"opacity-0"}`}),vr.name," (",vr.email,")"]},vr.id))})]})]})})]}),n.filter(vr=>!ca(vr.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>je(!1),children:"Cancel"}),r.jsx(te,{onClick:fi,disabled:ie||!ne,children:ie?"Adding...":"Add as Manager"})]})]})}),r.jsx(Ur,{open:oe,onOpenChange:ae,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Edit Agent"}),r.jsxs(us,{children:["Update profile information for ",Ne==null?void 0:Ne.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"edit-name",children:"Name"}),r.jsx(xt,{id:"edit-name",value:Be.name,onChange:vr=>Le({...Be,name:vr.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"edit-email",children:"Email"}),r.jsx(xt,{id:"edit-email",type:"email",value:Be.email,onChange:vr=>Le({...Be,email:vr.target.value}),placeholder:"agent@example.com"}),Be.email.trim().toLowerCase()!==(Ne==null?void 0:Ne.email.toLowerCase())&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(xt,{id:"edit-phone",type:"tel",value:Be.phone,onChange:vr=>Le({...Be,phone:vr.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>ae(!1),children:"Cancel"}),r.jsx(te,{onClick:Ii,disabled:Qe||Ce,children:Ce?"Updating email...":Qe?"Saving...":"Save Changes"})]})]})}),Me&&r.jsx(QDe,{open:nt,onOpenChange:vr=>{Ve(vr),vr||rt(null)},userId:Me.id,userName:Me.name}),r.jsx(Ur,{open:Re,onOpenChange:Ge,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Set Password"}),r.jsxs(us,{children:["Set a new password for ",tt==null?void 0:tt.name,". They will be able to log in with this password immediately."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"new-password",children:"New Password"}),r.jsx(xt,{id:"new-password",type:"password",value:Lt,onChange:vr=>Ot(vr.target.value),placeholder:"Enter new password (min 6 characters)"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Make sure to communicate this password to the agent through a secure channel."})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>Ge(!1),children:"Cancel"}),r.jsx(te,{onClick:Xo,disabled:Dt||!Lt||Lt.length<6,children:Dt?"Setting...":"Set Password"})]})]})})]})},Cbt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},Mbt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},Tbt=t=>{switch(t){case"academy_video":return r.jsx(Wi,{className:"h-4 w-4"});case"template":return r.jsx(Si,{className:"h-4 w-4"});case"toolbox":return r.jsx(Si,{className:"h-4 w-4"});case"newsletter":return r.jsx(Dx,{className:"h-4 w-4"});case"social_swag":return r.jsx(As,{className:"h-4 w-4"});case"event":return r.jsx(li,{className:"h-4 w-4"});default:return r.jsx($s,{className:"h-4 w-4"})}},Abt=({brokerageId:t})=>{const{toast:e}=ua(),[n,s]=P.useState([]),[i,o]=P.useState([]),[c,a]=P.useState([]),[h,m]=P.useState(!0),[x,v]=P.useState(null);P.useEffect(()=>{w()},[t]);const w=async()=>{try{m(!0);const{data:S,error:T}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",t);if(T)throw T;const I=S.map(he=>he.id),A=new Map(S.map(he=>[he.id,he]));if(I.length===0){s([]),o([]),a([]);return}const{data:D,error:$}=await ee.from("activity_logs").select("*").in("user_id",I).order("launched_at",{ascending:!1});if($)throw $;const F=D.map(he=>{var ue,je;return{id:he.id,user_id:he.user_id,app_name:he.app_name,launched_at:he.launched_at,user_name:((ue=A.get(he.user_id))==null?void 0:ue.name)||"Unknown",user_email:((je=A.get(he.user_id))==null?void 0:je.email)||"Unknown"}});s(F);const{data:q,error:W}=await ee.from("content_engagement_logs").select("*").in("user_id",I).order("created_at",{ascending:!1});if(W)throw W;const K=(q||[]).map(he=>{var ue,je;return{id:he.id,user_id:he.user_id,resource_type:he.resource_type,resource_id:he.resource_id,resource_title:he.resource_title,action_type:he.action_type,created_at:he.created_at,user_name:((ue=A.get(he.user_id))==null?void 0:ue.name)||"Unknown",user_email:((je=A.get(he.user_id))==null?void 0:je.email)||"Unknown"}});o(K);const Z=new Map;S.forEach(he=>{Z.set(he.id,{user_id:he.id,user_name:he.name,user_email:he.email,app_launches:0,content_views:0,last_activity:""})}),F.forEach(he=>{const ue=Z.get(he.user_id);ue&&(ue.app_launches++,(!ue.last_activity||new Date(he.launched_at)>new Date(ue.last_activity))&&(ue.last_activity=he.launched_at))}),K.forEach(he=>{const ue=Z.get(he.user_id);ue&&(ue.content_views++,(!ue.last_activity||new Date(he.created_at)>new Date(ue.last_activity))&&(ue.last_activity=he.created_at))});const re=Array.from(Z.values()).filter(he=>he.app_launches>0||he.content_views>0).sort((he,ue)=>new Date(ue.last_activity).getTime()-new Date(he.last_activity).getTime());a(re)}catch(S){console.error("Error loading activity:",S),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{m(!1)}},k=S=>n.filter(T=>T.user_id===S),C=S=>i.filter(T=>T.user_id===S);return h?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Agent Activity"}),r.jsx(In,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(et,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{className:"text-center",children:"App Launches"}),r.jsx(Mt,{className:"text-center",children:"Content Views"}),r.jsx(Mt,{children:"Last Active"})]})}),r.jsx(Vs,{children:c.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):c.map(S=>r.jsxs(Er,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>v({id:S.user_id,name:S.user_name,email:S.user_email}),children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:S.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:S.user_email})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(wc,{className:"h-3 w-3"}),S.app_launches]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Si,{className:"h-3 w-3"}),S.content_views]})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:S.last_activity&&Qd(new Date(S.last_activity),{addSuffix:!0})})]},S.user_id))})]})})})]}),r.jsx(Ur,{open:!!x,onOpenChange:S=>!S&&v(null),children:r.jsxs(Br,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(us,{children:x==null?void 0:x.email})]}),r.jsxs(Oa,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-2",children:[r.jsx(xn,{value:"content",children:"Content Engagement"}),r.jsx(xn,{value:"apps",children:"App Launches"})]}),r.jsx(Un,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Vs,{children:x&&C(x.id).length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&C(x.id).map(S=>r.jsxs(Er,{children:[r.jsx(yt,{className:"max-w-[200px] truncate font-medium",children:S.resource_title}),r.jsx(yt,{children:r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[Tbt(S.resource_type),Cbt[S.resource_type]||S.resource_type]})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:Mbt[S.action_type]||S.action_type})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:Qd(new Date(S.created_at),{addSuffix:!0})})]},S.id))})]})})}),r.jsx(Un,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Vs,{children:x&&k(x.id).length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&k(x.id).map(S=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",children:S.app_name})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:Qd(new Date(S.launched_at),{addSuffix:!0})})]},S.id))})]})})})]})]})})]})},Ebt=({brokerageId:t})=>{const{toast:e}=ua(),[n,s]=P.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[i,o]=P.useState(!0);P.useEffect(()=>{c()},[t]);const c=async()=>{try{o(!0);const{data:a,error:h}=await ee.from("profiles").select("id").eq("brokerage_id",t);if(h)throw h;const m=a.map(F=>F.id),x=m.length;if(m.length===0){o(!1);return}const{data:v,error:w}=await ee.from("profiles").select("id, email").in("id",m);if(w)throw w;const{count:k}=await ee.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",t).not("last_login","is",null),C=k||0,S=x-C,{count:T}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m),I=new Date;I.setDate(I.getDate()-7);const{count:A}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",I.toISOString()),D=new Date;D.setMonth(D.getMonth()-1);const{count:$}=await ee.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",D.toISOString());s({totalAgents:x,activeAgents:C,pendingAgents:S,totalLaunches:T||0,launchesThisWeek:A||0,launchesThisMonth:$||0})}catch(a){console.error("Error loading analytics:",a),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return i?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(fs,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.activeAgents," active, ",n.pendingAgents," pending"]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:n.totalAgents>0?`${Math.round(n.activeAgents/n.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(cg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(cg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Xt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(cg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},Ibt=({brokerageId:t})=>{const[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState(!1),[a,h]=P.useState(!1),[m,x]=P.useState({description:"",maxUses:""});P.useEffect(()=>{v()},[t]);const v=async()=>{try{const{data:I,error:A}=await ee.from("invite_codes").select("*").eq("brokerage_id",t).order("created_at",{ascending:!1});if(A)throw A;n(I||[])}catch(I){console.error("Error loading invite codes:",I),He.error("Failed to load invite links")}finally{i(!1)}},w=()=>Math.random().toString(36).substring(2,8).toUpperCase(),k=async()=>{c(!0);try{const I=w(),{error:A}=await ee.from("invite_codes").insert({code:I,description:m.description||null,max_uses:m.maxUses?parseInt(m.maxUses):null,brokerage_id:t,is_active:!0});if(A)throw A;He.success("Invite link created!"),h(!1),x({description:"",maxUses:""}),v()}catch(I){console.error("Error creating invite code:",I),He.error("Failed to create invite link")}finally{c(!1)}},C=async I=>{try{const{error:A}=await ee.from("invite_codes").delete().eq("id",I);if(A)throw A;He.success("Invite link deleted"),n(e.filter(D=>D.id!==I))}catch(A){console.error("Error deleting invite code:",A),He.error("Failed to delete invite link")}},S=async(I,A)=>{try{const{error:D}=await ee.from("invite_codes").update({is_active:!A}).eq("id",I);if(D)throw D;n(e.map($=>$.id===I?{...$,is_active:!A}:$)),He.success(`Invite link ${A?"deactivated":"activated"}`)}catch(D){console.error("Error toggling invite code:",D),He.error("Failed to update invite link")}},T=I=>{const A=`${window.location.origin}/join?code=${I}`;navigator.clipboard.writeText(A),He.success("Link copied to clipboard!")};return s?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(In,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Ur,{open:a,onOpenChange:h,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{size:"sm",children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Create Invite Link"}),r.jsx(us,{children:"Create a new invite link for agents to join your brokerage"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description (optional)"}),r.jsx(xt,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:m.description,onChange:I=>x({...m,description:I.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(xt,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:m.maxUses,onChange:I=>x({...m,maxUses:I.target.value})})]}),r.jsx(te,{onClick:k,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(et,{children:e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(bo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No invite links yet"}),r.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):r.jsx("div",{className:"space-y-3",children:e.map(I=>r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:I.code}),r.jsx(Ft,{variant:I.is_active?"default":"secondary",children:I.is_active?"Active":"Inactive"})]}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:I.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[I.uses_count," uses",I.max_uses&&` / ${I.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>T(I.code),title:"Copy link",children:r.jsx(Vl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>S(I.id,I.is_active),title:I.is_active?"Deactivate":"Activate",children:I.is_active?"Disable":"Enable"}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>C(I.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(es,{className:"h-4 w-4"})})]})]},I.id))})})]})},Pbt=({open:t,onOpenChange:e,referralCode:n,brokerageId:s,senderName:i,brokerageName:o,onInvitesSent:c})=>{const[a,h]=P.useState(""),[m,x]=P.useState([]),[v,w]=P.useState(""),[k,C]=P.useState(!1),S=$=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test($),T=()=>{const $=a.trim().toLowerCase();if($&&S($)&&!m.includes($)){if(m.length>=10){He.error("Maximum 10 emails per invite");return}x([...m,$]),h("")}else $&&!S($)?He.error("Please enter a valid email address"):m.includes($)&&He.error("Email already added")},I=$=>{x(m.filter(F=>F!==$))},A=$=>{($.key==="Enter"||$.key===",")&&($.preventDefault(),T())},D=async()=>{if(m.length===0){He.error("Please add at least one email address");return}C(!0);try{const{data:$,error:F}=await ee.functions.invoke("send-referral-invite",{body:{emails:m,personalMessage:v.trim()||void 0,referralCode:n,brokerageId:s,senderName:i,brokerageName:o}});if(F)throw F;$.successCount===$.totalCount?He.success(`${$.successCount} invite${$.successCount>1?"s":""} sent successfully!`):He.warning(`${$.successCount} of ${$.totalCount} invites sent. Some failed.`),x([]),w(""),e(!1),c==null||c()}catch($){console.error("Error sending invites:",$),He.error("Failed to send invites. Please try again.")}finally{C(!1)}};return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-[550px]",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(oi,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(us,{children:"Send a personalized email invitation to broker owners you know. They'll receive a beautiful email highlighting LevelUp's features."})]}),r.jsxs("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-lg p-4 flex items-center gap-3",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Ua,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:a,onChange:$=>h($.target.value),onKeyDown:A,onBlur:T}),r.jsx(te,{type:"button",variant:"secondary",onClick:T,children:"Add"})]}),m.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:m.map($=>r.jsxs(Ft,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[$,r.jsx("button",{type:"button",onClick:()=>I($),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(Es,{className:"h-3 w-3"})})]},$))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(gs,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:v,onChange:$=>w($.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[v.length,"/500 characters"]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(As,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:D,disabled:m.length===0||k,children:k?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent mr-2"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Send ",m.length>0&&`(${m.length})`," Invite",m.length!==1?"s":""]})})]})]})})},Lbt=({brokerageId:t,refreshTrigger:e})=>{const[n,s]=P.useState([]),[i,o]=P.useState(!0);P.useEffect(()=>{c()},[t,e]);const c=async()=>{try{const{data:h,error:m}=await ee.from("referral_invites").select("*").eq("referrer_brokerage_id",t).order("sent_at",{ascending:!1}).limit(20);if(m)throw m;s(h||[])}catch(h){console.error("Error fetching invites:",h)}finally{o(!1)}},a=h=>{switch(h){case"signed_up":return r.jsxs(Ft,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(Ba,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Ft,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(Oc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Ft,{variant:"secondary",className:"gap-1",children:[r.jsx(Gi,{className:"h-3 w-3"}),"Pending"]})}};return i?r.jsx("div",{className:"flex justify-center py-4",children:r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):n.length===0?r.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[r.jsx(oi,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No invites sent yet"}),r.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),n.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:h.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",un(new Date(h.sent_at),"MMM d, yyyy")]})]}),a(h.status)]},h.id))]})},Obt=()=>{const{brokerageId:t,user:e}=zr(),[n,s]=P.useState(null),[i,o]=P.useState(""),[c,a]=P.useState(""),[h,m]=P.useState([]),[x,v]=P.useState(!0),[w,k]=P.useState(!1),[C,S]=P.useState(0);P.useEffect(()=>{t&&T()},[t]);const T=async()=>{try{const[q,W]=await Promise.all([ee.from("brokerages").select("name").eq("id",t).single(),e?ee.from("profiles").select("name").eq("id",e.id).single():Promise.resolve({data:null})]);q.data&&o(q.data.name),W.data&&a(W.data.name||"A LevelUp Member");const{data:K}=await ee.from("referral_codes").select("code").eq("brokerage_id",t).single();if(K)s(K.code);else{const re=`REF${t==null?void 0:t.slice(0,8).toUpperCase()}`;await ee.from("referral_codes").insert({brokerage_id:t,code:re}),s(re)}const{data:Z}=await ee.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(Z||[])}catch(q){console.error("Error fetching referral data:",q)}finally{v(!1)}},I=()=>{const q=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(q),He.success("Referral link copied to clipboard!")},A=h.filter(q=>q.status==="qualified").length,D=h.filter(q=>q.status==="pending").length,$=A*25,F=Math.max(0,Math.ceil((299-$)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{className:"overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-b",children:r.jsxs("div",{className:"px-6 py-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Ua,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold",children:"Referral Rewards Program"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Earn $25/month off your membership for every broker you refer"})]})]}),r.jsx("div",{className:"mt-4 bg-background/80 rounded-lg p-4 border",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"text-3xl font-bold text-primary",children:["$",$]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),$>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(Ba,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),F>0&&$<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",F," more = ",r.jsx("span",{className:"text-primary",children:"FREE membership!"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your membership could cost $0/month"})]}),$>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(As,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(et,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(te,{onClick:()=>k(!0),className:"w-full",size:"lg",children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(te,{onClick:I,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Copy Referral Link"]})]}),r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Your Referral Link"}),r.jsxs("code",{className:"block px-3 py-2 bg-background rounded border text-sm break-all",children:["https://dashboard.relevelup.com/?ref=",n]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-950/20 rounded-lg border border-green-200 dark:border-green-900",children:[r.jsx(ad,{className:"h-5 w-5 mx-auto text-green-600 mb-1"}),r.jsxs("p",{className:"text-2xl font-bold text-green-700 dark:text-green-400",children:["$",$]}),r.jsx("p",{className:"text-xs text-green-600 dark:text-green-500",children:"Monthly Savings"})]}),r.jsxs("div",{className:"text-center p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsx(fs,{className:"h-5 w-5 mx-auto text-primary mb-1"}),r.jsx("p",{className:"text-2xl font-bold",children:A}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),r.jsxs("div",{className:"text-center p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900",children:[r.jsx(Gi,{className:"h-5 w-5 mx-auto text-amber-600 mb-1"}),r.jsx("p",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:D}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:"Pending (30 days)"})]})]}),r.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[r.jsx("h4",{className:"font-semibold text-sm mb-3",children:"How It Works"}),r.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"1"}),r.jsx("p",{children:"Share your referral link or send an invite email to broker friends"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"2"}),r.jsx("p",{children:"They sign up and subscribe to LevelUp"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"3"}),r.jsx("p",{children:"After 30 days, you get $25/month off your membership - forever!"})]})]})]}),r.jsx(Lbt,{brokerageId:t,refreshTrigger:C}),h.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),h.slice(0,5).map(q=>{var W,K;return r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsx("span",{className:"text-sm truncate",children:((W=q.referred_brokerage)==null?void 0:W.name)||((K=q.referred_user)==null?void 0:K.email)||"Pending setup"}),r.jsxs(Ft,{variant:q.status==="qualified"?"default":q.status==="pending"?"secondary":"destructive",className:q.status==="qualified"?"bg-green-600":"",children:[q.status==="qualified"&&r.jsx(Ba,{className:"h-3 w-3 mr-1"}),q.status]})]},q.id)})]})]})]}),r.jsx(Pbt,{open:w,onOpenChange:k,referralCode:n||"",brokerageId:t||"",senderName:c||"A LevelUp Member",brokerageName:i,onInvitesSent:()=>S(q=>q+1)})]})},Dbt=()=>{const{user:t,isBrokerageManager:e,brokerageId:n,isAdmin:s,managedBrokerages:i,selectedBrokerageId:o,setSelectedBrokerageId:c}=zr(),a=ts(),{toast:h}=ua(),[m,x]=P.useState(""),[v,w]=P.useState(!0),k=o||(i.length>0?i[0].id:n);P.useEffect(()=>{if(!t||!e&&!s){a("/dashboard");return}!o&&i.length>0&&c(i[0].id),k?C():i.length===0&&!n&&w(!1)},[t,e,s,k,a,i,o]);const C=async()=>{if(!k){w(!1);return}try{const{data:S,error:T}=await ee.from("brokerages").select("name").eq("id",k).single();if(T)throw T;x(S.name)}catch(S){console.error("Error loading brokerage info:",S),h({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{w(!1)}};return v?r.jsx(Dr,{title:"Manage Brokerages",description:"Loading brokerage information...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):k?r.jsx(Dr,{title:m||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[i.length>1&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Managing:"}),r.jsxs(_n,{value:o||"",onValueChange:c,children:[r.jsxs(yn,{className:"w-[280px]",children:[r.jsx(na,{className:"mr-2 h-4 w-4"}),r.jsx(bn,{placeholder:"Select brokerage"})]}),r.jsx(vn,{children:i.map(S=>r.jsx(tr,{value:S.id,children:S.name},S.id))})]})]}),r.jsxs(Oa,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(xn,{value:"agents",children:"Agents"}),r.jsx(xn,{value:"invite",children:"Invite Links"}),r.jsx(xn,{value:"referrals",children:"Referrals"}),r.jsx(xn,{value:"leaderboard",children:"Leaderboard"}),r.jsx(xn,{value:"activity",children:"Activity"}),r.jsx(xn,{value:"analytics",children:"Analytics"}),r.jsx(xn,{value:"shares",children:"Shares"})]}),r.jsx(Un,{value:"agents",className:"space-y-4",children:r.jsx(Sbt,{brokerageId:k})}),r.jsx(Un,{value:"invite",className:"space-y-4",children:r.jsx(Ibt,{brokerageId:k})}),r.jsx(Un,{value:"referrals",className:"space-y-4",children:r.jsx(Obt,{})}),r.jsx(Un,{value:"leaderboard",className:"space-y-4",children:r.jsx(X8e,{brokerageId:k,title:`${m} Event Leaderboard`,showUserStats:!1})}),r.jsx(Un,{value:"activity",className:"space-y-4",children:r.jsx(Abt,{brokerageId:k})}),r.jsx(Un,{value:"analytics",className:"space-y-4",children:r.jsx(Ebt,{brokerageId:k})}),r.jsx(Un,{value:"shares",className:"space-y-4",children:r.jsx(aze,{brokerageOnly:!0,brokerageId:k})})]})]})}):r.jsx(Dr,{title:"Manage Brokerages",description:"Brokerage Management",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(na,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You don't have any brokerages to manage."})]})})};function Rbt({brokerageId:t,canManage:e}){const{user:n}=zr(),[s,i]=P.useState([]),[o,c]=P.useState(!0),[a,h]=P.useState(!1),[m,x]=P.useState(null),[v,w]=P.useState(null),[k,C]=P.useState(!1),[S,T]=P.useState(""),[I,A]=P.useState(""),[D,$]=P.useState(!1),F=async()=>{try{const{data:re,error:he}=await ee.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(he)throw he;const ue=re;if(ue&&ue.length>0){const je=[...new Set(ue.map(me=>me.created_by))],{data:ne}=await ee.from("profiles").select("id, name, avatar_url").in("id",je),ye=new Map((ne==null?void 0:ne.map(me=>[me.id,me]))||[]),ie=ue.map(me=>({...me,author:ye.get(me.created_by)||{name:"Unknown",avatar_url:null}}));i(ie)}else i([])}catch(re){console.error("Error fetching announcements:",re)}finally{c(!1)}};P.useEffect(()=>{F()},[t]);const q=()=>{T(""),A(""),$(!1),x(null)},W=re=>{re?(x(re),T(re.title),A(re.content),$(re.is_pinned)):q(),h(!0)},K=async()=>{if(!S.trim()||!I.trim()){He.error("Please fill in all fields");return}C(!0);try{if(m){const{error:re}=await ee.from("brokerage_announcements").update({title:S.trim(),content:I.trim(),is_pinned:D,pinned_at:D?new Date().toISOString():null}).eq("id",m.id);if(re)throw re;He.success("Announcement updated")}else{const{error:re}=await ee.from("brokerage_announcements").insert({brokerage_id:t,created_by:n==null?void 0:n.id,title:S.trim(),content:I.trim(),is_pinned:D,pinned_at:D?new Date().toISOString():null});if(re)throw re;He.success("Announcement created")}h(!1),q(),F()}catch(re){console.error("Error saving announcement:",re),He.error("Failed to save announcement")}finally{C(!1)}},Z=async()=>{if(v)try{const{error:re}=await ee.from("brokerage_announcements").delete().eq("id",v);if(re)throw re;He.success("Announcement deleted"),F()}catch(re){console.error("Error deleting announcement:",re),He.error("Failed to delete announcement")}finally{w(null)}};return o?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(om,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(et,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(om,{className:"h-5 w-5 text-primary"}),"Announcements"]}),e&&r.jsxs(te,{size:"sm",onClick:()=>W(),className:"gap-1",children:[r.jsx(Mn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(et,{children:s.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):r.jsx("div",{className:"space-y-4",children:s.map(re=>{var he,ue,je,ne;return r.jsx("div",{className:`p-4 rounded-lg border ${re.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[re.is_pinned&&r.jsx(i1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:re.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:re.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(Di,{className:"h-5 w-5",children:[r.jsx(Po,{src:((he=re.author)==null?void 0:he.avatar_url)||void 0}),r.jsx(Ri,{className:"text-[10px]",children:((je=(ue=re.author)==null?void 0:ue.name)==null?void 0:je.charAt(0))||"?"})]}),r.jsx("span",{children:(ne=re.author)==null?void 0:ne.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:un(new Date(re.created_at),"MMM d, yyyy")})]})]}),e&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>W(re),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>w(re.id),children:r.jsx(es,{className:"h-4 w-4"})})]})]})},re.id)})})})]}),r.jsx(Ur,{open:a,onOpenChange:h,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:m?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title"}),r.jsx(xt,{id:"title",value:S,onChange:re=>T(re.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"content",children:"Content"}),r.jsx(gs,{id:"content",value:I,onChange:re=>A(re.target.value),placeholder:"Write your announcement...",rows:4})]}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"pinned",checked:D,onCheckedChange:$}),r.jsxs(Xe,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(i1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(te,{onClick:K,disabled:k,children:k?"Saving...":m?"Update":"Create"})]})]})]})}),r.jsx(oh,{open:!!v,onOpenChange:()=>w(null),children:r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Delete Announcement"}),r.jsx(ju,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Fbt({brokerageId:t}){const[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState("");P.useEffect(()=>{(async()=>{try{const{data:m,error:x}=await ee.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(x)throw x;n(m||[])}catch(m){console.error("Error fetching agents:",m)}finally{i(!1)}})()},[t]);const a=e.filter(h=>{var m,x;return h.name.toLowerCase().includes(o.toLowerCase())||h.email.toLowerCase().includes(o.toLowerCase())||((m=h.title)==null?void 0:m.toLowerCase().includes(o.toLowerCase()))||((x=h.areas_served)==null?void 0:x.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(et,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(h=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},h))})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5 text-primary"}),"Agent Roster",r.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",e.length,")"]})]}),r.jsxs("div",{className:"relative w-full sm:w-64",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search agents...",value:o,onChange:h=>c(h.target.value),className:"pl-9"})]})]}),r.jsx(et,{children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o?"No agents match your search":"No agents in this brokerage yet"}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(h=>r.jsx(zbt,{agent:h},h.id))})})]})}function zbt({agent:t}){const e=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[r.jsxs(Di,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Po,{src:t.avatar_url||void 0,alt:t.name}),r.jsx(Ri,{className:"text-lg bg-primary/10 text-primary",children:e})]}),r.jsx("h3",{className:"font-semibold text-sm leading-tight",children:t.name}),t.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.title})]}),t.bio&&r.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:t.bio}),r.jsxs("div",{className:"space-y-1.5 mb-3",children:[t.areas_served&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(cl,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:t.areas_served})]}),t.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[t.years_experience," ",t.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.phone&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${t.phone}`,title:`Call ${t.name}`,children:r.jsx(Ma,{className:"h-4 w-4"})})}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`mailto:${t.email}`,title:`Email ${t.name}`,children:r.jsx(oi,{className:"h-4 w-4"})})}),t.linkedin_url&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(am,{className:"h-4 w-4"})})}),t.instagram_url&&r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(Zd,{className:"h-4 w-4"})})})]})]})}function Bbt({brokerageId:t}){const[e,n]=P.useState([]),[s,i]=P.useState(!0);if(P.useEffect(()=>{(async()=>{try{const{data:h,error:m}=await ee.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(m)throw m;if(!h||h.length===0){n([]),i(!1);return}const x=h.map(S=>S.id),{data:v,error:w}=await ee.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(w)throw w;const k=new Map(h.map(S=>[S.id,S])),C=(v||[]).filter(S=>S.total_points>0).map(S=>{const T=k.get(S.user_id);return{user_id:S.user_id,total_points:S.total_points,name:(T==null?void 0:T.name)||"Unknown",avatar_url:(T==null?void 0:T.avatar_url)||null}});n(C)}catch(h){console.error("Error fetching leaderboard:",h)}finally{i(!1)}})()},[t]),s)return r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(et,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(a=>r.jsx("div",{className:"h-12 bg-muted rounded"},a))})})]});const o=a=>a===1?"text-yellow-500":a===2?"text-gray-400":a===3?"text-amber-600":"text-muted-foreground",c=a=>a<=3?r.jsx(Ox,{className:$t("h-5 w-5",o(a))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:a});return r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(et,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):r.jsx("div",{className:"space-y-2",children:e.slice(0,10).map((a,h)=>{const m=a.name.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2),x=h+1;return r.jsxs("div",{className:$t("flex items-center gap-3 p-2 rounded-lg",x<=3&&"bg-muted/50"),children:[r.jsx("div",{className:"w-6 flex justify-center",children:c(x)}),r.jsxs(Di,{className:"h-8 w-8",children:[r.jsx(Po,{src:a.avatar_url||void 0}),r.jsx(Ri,{className:"text-xs",children:m})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:a.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[a.total_points.toLocaleString()," pts"]})]},a.user_id)})})})]})}function $bt({brokerageId:t}){const e=ts(),[n,s]=P.useState([]),[i,o]=P.useState(!0);P.useEffect(()=>{(async()=>{try{const{data:h,error:m}=await ee.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(m)throw m;if(!h||h.length===0){s([]),o(!1);return}const x=h.map(S=>S.id),v=new Map(h.map(S=>[S.id,S])),{data:w,error:k}=await ee.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",x).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(k)throw k;const C=(w||[]).map(S=>({id:S.id,slug:S.slug,property_address:S.property_address,city:S.city,price:S.price,property_type:S.property_type,agent_id:S.agent_id,agent:v.get(S.agent_id)||null,photos:S.listing_photos||[]}));s(C)}catch(h){console.error("Error fetching listings:",h)}finally{o(!1)}})()},[t]);const c=a=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(a);return i?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(et,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(a=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},a))})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>e("/mission-control/listings"),className:"gap-1",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(et,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(ui,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),r.jsxs(te,{size:"sm",onClick:()=>e("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(a=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${a.slug||a.id}`,"_blank"),className:"group cursor-pointer border rounded-lg overflow-hidden hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"relative h-24 bg-muted",children:[a.photos&&a.photos.length>0?r.jsx("img",{src:a.photos[0].photo_url,alt:a.property_address||"Listing",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(ui,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsx("span",{className:"text-[10px] font-medium bg-primary text-primary-foreground px-1.5 py-0.5 rounded uppercase",children:a.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:c(a.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:a.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.city}),a.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",a.agent.name]})]})]},a.id))}),n.length>0&&r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>e("/mission-control/listings"),children:["View All Listings",r.jsx($s,{className:"h-3 w-3 ml-1"})]})]})]})}function Ubt(){const{user:t,isAdmin:e,isBrokerageManager:n}=zr(),s=ts(),[i,o]=P.useState(!0),[c,a]=P.useState(null),[h,m]=P.useState(""),[x,v]=P.useState(0),[w,k]=P.useState(!1),[C,S]=P.useState(!1);return P.useEffect(()=>{(async()=>{if(t)try{const{data:I}=await ee.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle();if(!(I!=null&&I.brokerage_id)){o(!1);return}a(I.brokerage_id);const{data:A}=await ee.from("brokerages").select("name").eq("id",I.brokerage_id).maybeSingle();A&&m(A.name);const{count:D}=await ee.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",I.brokerage_id);if(v(D||0),e)k(!0),S(!0);else if(n){const{data:$}=await ee.from("brokerage_manager_assignments").select("id").eq("user_id",t.id).eq("brokerage_id",I.brokerage_id).maybeSingle();k(!!$),S(!!$)}}catch(I){console.error("Error fetching brokerage info:",I)}finally{o(!1)}})()},[t,e,n]),i?r.jsx(Dr,{title:"My Brokerage",description:"Loading...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):c?r.jsx(Dr,{title:h||"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[r.jsx(fs,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),C&&r.jsxs(te,{onClick:()=>s(`/mission-control/listings/new?brokerage=${c}`),children:[r.jsx(ui,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(Rbt,{brokerageId:c,canManage:w}),r.jsx(Fbt,{brokerageId:c}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(Bbt,{brokerageId:c}),r.jsx($bt,{brokerageId:c})]})]})}):r.jsx(Dr,{title:"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(na,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You're not currently part of a brokerage team."})]})})}function qbt(){const t=ts(),[e,n]=P.useState(""),[s,i]=P.useState("grid"),{data:o,isLoading:c}=rr({queryKey:["newsletters"],queryFn:async()=>{const{data:k,error:C}=await ee.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(C)throw C;return k}}),{data:a}=rr({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:k}=await ee.from("newsletter_likes").select("newsletter_id");return k||[]}}),{data:h}=rr({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:k}=await ee.from("newsletter_comments").select("newsletter_id");return k||[]}}),m=k=>(a==null?void 0:a.filter(C=>C.newsletter_id===k).length)||0,x=k=>(h==null?void 0:h.filter(C=>C.newsletter_id===k).length)||0,v=o==null?void 0:o.filter(k=>{var C;return k.title.toLowerCase().includes(e.toLowerCase())||((C=k.description)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))}),w=k=>{t(`/newsletters/${k}`)};return r.jsx(Dr,{title:"Newsletter Content",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Newsletter Content"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Monthly newsletter templates and resources"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search newsletters...",value:e,onChange:k=>n(k.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(im,{className:"h-4 w-4"})}),r.jsx(te,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx($f,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(v==null?void 0:v.length)||0," item",(v==null?void 0:v.length)!==1?"s":""," found"]}),c&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((k,C)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Kr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Kr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Kr,{className:"h-4 w-full mb-4"})]})},C))}),!c&&(v==null?void 0:v.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Si,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No newsletters match your search":"No newsletters available yet"}),e&&r.jsx(te,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!c&&v&&v.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:v.map(k=>r.jsxs(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>w(k.id),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:k.preview_image_url?r.jsx("img",{src:k.preview_image_url,alt:k.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Si,{className:"h-16 w-16"})})}),r.jsxs(et,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:k.title}),k.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:k.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ad,{className:"h-3.5 w-3.5"}),m(k.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wl,{className:"h-3.5 w-3.5"}),x(k.id)]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:C=>{C.stopPropagation(),w(k.id)},children:[r.jsx($s,{className:"h-4 w-4"}),"View Details"]})]})]},k.id))})]})})}function Vbt(){const{id:t}=hd(),e=ts(),{user:n}=zr(),{toast:s}=ua(),i=Qr(),{trackEngagement:o}=xI(),[c,a]=P.useState(""),{data:h,isLoading:m}=rr({queryKey:["newsletter",t],queryFn:async()=>{const{data:F,error:q}=await ee.from("newsletter_content").select("*").eq("id",t).single();if(q)throw q;return F},enabled:!!t});P.useEffect(()=>{h&&o("newsletter",h.id,h.title,"view")},[h==null?void 0:h.id]);const{data:x}=rr({queryKey:["newsletter-drives",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_drive_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:v}=rr({queryKey:["newsletter-pdfs",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_pdfs").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:w}=rr({queryKey:["newsletter-videos",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_videos").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:k}=rr({queryKey:["newsletter-canva-links",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_canva_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:C}=rr({queryKey:["newsletter-likes",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_likes").select("*").eq("newsletter_id",t);return F||[]},enabled:!!t}),{data:S}=rr({queryKey:["newsletter-comments",t],queryFn:async()=>{const{data:F}=await ee.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",t).order("created_at",{ascending:!1});return F||[]},enabled:!!t}),T=C==null?void 0:C.some(F=>F.user_id===(n==null?void 0:n.id)),I=dr({mutationFn:async()=>{T?await ee.from("newsletter_likes").delete().eq("newsletter_id",t).eq("user_id",n==null?void 0:n.id):await ee.from("newsletter_likes").insert({newsletter_id:t,user_id:n==null?void 0:n.id})},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-likes",t]})}}),A=dr({mutationFn:async F=>{const{error:q}=await ee.from("newsletter_comments").insert({newsletter_id:t,user_id:n==null?void 0:n.id,content:F});if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",t]}),a(""),s({title:"Comment added"})}}),D=dr({mutationFn:async F=>{const{error:q}=await ee.from("newsletter_comments").delete().eq("id",F);if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",t]}),s({title:"Comment deleted"})}}),$=F=>{if(F.includes("player.mediadelivery.net")||F.includes("iframe.mediadelivery.net")){const q=F.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${q[1]}/${q[2]}?autoplay=false`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})}if(F.includes("youtube.com")||F.includes("youtu.be")){const q=F.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${q[1]}`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}return r.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(wc,{className:"h-4 w-4"})," Watch Video"]})};return m?r.jsx(Dr,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-8 w-32"}),r.jsx(Kr,{className:"h-64 w-full"}),r.jsx(Kr,{className:"h-32 w-full"})]})}):h?r.jsx(Dr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/newsletters"),className:"mb-4",children:[r.jsx(Ga,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),h.preview_image_url&&r.jsx("img",{src:h.preview_image_url,alt:h.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:h.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:un(new Date(h.publish_date),"MMMM d, yyyy")})]}),h.description&&r.jsx("div",{className:"text-lg text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(o5,{resourceType:"newsletter",resourceId:h.id,resourceTitle:h.title}),r.jsxs(te,{variant:T?"default":"outline",size:"sm",onClick:()=>I.mutate(),children:[r.jsx(oa,{className:`h-4 w-4 mr-1 ${T?"fill-current":""}`}),(C==null?void 0:C.length)||0," ",(C==null?void 0:C.length)===1?"Like":"Likes"]})]}),k&&k.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(et,{className:"space-y-2",children:k.map(F=>r.jsxs("a",{href:F.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Yd,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:F.title}),r.jsx($s,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},F.id))})]}),x&&x.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(et,{className:"space-y-2",children:x.map(F=>r.jsxs("a",{href:F.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx($s,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:F.title})]},F.id))})]}),v&&v.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(et,{className:"space-y-2",children:v.map(F=>r.jsxs("a",{href:F.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Si,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:F.name}),r.jsx(Mo,{className:"h-4 w-4 text-muted-foreground"})]},F.id))})]}),w&&w.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Videos"})}),r.jsx(et,{className:"space-y-6",children:w.map(F=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:F.title}),$(F.video_url)]},F.id))})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg",children:["Comments (",(S==null?void 0:S.length)||0,")"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(gs,{placeholder:"Write a comment...",value:c,onChange:F=>a(F.target.value),className:"flex-1"}),r.jsx(te,{onClick:()=>c.trim()&&A.mutate(c),disabled:!c.trim()||A.isPending,children:r.jsx(To,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:S==null?void 0:S.map(F=>{var q,W,K;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{children:((W=(q=F.profiles)==null?void 0:q.name)==null?void 0:W[0])||"U"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-sm",children:((K=F.profiles)==null?void 0:K.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(F.created_at),"MMM d, yyyy")}),F.user_id===(n==null?void 0:n.id)&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>D.mutate(F.id),children:r.jsx(es,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.content})]})]},F.id)})})]})]})]})}):r.jsx(Dr,{title:"Not Found",description:"",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Newsletter not found"}),r.jsx(te,{variant:"link",onClick:()=>e("/newsletters"),children:"Back to Newsletters"})]})})}function Hbt(){const{toast:t}=ua(),e=Qr(),[n,s]=P.useState(!1),[i,o]=P.useState(null),[c,a]=P.useState({title:"",description:"",publish_date:un(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[h,m]=P.useState(null),[x,v]=P.useState(null),[w,k]=P.useState([]),[C,S]=P.useState([]),[T,I]=P.useState([]),[A,D]=P.useState([]),[$,F]=P.useState([]),[q,W]=P.useState(!1),{data:K,isLoading:Z}=rr({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:oe,error:ae}=await ee.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(ae)throw ae;return oe}}),re=dr({mutationFn:async oe=>{const{data:ae,error:Ne}=await ee.from("newsletter_content").insert({title:oe.title,description:oe.description||null,preview_image_url:oe.preview_image_url,publish_date:oe.publish_date,is_published:oe.is_published}).select().single();if(Ne)throw Ne;return ae},onSuccess:async oe=>{await je(oe.id),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter created successfully"}),ye()},onError:oe=>{t({title:"Error creating newsletter",description:oe.message,variant:"destructive"})}}),he=dr({mutationFn:async oe=>{const{error:ae}=await ee.from("newsletter_content").update({title:oe.title,description:oe.description||null,preview_image_url:oe.preview_image_url,publish_date:oe.publish_date,is_published:oe.is_published}).eq("id",oe.id);if(ae)throw ae;return oe.id},onSuccess:async oe=>{await je(oe),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter updated successfully"}),ye()},onError:oe=>{t({title:"Error updating newsletter",description:oe.message,variant:"destructive"})}}),ue=dr({mutationFn:async oe=>{const{error:ae}=await ee.from("newsletter_content").delete().eq("id",oe);if(ae)throw ae},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter deleted successfully"})},onError:oe=>{t({title:"Error deleting newsletter",description:oe.message,variant:"destructive"})}}),je=async oe=>{await ee.from("newsletter_drive_links").delete().eq("newsletter_id",oe),await ee.from("newsletter_pdfs").delete().eq("newsletter_id",oe),await ee.from("newsletter_videos").delete().eq("newsletter_id",oe),await ee.from("newsletter_canva_links").delete().eq("newsletter_id",oe);for(const ae of $){const Ne=`${oe}/${Date.now()}-${ae.file.name}`,{error:Te}=await ee.storage.from("newsletter-content").upload(Ne,ae.file);if(!Te){const{data:Be}=ee.storage.from("newsletter-content").getPublicUrl(Ne);C.push({name:ae.name,file_url:Be.publicUrl,file_size:ae.file.size,sort_order:C.length})}}w.length>0&&await ee.from("newsletter_drive_links").insert(w.map((ae,Ne)=>({newsletter_id:oe,title:ae.title,drive_url:ae.drive_url,sort_order:Ne}))),C.length>0&&await ee.from("newsletter_pdfs").insert(C.map((ae,Ne)=>({newsletter_id:oe,name:ae.name,file_url:ae.file_url,file_size:ae.file_size||null,sort_order:Ne}))),T.length>0&&await ee.from("newsletter_videos").insert(T.map((ae,Ne)=>({newsletter_id:oe,title:ae.title,video_url:ae.video_url,sort_order:Ne}))),A.length>0&&await ee.from("newsletter_canva_links").insert(A.map((ae,Ne)=>({newsletter_id:oe,title:ae.title,canva_share_link:ae.canva_share_link,sort_order:Ne})))},ne=async oe=>{o(oe),a({title:oe.title,description:oe.description||"",publish_date:un(new Date(oe.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:oe.is_published}),v(oe.preview_image_url);const[ae,Ne,Te,Be]=await Promise.all([ee.from("newsletter_drive_links").select("*").eq("newsletter_id",oe.id).order("sort_order"),ee.from("newsletter_pdfs").select("*").eq("newsletter_id",oe.id).order("sort_order"),ee.from("newsletter_videos").select("*").eq("newsletter_id",oe.id).order("sort_order"),ee.from("newsletter_canva_links").select("*").eq("newsletter_id",oe.id).order("sort_order")]);k(ae.data||[]),S(Ne.data||[]),I(Te.data||[]),D(Be.data||[]),F([]),s(!0)},ye=()=>{s(!1),o(null),a({title:"",description:"",publish_date:un(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),m(null),v(null),k([]),S([]),I([]),D([]),F([])},ie=async oe=>{var Ne;const ae=(Ne=oe.target.files)==null?void 0:Ne[0];ae&&(m(ae),v(URL.createObjectURL(ae)))},me=async()=>{if(!c.title){t({title:"Title is required",variant:"destructive"});return}W(!0);let oe=x;if(h){const ae=`previews/${Date.now()}-${h.name}`,{error:Ne}=await ee.storage.from("newsletter-content").upload(ae,h);if(!Ne){const{data:Te}=ee.storage.from("newsletter-content").getPublicUrl(ae);oe=Te.publicUrl}}i?he.mutate({id:i.id,...c,preview_image_url:oe}):re.mutate({...c,preview_image_url:oe}),W(!1)},fe=()=>{k([...w,{title:"",drive_url:"",sort_order:w.length}])},ve=()=>{I([...T,{title:"",video_url:"",sort_order:T.length}])},Ie=()=>{D([...A,{title:"",canva_share_link:"",sort_order:A.length}])},Se=oe=>{const ae=oe.target.files;if(!ae)return;const Ne=Array.from(ae).map(Te=>({file:Te,name:Te.name.replace(/\.[^/.]+$/,"")}));F([...$,...Ne])};return r.jsx(Dr,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Newsletters"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(K==null?void 0:K.length)||0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(K==null?void 0:K.filter(oe=>oe.is_published).length)||0})})]})]}),r.jsxs(Ur,{open:n,onOpenChange:oe=>!oe&&ye(),children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:i?"Edit Newsletter":"Add Newsletter"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Title *"}),r.jsx(xt,{value:c.title,onChange:oe=>a({...c,title:oe.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Publish Date"}),r.jsx(xt,{type:"datetime-local",value:c.publish_date,onChange:oe=>a({...c,publish_date:oe.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:c.description,onChange:oe=>a({...c,description:oe}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[x&&r.jsx("img",{src:x,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),r.jsxs("div",{children:[r.jsx(xt,{type:"file",accept:"image/*",onChange:ie,className:"hidden",id:"preview-upload"}),r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(Ao,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{checked:c.is_published,onCheckedChange:oe=>a({...c,is_published:oe})}),r.jsx(Xe,{children:"Published"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(Mn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),w.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(xt,{placeholder:"Link title",value:oe.title,onChange:Ne=>{const Te=[...w];Te[ae].title=Ne.target.value,k(Te)},className:"w-1/3"}),r.jsx(xt,{placeholder:"Google Drive URL",value:oe.drive_url,onChange:Ne=>{const Te=[...w];Te[ae].drive_url=Ne.target.value,k(Te)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>k(w.filter((Ne,Te)=>Te!==ae)),children:r.jsx(Es,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(xt,{type:"file",accept:".pdf",multiple:!0,onChange:Se,className:"hidden",id:"pdf-upload"}),r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(Ao,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),C.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:oe.name}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>S(C.filter((Ne,Te)=>Te!==ae)),children:r.jsx(Es,{className:"h-4 w-4"})})]},`existing-${ae}`)),$.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(xt,{value:oe.name,onChange:Ne=>{const Te=[...$];Te[ae].name=Ne.target.value,F(Te)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>F($.filter((Ne,Te)=>Te!==ae)),children:r.jsx(Es,{className:"h-4 w-4"})})]},`pending-${ae}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(Mn,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),T.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(xt,{placeholder:"Video title",value:oe.title,onChange:Ne=>{const Te=[...T];Te[ae].title=Ne.target.value,I(Te)},className:"w-1/3"}),r.jsx(xt,{placeholder:"Video URL (YouTube, Vimeo, etc.)",value:oe.video_url,onChange:Ne=>{const Te=[...T];Te[ae].video_url=Ne.target.value,I(Te)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>I(T.filter((Ne,Te)=>Te!==ae)),children:r.jsx(Es,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:Ie,children:[r.jsx(Mn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),A.map((oe,ae)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(xt,{placeholder:"Link title",value:oe.title,onChange:Ne=>{const Te=[...A];Te[ae].title=Ne.target.value,D(Te)},className:"w-1/3"}),r.jsx(xt,{placeholder:"Canva share link",value:oe.canva_share_link,onChange:Ne=>{const Te=[...A];Te[ae].canva_share_link=Ne.target.value,D(Te)},className:"flex-1"}),r.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>D(A.filter((Ne,Te)=>Te!==ae)),children:r.jsx(Es,{className:"h-4 w-4"})})]},ae))]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:ye,children:"Cancel"}),r.jsx(te,{onClick:me,disabled:q||re.isPending||he.isPending,children:q?"Uploading...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:Z?r.jsx(Er,{children:r.jsx(yt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(K==null?void 0:K.length)===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):K==null?void 0:K.map(oe=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[oe.preview_image_url?r.jsx("img",{src:oe.preview_image_url,alt:oe.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Si,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:oe.title}),oe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:oe.description})]})]})}),r.jsx(yt,{children:un(new Date(oe.publish_date),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${oe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:oe.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ne(oe),children:r.jsx(Al,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ne(oe),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ue.mutate(oe.id)},children:r.jsx(es,{className:"h-4 w-4"})})]})})]},oe.id))})]})})})]})})}const GNe={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 Wbt(){const{user:t}=zr(),{toast:e}=ua(),n=ts(),s=Qr(),[i,o]=P.useState(""),[c,a]=P.useState("popular"),[h,m]=P.useState(!1),[x,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(!1),{data:T=[],isLoading:I}=rr({queryKey:["wishlist-items",c,C],queryFn:async()=>{let q=ee.from("wishlist_items").select("*");C&&t&&(q=q.eq("user_id",t.id)),c==="latest"?q=q.order("created_at",{ascending:!1}):c==="popular"?q=q.order("vote_count",{ascending:!1}):c==="trending"&&(q=q.order("vote_count",{ascending:!1}));const{data:W,error:K}=await q;if(K)throw K;const Z=[...new Set((W==null?void 0:W.map(ie=>ie.user_id))||[])],{data:re}=await ee.from("profiles").select("id, name").in("id",Z),he=new Map((re==null?void 0:re.map(ie=>[ie.id,ie]))||[]);let ue=[];if(t){const{data:ie}=await ee.from("wishlist_votes").select("item_id").eq("user_id",t.id);ue=(ie==null?void 0:ie.map(me=>me.item_id))||[]}const je=(W==null?void 0:W.map(ie=>ie.id))||[],{data:ne}=await ee.from("wishlist_comments").select("item_id").in("item_id",je),ye=new Map;return ne==null||ne.forEach(ie=>{ye.set(ie.item_id,(ye.get(ie.item_id)||0)+1)}),W==null?void 0:W.map(ie=>{const me=he.get(ie.user_id),fe=(me==null?void 0:me.name)||"Unknown";return{...ie,user_name:fe,user_initials:fe.split(" ").map(ve=>ve[0]).join("").toUpperCase().slice(0,2),has_voted:ue.includes(ie.id),comment_count:ye.get(ie.id)||0}})}}),A=dr({mutationFn:async({title:q,description:W})=>{const{error:K}=await ee.from("wishlist_items").insert({user_id:t.id,title:q,description:W});if(K)throw K},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),m(!1),v(""),k(""),e({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),D=dr({mutationFn:async({itemId:q,hasVoted:W})=>{if(W){const{error:K}=await ee.from("wishlist_votes").delete().eq("item_id",q).eq("user_id",t.id);if(K)throw K;return{itemId:q,wasAdded:!1}}else{const{error:K}=await ee.from("wishlist_votes").insert({item_id:q,user_id:t.id});if(K)throw K;return{itemId:q,wasAdded:!0}}},onSuccess:async q=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),q!=null&&q.wasAdded){const W=T.find(Z=>Z.id===q.itemId),K=((W==null?void 0:W.vote_count)||0)+1;ee.functions.invoke("wishlist-notify",{body:{itemId:q.itemId,voteCount:K}}).catch(console.error)}},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),$=T.filter(q=>q.title.toLowerCase().includes(i.toLowerCase())||q.description.toLowerCase().includes(i.toLowerCase())),F=()=>{if(!x.trim()||!w.trim()){e({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}A.mutate({title:x.trim(),description:w.trim()})};return r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(r1,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),r.jsxs(Ur,{open:h,onOpenChange:m,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Submit a New Idea"})}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title"}),r.jsx(xt,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:q=>v(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:w,onChange:q=>k(q.target.value),rows:4})]}),r.jsx(te,{onClick:F,className:"w-full",disabled:A.isPending,children:A.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Idea"})]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search ideas...",value:i,onChange:q=>o(q.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(Oa,{value:c,onValueChange:q=>a(q),children:r.jsxs(Ta,{children:[r.jsx(xn,{value:"popular",children:"Most Popular"}),r.jsx(xn,{value:"latest",children:"Latest"}),r.jsx(xn,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(te,{variant:C?"default":"outline",size:"sm",onClick:()=>S(!C),children:C?"Show All Ideas":"My Ideas"})}),I?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):$.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(r1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(te,{onClick:()=>m(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:$.map(q=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${q.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:W=>{W.stopPropagation(),D.mutate({itemId:q.id,hasVoted:q.has_voted||!1})},className:$t("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",q.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(Ix,{className:$t("h-4 w-4",q.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:q.vote_count})]}),r.jsx(Di,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Ri,{className:"bg-primary/20 text-primary text-sm font-medium",children:q.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:q.title}),r.jsx(Ft,{className:$t("text-xs",GNe[q.status].color),children:GNe[q.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:q.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(q.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(vl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:q.comment_count})]})]})},q.id))})]})})}const KNe={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 Gbt(){const{itemId:t}=hd(),e=ts(),{user:n}=zr(),{toast:s}=ua(),i=Qr(),[o,c]=P.useState(""),{data:a=!1}=rr({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:T,error:I}=await ee.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!I&&!!T},enabled:!!n}),{data:h,isLoading:m}=rr({queryKey:["wishlist-item",t],queryFn:async()=>{const{data:T,error:I}=await ee.from("wishlist_items").select("*").eq("id",t).single();if(I)throw I;const{data:A}=await ee.from("profiles").select("name").eq("id",T.user_id).single();let D=!1;if(n){const{data:$}=await ee.from("wishlist_votes").select("id").eq("item_id",t).eq("user_id",n.id).maybeSingle();D=!!$}return{...T,user_name:(A==null?void 0:A.name)||"Unknown",user_initials:((A==null?void 0:A.name)||"U").split(" ").map($=>$[0]).join("").toUpperCase().slice(0,2),has_voted:D}}}),{data:x=[],isLoading:v}=rr({queryKey:["wishlist-comments",t],queryFn:async()=>{const{data:T,error:I}=await ee.from("wishlist_comments").select("*").eq("item_id",t).order("created_at",{ascending:!0});if(I)throw I;const A=[...new Set((T==null?void 0:T.map(F=>F.user_id))||[])],{data:D}=await ee.from("profiles").select("id, name").in("id",A),$=new Map((D==null?void 0:D.map(F=>[F.id,F]))||[]);return T==null?void 0:T.map(F=>{const q=$.get(F.user_id),W=(q==null?void 0:q.name)||"Unknown";return{...F,user_name:W,user_initials:W.split(" ").map(K=>K[0]).join("").toUpperCase().slice(0,2)}})}}),w=dr({mutationFn:async T=>{if(T){const{error:I}=await ee.from("wishlist_votes").delete().eq("item_id",t).eq("user_id",n.id);if(I)throw I;return{wasAdded:!1}}else{const{error:I}=await ee.from("wishlist_votes").insert({item_id:t,user_id:n.id});if(I)throw I;return{wasAdded:!0}}},onSuccess:async T=>{if(i.invalidateQueries({queryKey:["wishlist-item",t]}),i.invalidateQueries({queryKey:["wishlist-items"]}),T!=null&&T.wasAdded&&h){const I=(h.vote_count||0)+1;ee.functions.invoke("wishlist-notify",{body:{itemId:t,voteCount:I}}).catch(console.error)}},onError:T=>{s({title:"Error",description:T.message,variant:"destructive"})}}),k=dr({mutationFn:async T=>{const{error:I}=await ee.from("wishlist_comments").insert({item_id:t,user_id:n.id,content:T});if(I)throw I},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",t]}),c(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error",description:T.message,variant:"destructive"})}}),C=dr({mutationFn:async T=>{const{error:I}=await ee.from("wishlist_comments").delete().eq("id",T);if(I)throw I},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",t]}),s({title:"Comment deleted"})},onError:T=>{s({title:"Error",description:T.message,variant:"destructive"})}}),S=()=>{o.trim()&&k.mutate(o.trim())};return m?r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Kr,{className:"h-8 w-32 mb-6"}),r.jsx(Kr,{className:"h-48 w-full mb-6"}),r.jsx(Kr,{className:"h-32 w-full"})]})}):h?r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/wishlist"),className:"mb-4",children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),r.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:()=>w.mutate(h.has_voted),className:$t("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",h.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(Ix,{className:$t("h-5 w-5",h.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:h.vote_count}),r.jsx("span",{className:"text-xs",children:"votes"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:h.title}),r.jsx(Ft,{className:$t("text-xs",KNe[h.status].color),children:KNe[h.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:h.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Di,{className:"h-6 w-6",children:r.jsx(Ri,{className:"bg-primary/20 text-primary text-xs",children:h.user_initials})}),r.jsx("span",{children:h.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(h.created_at).toLocaleDateString()})]})]})]})}),r.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",x.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(yte,{placeholder:a?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:c,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:a}),r.jsx(te,{onClick:S,disabled:!o.trim()||k.isPending,size:"icon",className:"h-auto",children:k.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(To,{className:"h-4 w-4"})})]}),v?r.jsx("div",{className:"space-y-4",children:[1,2].map(T=>r.jsx(Kr,{className:"h-20 w-full"},T))}):x.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):r.jsx("div",{className:"space-y-4",children:x.map(T=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{className:"bg-primary/20 text-primary text-xs",children:T.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium text-sm",children:T.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(T.created_at).toLocaleDateString()})]}),r.jsx(kxe,{content:T.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===T.user_id&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>C.mutate(T.id),children:r.jsx(es,{className:"h-4 w-4"})})]},T.id))})]})]})}):r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Item not found"}),r.jsx(te,{variant:"link",onClick:()=>e("/wishlist"),children:"Go back to Wishlist"})]})})}const ZNe={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"}},YNe=["open","under_review","planned","in_progress","launched","declined"];function Kbt(){const{toast:t}=ua(),e=ts(),n=Qr(),[s,i]=P.useState(""),[o,c]=P.useState("all"),[a,h]=P.useState(!1),[m,x]=P.useState(null),{data:v=[],isLoading:w}=rr({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:I,error:A}=await ee.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(A)throw A;const D=[...new Set((I==null?void 0:I.map(Z=>Z.user_id))||[])],{data:$}=await ee.from("profiles").select("id, name, email").in("id",D),F=new Map(($==null?void 0:$.map(Z=>[Z.id,Z]))||[]),q=(I==null?void 0:I.map(Z=>Z.id))||[],{data:W}=await ee.from("wishlist_comments").select("item_id").in("item_id",q),K=new Map;return W==null||W.forEach(Z=>{K.set(Z.item_id,(K.get(Z.item_id)||0)+1)}),I==null?void 0:I.map(Z=>{const re=F.get(Z.user_id);return{...Z,user_name:(re==null?void 0:re.name)||"Unknown",user_email:(re==null?void 0:re.email)||"",comment_count:K.get(Z.id)||0}})}}),k=dr({mutationFn:async({itemId:I,status:A})=>{const{error:D}=await ee.from("wishlist_items").update({status:A}).eq("id",I);if(D)throw D},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),t({title:"Status updated!"})},onError:I=>{t({title:"Error",description:I.message,variant:"destructive"})}}),C=dr({mutationFn:async I=>{const{error:A}=await ee.from("wishlist_items").delete().eq("id",I);if(A)throw A},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),h(!1),x(null),t({title:"Item deleted!"})},onError:I=>{t({title:"Error",description:I.message,variant:"destructive"})}}),S=v.filter(I=>{const A=I.title.toLowerCase().includes(s.toLowerCase())||I.description.toLowerCase().includes(s.toLowerCase())||I.user_name.toLowerCase().includes(s.toLowerCase()),D=o==="all"||I.status===o;return A&&D}),T={total:v.length,open:v.filter(I=>I.status==="open").length,inProgress:v.filter(I=>I.status==="in_progress").length,launched:v.filter(I=>I.status==="launched").length,highVotes:v.filter(I=>I.vote_count>=10).length};return r.jsx(Dr,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>e("/admin"),children:r.jsx(Ga,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),r.jsx("p",{className:"text-2xl font-bold",children:T.total})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:T.open})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-bold text-orange-600",children:T.inProgress})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:T.launched})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:T.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search ideas, users...",value:s,onChange:I=>i(I.target.value),className:"pl-10"})]}),r.jsxs(_n,{value:o,onValueChange:I=>c(I),children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Statuses"}),YNe.map(I=>r.jsx(tr,{value:I,children:ZNe[I].label},I))]})]})]}),w?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(I=>r.jsx(Kr,{className:"h-16 w-full"},I))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-[60px]",children:"Votes"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(Mt,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:S.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):S.map(I=>r.jsxs(Er,{className:$t(I.vote_count>=10&&"bg-primary/5"),children:[r.jsx(yt,{children:r.jsx(Ft,{variant:I.vote_count>=10?"default":"secondary",children:I.vote_count})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:I.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:I.description})]})}),r.jsx(yt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:I.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:I.user_email})]})}),r.jsx(yt,{className:"hidden sm:table-cell",children:I.comment_count}),r.jsx(yt,{children:r.jsxs(_n,{value:I.status,onValueChange:A=>k.mutate({itemId:I.id,status:A}),children:[r.jsx(yn,{className:"w-[140px] h-8",children:r.jsx(bn,{})}),r.jsx(vn,{children:YNe.map(A=>r.jsx(tr,{value:A,children:ZNe[A].label},A))})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${I.id}`,"_blank"),children:r.jsx($s,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(I.id),h(!0)},children:r.jsx(es,{className:"h-4 w-4"})})]})})]},I.id))})]})}),r.jsx(Ur,{open:a,onOpenChange:h,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Delete Wishlist Item"})}),r.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:()=>m&&C.mutate(m),disabled:C.isPending,children:C.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function Zbt(){const{user:t}=zr(),[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState(!1),[a,h]=P.useState(null),[m,x]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState(""),[S,T]=P.useState(""),[I,A]=P.useState(""),[D,$]=P.useState(!1),[F,q]=P.useState(""),[W,K]=P.useState("once"),[Z,re]=P.useState([]),[he,ue]=P.useState([]),[je,ne]=P.useState(!1),[ye,ie]=P.useState([]),[me,fe]=P.useState({total:0,dismissed:0});P.useEffect(()=>{ve()},[]);const ve=async()=>{const{data:Ve,error:Me}=await ee.from("levelup_briefs").select("*").order("created_at",{ascending:!1});Me?(He.error("Failed to fetch briefs"),console.error(Me)):n(Ve||[]),i(!1)},Ie=()=>{C(""),T(""),A(""),$(!1),q(new Date().toISOString().slice(0,16)),K("once"),re([]),ue([]),h(null)},Se=()=>{Ie(),c(!0)},oe=async Ve=>{h(Ve),C(Ve.title),T(Ve.description||""),A(Ve.video_url||""),$(Ve.is_published),q(Ve.publish_date.slice(0,16)),K(Ve.show_frequency);const{data:Me}=await ee.from("levelup_brief_links").select("*").eq("brief_id",Ve.id).order("sort_order");re((Me==null?void 0:Me.map(Re=>({title:Re.title,url:Re.url})))||[]);const{data:rt}=await ee.from("levelup_brief_polls").select("*").eq("brief_id",Ve.id).order("sort_order");if(rt){const Re=[];for(const Ge of rt){const{data:tt}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",Ge.id).order("sort_order");Re.push({question:Ge.question,poll_type:Ge.poll_type,options:(tt==null?void 0:tt.map(Et=>Et.option_text))||[]})}ue(Re)}c(!0)},ae=async Ve=>{var rt;const Me=(rt=Ve.target.files)==null?void 0:rt[0];if(Me){ne(!0);try{const Re=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:Me.name.replace(/\.[^/.]+$/,"")}});if(Re.error)throw Re.error;const{videoId:Ge,libraryId:tt}=Re.data,Et=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ge}});if(Et.error)throw Et.error;const{uploadUrl:Lt,apiKey:Ot}=Et.data,Dt=new XMLHttpRequest;await new Promise((sr,Pr)=>{Dt.upload.addEventListener("progress",wn=>{if(wn.lengthComputable){const kn=Math.round(wn.loaded/wn.total*100);console.log("Upload progress:",kn)}}),Dt.addEventListener("load",()=>{Dt.status>=200&&Dt.status<300?sr():Pr(new Error(`Upload failed with status ${Dt.status}`))}),Dt.addEventListener("error",()=>Pr(new Error("Upload failed"))),Dt.open("PUT",Lt),Dt.setRequestHeader("AccessKey",Ot),Dt.send(Me)});const kt=`https://player.mediadelivery.net/embed/${tt}/${Ge}`;A(kt),He.success("Video uploaded successfully! It may take a few minutes to process.")}catch(Re){console.error("Upload error:",Re),He.error("Failed to upload video")}finally{ne(!1)}}},Ne=async()=>{if(!k.trim()){He.error("Title is required");return}try{let Ve;if(a){const{error:Me}=await ee.from("levelup_briefs").update({title:k,description:S||null,video_url:I||null,is_published:D,publish_date:F,show_frequency:W}).eq("id",a.id);if(Me)throw Me;Ve=a.id,await ee.from("levelup_brief_links").delete().eq("brief_id",Ve);const{data:rt}=await ee.from("levelup_brief_polls").select("id").eq("brief_id",Ve);if(rt)for(const Re of rt)await ee.from("levelup_brief_poll_options").delete().eq("poll_id",Re.id);await ee.from("levelup_brief_polls").delete().eq("brief_id",Ve)}else{const{data:Me,error:rt}=await ee.from("levelup_briefs").insert({title:k,description:S||null,video_url:I||null,is_published:D,publish_date:F,show_frequency:W,created_by:t==null?void 0:t.id}).select().single();if(rt)throw rt;Ve=Me.id}if(Z.length>0){const Me=Z.map((rt,Re)=>({brief_id:Ve,title:rt.title,url:rt.url,sort_order:Re}));await ee.from("levelup_brief_links").insert(Me)}for(let Me=0;Me0){const tt=rt.options.map((Et,Lt)=>({poll_id:Re.id,option_text:Et,sort_order:Lt}));await ee.from("levelup_brief_poll_options").insert(tt)}}He.success(a?"Brief updated":"Brief created"),c(!1),Ie(),ve()}catch(Ve){console.error("Error saving brief:",Ve),He.error("Failed to save brief")}},Te=async Ve=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:Me}=await ee.from("levelup_briefs").delete().eq("id",Ve);if(Me)throw Me;He.success("Brief deleted"),ve()}catch(Me){console.error("Error deleting brief:",Me),He.error("Failed to delete brief")}},Be=async Ve=>{w(Ve);const{count:Me}=await ee.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Ve.id),{count:rt}=await ee.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Ve.id).not("dismissed_at","is",null);fe({total:Me||0,dismissed:rt||0});const{data:Re}=await ee.from("levelup_brief_polls").select("*").eq("brief_id",Ve.id).order("sort_order");if(Re){const Ge=[];for(const tt of Re){const{data:Et}=await ee.from("levelup_brief_poll_options").select("*").eq("poll_id",tt.id).order("sort_order"),{data:Lt}=await ee.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",tt.id),Ot={};let Dt=0;Et&&Et.forEach(kt=>{const sr=(Lt==null?void 0:Lt.filter(Pr=>Pr.option_id===kt.id).length)||0;Ot[kt.id]=sr,Dt+=sr}),Ge.push({...tt,options:Et||[],results:Ot,totalResponses:tt.poll_type==="single"?new Set(Lt==null?void 0:Lt.map(kt=>kt.option_id)).size:Dt})}ie(Ge)}x(!0)},Le=()=>{re([...Z,{title:"",url:""}])},Qe=(Ve,Me,rt)=>{const Re=[...Z];Re[Ve][Me]=rt,re(Re)},Fe=Ve=>{re(Z.filter((Me,rt)=>rt!==Ve))},Ce=()=>{ue([...he,{question:"",poll_type:"single",options:["",""]}])},Je=(Ve,Me)=>{const rt=[...he];rt[Ve].question=Me,ue(rt)},Ae=(Ve,Me)=>{const rt=[...he];rt[Ve].poll_type=Me,ue(rt)},Ye=Ve=>{const Me=[...he];Me[Ve].options.push(""),ue(Me)},ge=(Ve,Me,rt)=>{const Re=[...he];Re[Ve].options[Me]=rt,ue(Re)},ft=(Ve,Me)=>{const rt=[...he];rt[Ve].options=rt[Ve].options.filter((Re,Ge)=>Ge!==Me),ue(rt)},nt=Ve=>{ue(he.filter((Me,rt)=>rt!==Ve))};return r.jsxs(Dr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(te,{onClick:Se,children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Frequency"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:s?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):e.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):e.map(Ve=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:Ve.title}),r.jsx(yt,{children:r.jsx(Ft,{variant:Ve.is_published?"default":"secondary",children:Ve.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"capitalize",children:Ve.show_frequency.replace("_"," ")}),r.jsx(yt,{children:un(new Date(Ve.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Be(Ve),children:r.jsx(nc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>oe(Ve),children:r.jsx(Jl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Te(Ve.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},Ve.id))})]})})})]}),r.jsx(Ur,{open:o,onOpenChange:c,children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:a?"Edit Brief":"Create New Brief"})}),r.jsxs(Oa,{defaultValue:"content",className:"w-full",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-4",children:[r.jsx(xn,{value:"content",children:"Content"}),r.jsx(xn,{value:"video",children:"Video"}),r.jsx(xn,{value:"links",children:"Links"}),r.jsx(xn,{value:"polls",children:"Polls"})]}),r.jsxs(Un,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Title *"}),r.jsx(xt,{value:k,onChange:Ve=>C(Ve.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:S,onChange:Ve=>T(Ve),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Publish Date"}),r.jsx(xt,{type:"datetime-local",value:F,onChange:Ve=>q(Ve.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Show Frequency"}),r.jsxs(_n,{value:W,onValueChange:K,children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"once",children:"Once (until dismissed)"}),r.jsx(tr,{value:"every_login",children:"Every login"}),r.jsx(tr,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Js,{checked:D,onCheckedChange:$}),r.jsx(Xe,{children:"Publish immediately"})]})]}),r.jsxs(Un,{value:"video",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(xt,{type:"file",accept:"video/*",onChange:ae,disabled:je})}),je&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Or paste embed URL"}),r.jsx(xt,{value:I,onChange:Ve=>A(Ve.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),I&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:I,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs(Un,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Xe,{children:"Quick Links"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:Le,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),Z.map((Ve,Me)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(xt,{value:Ve.title,onChange:rt=>Qe(Me,"title",rt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(xt,{value:Ve.url,onChange:rt=>Qe(Me,"url",rt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>Fe(Me),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]},Me)),Z.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(Un,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Xe,{children:"Polls"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:Ce,children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),he.map((Ve,Me)=>r.jsx(Ze,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(xt,{value:Ve.question,onChange:rt=>Je(Me,rt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(_n,{value:Ve.poll_type,onValueChange:rt=>Ae(Me,rt),children:[r.jsx(yn,{className:"w-32",children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"single",children:"Single"}),r.jsx(tr,{value:"multi",children:"Multi-select"})]})]}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>nt(Me),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[Ve.options.map((rt,Re)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:rt,onChange:Ge=>ge(Me,Re,Ge.target.value),placeholder:`Option ${Re+1}`}),Ve.options.length>2&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>ft(Me,Re),children:r.jsx(es,{className:"h-4 w-4 text-muted-foreground"})})]},Re)),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>Ye(Me),children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},Me)),he.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),r.jsx(te,{onClick:Ne,children:a?"Update Brief":"Create Brief"})]})]})}),r.jsx(Ur,{open:m,onOpenChange:x,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Results: ",v==null?void 0:v.title]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:me.total})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:me.dismissed})})]})]}),ye.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),ye.map(Ve=>r.jsxs(Ze,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:Ve.question}),r.jsx("div",{className:"space-y-2",children:Ve.options.map(Me=>{const rt=Ve.results[Me.id]||0,Re=Ve.totalResponses>0?Math.round(rt/Ve.totalResponses*100):0;return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:Me.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[rt," (",Re,"%)"]})]}),r.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${Re}%`}})})]},Me.id)})})]},Ve.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const Ybt=()=>{const{user:t}=zr(),{toast:e}=ua(),n=Qr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,h]=P.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,x]=P.useState(null),[v,w]=P.useState(""),{data:k=[],isLoading:C}=rr({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:F,error:q}=await ee.from("additional_services").select("*").order("publish_date",{ascending:!1});if(q)throw q;return F}}),S=dr({mutationFn:async F=>{let q=F.existingImageUrl;if(F.image){const K=F.image.name.split(".").pop(),Z=`${Date.now()}-${Math.random().toString(36).substring(7)}.${K}`,{error:re}=await ee.storage.from("service-images").upload(Z,F.image);if(re)throw re;const{data:he}=ee.storage.from("service-images").getPublicUrl(Z);q=he.publicUrl}const W={name:F.item.name,description:F.item.description||null,preview_image_url:q,signup_link_url:F.item.signup_link_url,publish_date:F.item.publish_date?new Date(F.item.publish_date).toISOString():new Date().toISOString(),is_published:F.item.is_published,created_by:t==null?void 0:t.id};if(F.itemId){const{error:K}=await ee.from("additional_services").update(W).eq("id",F.itemId);if(K)throw K}else{const{error:K}=await ee.from("additional_services").insert(W);if(K)throw K}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:o?"Service updated":"Service created"}),i(!1),I()},onError:F=>{e({title:"Error saving service",description:F.message,variant:"destructive"})}}),T=dr({mutationFn:async F=>{const{error:q}=await ee.from("additional_services").delete().eq("id",F);if(q)throw q},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:"Service deleted"})},onError:F=>{e({title:"Error deleting service",description:F.message,variant:"destructive"})}}),I=()=>{h({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),w(""),c(null)},A=F=>{c(F),h({name:F.name,description:F.description||"",signup_link_url:F.signup_link_url,publish_date:F.publish_date?new Date(F.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:F.is_published}),w(F.preview_image_url||""),i(!0)},D=F=>{var W;const q=(W=F.target.files)==null?void 0:W[0];q&&(x(q),w(URL.createObjectURL(q)))},$=F=>{if(F.preventDefault(),!a.name.trim()){e({title:"Name is required",variant:"destructive"});return}if(!a.signup_link_url.trim()){e({title:"Signup link URL is required",variant:"destructive"});return}S.mutate({item:a,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Dr,{title:"Manage Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:k.filter(F=>F.is_published).length})})]})]}),r.jsxs(Ur,{open:s,onOpenChange:F=>{i(F),F||I()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:$,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Name *"}),r.jsx(xt,{id:"name",value:a.name,onChange:F=>h({...a,name:F.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(iy,{content:a.description,onChange:F=>h({...a,description:F}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(xt,{id:"signup_link_url",type:"url",value:a.signup_link_url,onChange:F=>h({...a,signup_link_url:F.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(xt,{id:"publish_date",type:"date",value:a.publish_date,onChange:F=>h({...a,publish_date:F.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Js,{id:"is_published",checked:a.is_published,onCheckedChange:F=>h({...a,is_published:F})}),r.jsx(Xe,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Preview Image"}),v?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:v,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),w("")},children:r.jsx(Es,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Wo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(xt,{type:"file",accept:"image/*",onChange:D,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:S.isPending,children:S.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:C?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):k.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No services yet. Click "Add Service" to create your first one.'}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-16",children:"Preview"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Signup Link"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:k.map(F=>r.jsxs(Er,{children:[r.jsx(yt,{children:F.preview_image_url?r.jsx("img",{src:F.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Wo,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(yt,{className:"font-medium",children:F.name}),r.jsx(yt,{children:r.jsxs("a",{href:F.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx($s,{className:"h-3 w-3"}),"Link"]})}),r.jsx(yt,{children:new Date(F.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(Ft,{variant:F.is_published?"default":"secondary",children:F.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>A(F),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&T.mutate(F.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})})})]})})};function Xbt(){const{toast:t}=ua(),[e,n]=P.useState([]),[s,i]=P.useState(!0),[o,c]=P.useState(!1),[a,h]=P.useState(!1),[m,x]=P.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});P.useEffect(()=>{v()},[]);const v=async()=>{try{const{data:T,error:I}=await ee.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(I)throw I;n(T.coupons||[])}catch(T){console.error("Error fetching coupons:",T),t({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{i(!1)}},w=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}c(!0);try{const T={action:"create",name:m.name,duration:m.duration,promotion_code:m.promotionCode.trim()||void 0};m.discountType==="percent"?T.percent_off=parseFloat(m.percentOff):(T.amount_off=Math.round(parseFloat(m.amountOff)*100),T.currency="usd"),m.duration==="repeating"&&(T.duration_in_months=parseInt(m.durationInMonths));const{data:I,error:A}=await ee.functions.invoke("stripe-manage-coupons",{body:T});if(A)throw A;t({title:"Success",description:"Coupon created successfully"}),h(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),v()}catch(T){console.error("Error creating coupon:",T),t({title:"Error",description:T.message||"Failed to create coupon",variant:"destructive"})}finally{c(!1)}},k=async T=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:I}=await ee.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:T}});if(I)throw I;t({title:"Success",description:"Coupon deleted successfully"}),v()}catch(I){console.error("Error deleting coupon:",I),t({title:"Error",description:I.message||"Failed to delete coupon",variant:"destructive"})}},C=T=>T.percent_off?`${T.percent_off}% off`:T.amount_off?`$${(T.amount_off/100).toFixed(2)} off`:"N/A",S=T=>{switch(T.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${T.duration_in_months} months`;default:return T.duration}};return r.jsx(Dr,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Ur,{open:a,onOpenChange:h,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(Mn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Create New Coupon"}),r.jsx(us,{children:"Create a discount coupon that can be applied to subscriptions"})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Promotion Code (what users will type)"}),r.jsx(xt,{placeholder:"e.g., BROKERAGE50",value:m.promotionCode,onChange:T=>x({...m,promotionCode:T.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Coupon Name (internal label)"}),r.jsx(xt,{placeholder:"e.g., 50% Off Brokerage Launch",value:m.name,onChange:T=>x({...m,name:T.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Discount Type"}),r.jsxs(_n,{value:m.discountType,onValueChange:T=>{const I=T==="amount"&&m.duration==="forever"?"once":m.duration;x({...m,discountType:T,duration:I})},children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(a4,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(tr,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(ad,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),m.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(xt,{type:"number",min:"1",max:"100",placeholder:"20",value:m.percentOff,onChange:T=>x({...m,percentOff:T.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Amount Off (USD)"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(xt,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:m.amountOff,onChange:T=>x({...m,amountOff:T.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Duration"}),r.jsxs(_n,{value:m.duration,onValueChange:T=>x({...m,duration:T}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"once",children:"Once (first payment only)"}),r.jsx(tr,{value:"repeating",children:"Multiple months"}),r.jsxs(tr,{value:"forever",disabled:m.discountType==="amount",children:["Forever ",m.discountType==="amount"&&"(% discounts only)"]})]})]}),m.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),m.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Number of Months"}),r.jsx(xt,{type:"number",min:"1",placeholder:"3",value:m.durationInMonths,onChange:T=>x({...m,durationInMonths:T.target.value})})]}),r.jsx(te,{onClick:w,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Active Coupons"}),r.jsx(In,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No coupons created yet. Create your first coupon to get started."}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Promo Code"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Discount"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Redemptions"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:e.map(T=>{var I;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-mono font-medium",children:((I=T.promotion_codes)==null?void 0:I.length)>0?T.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(yt,{children:T.name||"-"}),r.jsx(yt,{children:C(T)}),r.jsx(yt,{children:S(T)}),r.jsx(yt,{children:T.times_redeemed}),r.jsx(yt,{children:r.jsx(Ft,{variant:T.valid?"default":"secondary",children:T.valid?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>k(T.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})})]},T.id)})})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"How to Use Coupons"})}),r.jsxs(et,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const kce={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 Qbt(){const[t,e]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState(null),{data:c,isLoading:a,refetch:h}=rr({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:C,error:S}=await ee.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(S)throw S;return C}}),{data:m}=rr({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:C,error:S}=await ee.from("brokerages").select("*").order("name");if(S)throw S;return await Promise.all((C||[]).map(async I=>{const{data:A}=await ee.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",I.id),{data:D}=await ee.from("user_roles").select("user_id").eq("role","brokerage_manager"),$=(D==null?void 0:D.map(W=>W.user_id))||[],F=(A==null?void 0:A.filter(W=>$.includes(W.id)))||[],q=(A==null?void 0:A.length)||0;return{...I,managers:F,agentCount:q}}))}}),x=C=>{if(C.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(C.brokerage_id&&!C.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(C.is_trial&&C.trial_expires_at)return new Date(C.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(C.subscription_status==="active"||C.subscription_status==="trialing"){const S=kce[C.subscription_product_id];return{status:(S==null?void 0:S.name)||"Active",badge:C.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return C.subscription_status==="canceled"||C.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},v=c==null?void 0:c.filter(C=>{var T,I;if(!(((T=C.name)==null?void 0:T.toLowerCase().includes(t.toLowerCase()))||((I=C.email)==null?void 0:I.toLowerCase().includes(t.toLowerCase()))))return!1;switch(x(C),n){case"active":return C.subscription_status==="active";case"trialing":return C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date;case"grandfathered":return C.is_grandfathered;case"brokerage":return C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered;case"expired":return C.subscription_status==="canceled"||C.subscription_status==="past_due"||C.is_trial&&new Date(C.trial_expires_at)<=new Date;case"none":return!C.subscription_status||C.subscription_status==="none";default:return!0}}),w={totalUsers:(c==null?void 0:c.length)||0,activeSubscriptions:(c==null?void 0:c.filter(C=>C.subscription_status==="active").length)||0,trials:(c==null?void 0:c.filter(C=>C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date).length)||0,grandfathered:(c==null?void 0:c.filter(C=>C.is_grandfathered).length)||0,brokerageMembers:(c==null?void 0:c.filter(C=>C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered).length)||0,individualSubscribers:(c==null?void 0:c.filter(C=>C.subscription_status==="active"&&C.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(c==null?void 0:c.filter(C=>C.subscription_status==="active"&&(C.subscription_product_id==="prod_Tc08MupgoVySDG"||C.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},k=C=>{window.open(`https://dashboard.stripe.com/customers/${C}`,"_blank")};return r.jsx(Dr,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(te,{onClick:()=>h(),variant:"outline",size:"sm",children:[r.jsx(Fl,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.totalUsers})]})}),r.jsx(Ze,{className:"border-green-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Z0,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Paid"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:w.activeSubscriptions})]})}),r.jsx(Ze,{className:"border-blue-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Gi,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:w.trials})]})}),r.jsx(Ze,{className:"border-purple-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Y0,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Grandfathered"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:w.grandfathered})]})}),r.jsx(Ze,{className:"border-orange-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:w.brokerageMembers})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Individual"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.individualSubscribers})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:w.brokerageSubscribers})]})})]}),r.jsxs(Oa,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"users",children:"All Users"}),r.jsx(xn,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(Un,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name or email...",value:t,onChange:C=>e(C.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:n,onValueChange:C=>s(C),children:[r.jsx(yn,{className:"w-[200px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Users"}),r.jsx(tr,{value:"active",children:"Active Subscriptions"}),r.jsx(tr,{value:"trialing",children:"Trials"}),r.jsx(tr,{value:"grandfathered",children:"Grandfathered"}),r.jsx(tr,{value:"brokerage",children:"Brokerage Members"}),r.jsx(tr,{value:"expired",children:"Expired/Canceled"}),r.jsx(tr,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"User"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Plan"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(Mt,{children:"End Date"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:a?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(v==null?void 0:v.length)===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):v==null?void 0:v.map(C=>{var I,A;const S=x(C),T=kce[C.subscription_product_id];return r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:C.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C.email})]})}),r.jsx(yt,{children:r.jsx(Ft,{variant:S.variant,children:S.badge})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm",children:C.is_grandfathered?"Legacy Access":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(T==null?void 0:T.name)||S.status})}),r.jsx(yt,{children:(I=C.brokerages)!=null&&I.name?r.jsx("span",{className:"text-sm",children:C.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(yt,{children:C.subscription_end_date?r.jsx("span",{className:"text-sm",children:un(new Date(C.subscription_end_date),"MMM d, yyyy")}):C.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",un(new Date(C.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[C.stripe_customer_id&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>k(C.stripe_customer_id),children:r.jsx($s,{className:"h-4 w-4"})}),r.jsxs(Ur,{children:[r.jsx(Oo,{asChild:!0,children:r.jsx(te,{variant:"outline",size:"sm",onClick:()=>o(C),children:"Details"})}),r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Subscription Details"}),r.jsxs(us,{children:[C.name," (",C.email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(Ft,{variant:S.variant,className:"mt-1",children:S.badge})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),r.jsx("p",{className:"font-medium",children:C.is_grandfathered?"Grandfathered (Legacy)":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(T==null?void 0:T.name)||"None"})]}),C.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((A=C.brokerages)==null?void 0:A.name)||"Unknown"})]}),C.subscription_end_date&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),r.jsx("p",{className:"font-medium",children:un(new Date(C.subscription_end_date),"MMMM d, yyyy")})]}),C.trial_expires_at&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),r.jsx("p",{className:"font-medium",children:un(new Date(C.trial_expires_at),"MMMM d, yyyy")})]}),C.stripe_customer_id&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),r.jsx("p",{className:"font-mono text-sm",children:C.stripe_customer_id})]})]}),C.stripe_customer_id&&r.jsxs(te,{className:"w-full",onClick:()=>k(C.stripe_customer_id),children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},C.id)})})]})})})]}),r.jsx(Un,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:m==null?void 0:m.map(C=>{var T,I;const S=(T=C.managers)==null?void 0:T.some(A=>A.subscription_status==="active"&&(A.subscription_product_id==="prod_Tc08MupgoVySDG"||A.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:r.jsx(na,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:C.name}),r.jsxs(In,{children:[C.agentCount," agents"]})]})]}),r.jsx(Ft,{variant:S?"default":"outline",children:S?"Active Subscription":"No Active Subscription"})]})}),r.jsx(et,{children:((I=C.managers)==null?void 0:I.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),C.managers.map(A=>{const D=kce[A.subscription_product_id];return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:A.email})]}),r.jsx("div",{className:"text-right",children:D?r.jsxs("div",{children:[r.jsx(Ft,{variant:"default",children:D.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:D.price})]}):r.jsx(Ft,{variant:"outline",children:"No Subscription"})})]},A.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},C.id)})})})]})]})})}function Jbt(){const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(""),[c,a]=P.useState("all"),[h,m]=P.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});P.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:C,error:S}=await ee.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(S)throw S;e(C||[]);const T=(C==null?void 0:C.filter(D=>D.status==="qualified").length)||0,I=(C==null?void 0:C.filter(D=>D.status==="pending").length)||0,A=(C==null?void 0:C.filter(D=>D.status==="cancelled").length)||0;m({total:(C==null?void 0:C.length)||0,qualified:T,pending:I,cancelled:A,totalDiscounts:T*25})}catch(C){console.error("Error fetching referrals:",C),He.error("Failed to load referrals")}finally{s(!1)}},v=async()=>{try{He.loading("Processing qualifications...");const{error:C}=await ee.functions.invoke("process-referral-qualifications");if(C)throw C;He.dismiss(),He.success("Qualifications processed successfully"),x()}catch(C){He.dismiss(),console.error("Error processing qualifications:",C),He.error("Failed to process qualifications")}},w=t.filter(C=>{var I,A,D,$,F,q;const S=((A=(I=C.referrer_brokerage)==null?void 0:I.name)==null?void 0:A.toLowerCase().includes(i.toLowerCase()))||(($=(D=C.referred_brokerage)==null?void 0:D.name)==null?void 0:$.toLowerCase().includes(i.toLowerCase()))||((q=(F=C.referred_user)==null?void 0:F.email)==null?void 0:q.toLowerCase().includes(i.toLowerCase())),T=c==="all"||C.status===c;return S&&T}),k=C=>{switch(C){case"qualified":return r.jsxs(Ft,{className:"bg-green-100 text-green-800",children:[r.jsx(Ba,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Ft,{variant:"secondary",children:[r.jsx(Gi,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Ft,{variant:"destructive",children:[r.jsx(Oc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Ft,{children:C})}};return r.jsx(Dr,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(te,{onClick:v,variant:"outline",children:[r.jsx(Fl,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ba,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Gi,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Oc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ad,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",h.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"All Referrals"}),r.jsx(In,{children:"View and manage all referral relationships"})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by brokerage or email...",value:i,onChange:C=>o(C.target.value),className:"pl-10"})]}),r.jsxs(_n,{value:c,onValueChange:a,children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Statuses"}),r.jsx(tr,{value:"pending",children:"Pending"}),r.jsx(tr,{value:"qualified",children:"Qualified"}),r.jsx(tr,{value:"cancelled",children:"Cancelled"})]})]})]}),n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Referrer"}),r.jsx(Mt,{children:"Referred"}),r.jsx(Mt,{children:"Signup Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Qualified Date"}),r.jsx(Mt,{children:"Discount"})]})}),r.jsx(Vs,{children:w.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):w.map(C=>{var S,T,I,A;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:((S=C.referrer_brokerage)==null?void 0:S.name)||"Unknown"}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((T=C.referred_brokerage)==null?void 0:T.name)||((I=C.referred_user)==null?void 0:I.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(A=C.referred_user)==null?void 0:A.email})]})}),r.jsx(yt,{children:un(new Date(C.signup_date),"MMM d, yyyy")}),r.jsx(yt,{children:k(C.status)}),r.jsx(yt,{children:C.qualified_date?un(new Date(C.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(yt,{children:C.discount_applied?r.jsx(Ft,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},C.id)})})]})]})]})]})})}const Nce=[{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"}],ewt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function twt(){const[t,e]=P.useState([]),[n,s]=P.useState(!0),[i,o]=P.useState(!1),[c,a]=P.useState(null),[h,m]=P.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});P.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:A,error:D}=await ee.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(D)throw D;e(A||[])}catch(A){console.error("Error fetching checklist items:",A),He.error("Failed to load checklist items")}finally{s(!1)}},v=()=>{a(null),m({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},w=A=>{a(A),m({title:A.title,description:A.description||"",action_type:A.action_type,target_role:A.target_role,is_active:A.is_active}),o(!0)},k=async()=>{if(!h.title.trim()){He.error("Title is required");return}try{if(c){const{error:A}=await ee.from("onboarding_checklist_items").update({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active}).eq("id",c.id);if(A)throw A;He.success("Checklist item updated")}else{const A=t.filter($=>$.target_role===h.target_role).reduce(($,F)=>Math.max($,F.sort_order),-1),{error:D}=await ee.from("onboarding_checklist_items").insert({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active,sort_order:A+1});if(D)throw D;He.success("Checklist item created")}o(!1),x()}catch(A){console.error("Error saving checklist item:",A),He.error("Failed to save checklist item")}},C=async A=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:D}=await ee.from("onboarding_checklist_items").delete().eq("id",A);if(D)throw D;He.success("Checklist item deleted"),x()}catch(D){console.error("Error deleting checklist item:",D),He.error("Failed to delete checklist item")}},S=async A=>{try{const{error:D}=await ee.from("onboarding_checklist_items").update({is_active:!A.is_active}).eq("id",A.id);if(D)throw D;He.success(A.is_active?"Item deactivated":"Item activated"),x()}catch(D){console.error("Error toggling item:",D),He.error("Failed to update item")}},T=t.filter(A=>A.target_role==="brokerage_manager"),I=t.filter(A=>A.target_role==="agent");return r.jsxs(Dr,{title:"Onboarding Checklist",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Onboarding Checklist"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage checklist items shown to new users on their dashboard"})]}),r.jsxs(te,{onClick:v,className:"gap-2",children:[r.jsx(Mn,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ft,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(et,{children:T.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-12",children:"#"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Action Type"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:T.map((A,D)=>{var $;return r.jsxs(Er,{children:[r.jsx(yt,{className:"text-muted-foreground",children:D+1}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.title}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",children:(($=Nce.find(F=>F.value===A.action_type))==null?void 0:$.label)||A.action_type})}),r.jsx(yt,{children:r.jsx(Js,{checked:A.is_active,onCheckedChange:()=>S(A)})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(A),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C(A.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},A.id)})})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Ft,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(et,{children:I.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-12",children:"#"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Action Type"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:I.map((A,D)=>{var $;return r.jsxs(Er,{children:[r.jsx(yt,{className:"text-muted-foreground",children:D+1}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.title}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",children:(($=Nce.find(F=>F.value===A.action_type))==null?void 0:$.label)||A.action_type})}),r.jsx(yt,{children:r.jsx(Js,{checked:A.is_active,onCheckedChange:()=>S(A)})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(A),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C(A.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},A.id)})})]})})]})]}),r.jsx(Ur,{open:i,onOpenChange:o,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:c?"Edit Checklist Item":"Add Checklist Item"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title *"}),r.jsx(xt,{id:"title",value:h.title,onChange:A=>m({...h,title:A.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",value:h.description,onChange:A=>m({...h,description:A.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Target Role"}),r.jsxs(_n,{value:h.target_role,onValueChange:A=>m({...h,target_role:A}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:ewt.map(A=>r.jsx(tr,{value:A.value,children:A.label},A.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Action Type"}),r.jsxs(_n,{value:h.action_type,onValueChange:A=>m({...h,action_type:A}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:Nce.map(A=>r.jsx(tr,{value:A.value,children:A.label},A.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"is_active",checked:h.is_active,onCheckedChange:A=>m({...h,is_active:A})}),r.jsx(Xe,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(te,{onClick:k,children:c?"Save Changes":"Create Item"})]})]})})]})}function rwt(){const[t,e]=P.useState(""),[n,s]=P.useState("all"),[i,o]=P.useState("name"),[c,a]=P.useState("asc"),[h,m]=P.useState(""),[x,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(""),{data:T}=rr({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:Z,error:re}=await ee.from("brokerages").select("id, name").order("name");if(re)throw re;return Z}}),I=async Z=>{let he=[],ue=0,je=!0;for(;je;){const{data:ne,error:ye}=await Z(ue,ue+1e3-1);if(ye)throw ye;ne&&ne.length>0?(he=[...he,...ne],ue+=1e3,je=ne.length===1e3):je=!1}return he},{data:A,isLoading:D}=rr({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const Z=await I((Se,oe)=>ee.from("profiles").select("id, name, email, brokerage_id, created_at").range(Se,oe)),{data:re}=await ee.from("brokerages").select("id, name"),he=new Map((re==null?void 0:re.map(Se=>[Se.id,Se.name]))||[]),{data:ue}=await ee.rpc("get_admin_contact_counts"),je=new Map;ue==null||ue.forEach(Se=>{je.set(Se.owner_user_id,Se.contact_count)});const{data:ne}=await ee.rpc("get_admin_video_counts"),ye=new Map;ne==null||ne.forEach(Se=>{ye.set(Se.owner_user_id,Se.video_count)});const{data:ie}=await ee.rpc("get_admin_popby_counts"),me=new Map;ie==null||ie.forEach(Se=>{me.set(Se.owner_user_id,Se.popby_count)});const{data:fe}=await ee.rpc("get_admin_listing_counts"),ve=new Map;return fe==null||fe.forEach(Se=>{ve.set(Se.agent_id,Se.listing_count)}),Z.map(Se=>({id:Se.id,name:Se.name||"Unknown",email:Se.email||"",brokerage_id:Se.brokerage_id,brokerage_name:Se.brokerage_id&&he.get(Se.brokerage_id)||null,contact_count:je.get(Se.id)||0,video_count:ye.get(Se.id)||0,popby_count:me.get(Se.id)||0,listing_count:ve.get(Se.id)||0,created_at:Se.created_at}))}}),$=P.useMemo(()=>{if(!A)return[];let Z=A.filter(re=>{const he=t.toLowerCase(),ue=!t||re.name.toLowerCase().includes(he)||re.email.toLowerCase().includes(he),je=n==="all"||n==="none"&&!re.brokerage_id||re.brokerage_id===n,ne=parseInt(h)||0,ye=parseInt(x)||0,ie=parseInt(w)||0,me=parseInt(C)||0,fe=re.contact_count>=ne&&re.video_count>=ye&&re.popby_count>=ie&&re.listing_count>=me;return ue&&je&&fe});return Z.sort((re,he)=>{let ue=0;return i==="name"?ue=re.name.localeCompare(he.name):ue=re[i]-he[i],c==="asc"?ue:-ue}),Z},[A,t,n,i,c,h,x,w,C]),F=Z=>{i===Z?a(c==="asc"?"desc":"asc"):(o(Z),a("desc"))},q=()=>{const Z=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings"],re=$.map(ye=>[ye.name,ye.email,ye.brokerage_name||"None",ye.contact_count,ye.video_count,ye.popby_count,ye.listing_count]),he=[Z.join(","),...re.map(ye=>ye.map(ie=>`"${ie}"`).join(","))].join(` `),ue=new Blob([he],{type:"text/csv"}),je=URL.createObjectURL(ue),ne=document.createElement("a");ne.href=je,ne.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(je)},W=P.useMemo(()=>$.length?$.reduce((Z,re)=>({contacts:Z.contacts+re.contact_count,videos:Z.videos+re.video_count,popbys:Z.popbys+re.popby_count,listings:Z.listings+re.listing_count}),{contacts:0,videos:0,popbys:0,listings:0}):{contacts:0,videos:0,popbys:0,listings:0},[$]),K=({field:Z,children:re})=>r.jsx(Mt,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>F(Z),children:r.jsxs("div",{className:"flex items-center gap-1",children:[re,r.jsx(Ex,{className:`h-3 w-3 ${i===Z?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(In,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:q,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name or email...",value:t,onChange:Z=>e(Z.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(_n,{value:n,onValueChange:s,children:[r.jsxs(yn,{children:[r.jsx(na,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(bn,{placeholder:"Brokerage"})]}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Brokerages"}),r.jsx(tr,{value:"none",children:"No Brokerage"}),T==null?void 0:T.map(Z=>r.jsx(tr,{value:Z.id,children:Z.name},Z.id))]})]})}),r.jsx("div",{children:r.jsx(xt,{type:"number",placeholder:"Min contacts",value:h,onChange:Z=>m(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(xt,{type:"number",placeholder:"Min videos",value:x,onChange:Z=>v(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(xt,{type:"number",placeholder:"Min popbys",value:w,onChange:Z=>k(Z.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-5 text-sm",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:$.length}),r.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.contacts.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Contacts"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.videos.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Videos"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.popbys.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Popbys"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:W.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]})]}),D?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(K,{field:"name",children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(K,{field:"contact_count",children:"Contacts"}),r.jsx(K,{field:"video_count",children:"Videos"}),r.jsx(K,{field:"popby_count",children:"Popbys"}),r.jsx(K,{field:"listing_count",children:"Listings"})]})}),r.jsx(Vs,{children:$.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):$.map(Z=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:Z.name}),r.jsx(yt,{className:"text-muted-foreground",children:Z.email}),r.jsx(yt,{children:Z.brokerage_name?r.jsx(Ft,{variant:"secondary",children:Z.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{children:r.jsx(Ft,{variant:Z.contact_count>0?"default":"outline",children:Z.contact_count})}),r.jsx(yt,{children:r.jsx(Ft,{variant:Z.video_count>0?"default":"outline",children:Z.video_count})}),r.jsx(yt,{children:r.jsx(Ft,{variant:Z.popby_count>0?"default":"outline",children:Z.popby_count})}),r.jsx(yt,{children:r.jsx(Ft,{variant:Z.listing_count>0?"default":"outline",children:Z.listing_count})})]},Z.id))})]})})]})]})}function nwt(){ua(),Qr();const[t,e]=P.useState("user-analytics"),{data:n}=rr({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:k,error:C}=await ee.from("feature_flags").select("*").order("key");if(C)throw C;return k}}),{data:s,isLoading:i}=rr({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:k,error:C}=await ee.from("relationship_types").select("*").order("sort_order");if(C)throw C;return k}}),{data:o,isLoading:c}=rr({queryKey:["admin-action-types"],queryFn:async()=>{const{data:k,error:C}=await ee.from("action_types").select("*").order("sort_order");if(C)throw C;return k}}),{data:a,isLoading:h}=rr({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:k,error:C}=await ee.from("action_scripts").select("*, action_type:action_types(*)");if(C)throw C;return k}}),{data:m,isLoading:x}=rr({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:k,error:C}=await ee.from("touchpoint_plans").select("*").order("name");if(C)throw C;return k}}),{data:v,isLoading:w}=rr({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:k,error:C}=await ee.from("popby_items").select("*").is("owner_user_id",null).order("name");if(C)throw C;return k}});return r.jsx(Dr,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(Oa,{value:t,onValueChange:e,children:[r.jsxs(Ta,{className:"grid w-full grid-cols-9",children:[r.jsxs(xn,{value:"user-analytics",className:"gap-2",children:[r.jsx(nc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(xn,{value:"relationship-types",className:"gap-2",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(xn,{value:"action-types",className:"gap-2",children:[r.jsx(Ma,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(xn,{value:"scripts",className:"gap-2",children:[r.jsx(Si,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(xn,{value:"video-scripts",className:"gap-2",children:[r.jsx(kd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(xn,{value:"plans",className:"gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(xn,{value:"popbys",className:"gap-2",children:[r.jsx(Ua,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(xn,{value:"settings",className:"gap-2",children:[r.jsx(od,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(xn,{value:"feature-flags",className:"gap-2",children:[r.jsx(Px,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(Un,{value:"user-analytics",className:"mt-6",children:r.jsx(rwt,{})}),r.jsx(Un,{value:"relationship-types",className:"mt-6",children:r.jsx(swt,{types:s||[],isLoading:i})}),r.jsx(Un,{value:"action-types",className:"mt-6",children:r.jsx(iwt,{types:o||[],isLoading:c})}),r.jsx(Un,{value:"scripts",className:"mt-6",children:r.jsx(awt,{scripts:a||[],actionTypes:o||[],isLoading:h})}),r.jsx(Un,{value:"video-scripts",className:"mt-6",children:r.jsx(dwt,{})}),r.jsx(Un,{value:"plans",className:"mt-6",children:r.jsx(owt,{plans:m||[],actionTypes:o||[],scripts:a||[],isLoading:x})}),r.jsx(Un,{value:"popbys",className:"mt-6",children:r.jsx(cwt,{items:v||[],isLoading:w})}),r.jsx(Un,{value:"settings",className:"mt-6",children:r.jsx(uwt,{})}),r.jsx(Un,{value:"feature-flags",className:"mt-6",children:r.jsx(lwt,{flags:n||[]})})]})]})})}function swt({types:t,isLoading:e}){const{toast:n}=ua(),s=Qr(),[i,o]=P.useState(null),[c,a]=P.useState(!1),h=dr({mutationFn:async x=>{if(x.id){const{error:v}=await ee.from("relationship_types").update({name:x.name,description:x.description,icon:x.icon}).eq("id",x.id);if(v)throw v}else{const{error:v}=await ee.from("relationship_types").insert([{name:x.name,description:x.description,icon:x.icon,sort_order:t.length}]);if(v)throw v}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),m=async x=>{await ee.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Relationship Types"}),r.jsx(In,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(te,{onClick:()=>{o(null),a(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(et,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-12"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(x=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsx(GS,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(yt,{className:"font-medium",children:x.name}),r.jsx(yt,{className:"text-muted-foreground",children:x.description}),r.jsx(yt,{children:r.jsx(Js,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(yt,{children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(x),a(!0)},children:r.jsx(ya,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Ur,{open:c,onOpenChange:a,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:[i?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const v=new FormData(x.currentTarget);h.mutate({id:i==null?void 0:i.id,name:v.get("name"),description:v.get("description"),icon:v.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"icon",children:"Icon"}),r.jsx(xt,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function iwt({types:t,isLoading:e}){const{toast:n}=ua(),s=Qr(),[i,o]=P.useState(null),[c,a]=P.useState(!1),h=dr({mutationFn:async x=>{if(x.id){const{error:v}=await ee.from("action_types").update({name:x.name,description:x.description,icon:x.icon,color:x.color}).eq("id",x.id);if(v)throw v}else{const{error:v}=await ee.from("action_types").insert([{name:x.name,description:x.description,icon:x.icon,color:x.color,sort_order:t.length}]);if(v)throw v}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),m=async x=>{await ee.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Action Types"}),r.jsx(In,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(te,{onClick:()=>{o(null),a(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(et,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Color"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(x=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:x.name}),r.jsx(yt,{className:"text-muted-foreground",children:x.description}),r.jsx(yt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(yt,{children:r.jsx(Js,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(yt,{children:r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(x),a(!0)},children:r.jsx(ya,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Ur,{open:c,onOpenChange:a,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:[i?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const v=new FormData(x.currentTarget);h.mutate({id:i==null?void 0:i.id,name:v.get("name"),description:v.get("description"),icon:v.get("icon"),color:v.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"icon",children:"Icon"}),r.jsx(xt,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"color",children:"Color"}),r.jsx(xt,{id:"color",name:"color",type:"color",defaultValue:(i==null?void 0:i.color)||"#6366f1"})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function awt({scripts:t,actionTypes:e,isLoading:n}){const{toast:s}=ua(),i=Qr(),[o,c]=P.useState(null),[a,h]=P.useState(!1),m=dr({mutationFn:async v=>{if(v.id){const{error:w}=await ee.from("action_scripts").update({title:v.title,action_type_id:v.action_type_id,tone:v.tone,script_body:v.script_body,active:v.active}).eq("id",v.id);if(w)throw w}else{const{error:w}=await ee.from("action_scripts").insert([{title:v.title,action_type_id:v.action_type_id,tone:v.tone,script_body:v.script_body,active:!0}]);if(w)throw w}},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),h(!1),c(null),s({title:"Saved successfully"})},onError:v=>{s({title:"Error",description:v.message,variant:"destructive"})}}),x=dr({mutationFn:async v=>{const{error:w}=await ee.from("action_scripts").delete().eq("id",v);if(w)throw w},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Script Library"}),r.jsx(In,{children:"Create and manage scripts for each action type"})]}),r.jsxs(te,{onClick:()=>{c(null),h(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Action Type"}),r.jsx(Mt,{children:"Tone"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(v=>{var w;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:v.title}),r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",children:((w=v.action_type)==null?void 0:w.name)||"Unknown"})}),r.jsx(yt,{className:"text-muted-foreground",children:v.tone}),r.jsx(yt,{children:r.jsx(Ft,{variant:v.active?"default":"secondary",children:v.active?"Active":"Inactive"})}),r.jsxs(yt,{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{c(v),h(!0)},children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x.mutate(v.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})]},v.id)})})]})}),r.jsx(Ur,{open:a,onOpenChange:h,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:v=>{v.preventDefault();const w=new FormData(v.currentTarget);m.mutate({id:o==null?void 0:o.id,title:w.get("title"),action_type_id:w.get("action_type_id"),tone:w.get("tone"),script_body:w.get("script_body"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"title",children:"Title"}),r.jsx(xt,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(_n,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select action type"})}),r.jsx(vn,{children:e.map(v=>r.jsx(tr,{value:v.id,children:v.name},v.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(xt,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script_body",children:"Script Body"}),r.jsx(gs,{id:"script_body",name:"script_body",defaultValue:o==null?void 0:o.script_body,rows:8,required:!0,placeholder:`Use {{FirstName}}, {{LastName}}, and {{AgentName}} as placeholders. Example: Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in...`})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:m.isPending,children:[m.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function owt({plans:t,actionTypes:e,scripts:n,isLoading:s}){const{toast:i}=ua(),o=Qr(),[c,a]=P.useState(null),[h,m]=P.useState(!1),[x,v]=P.useState(null),[w,k]=P.useState(!1),[C,S]=P.useState(null),[T,I]=P.useState(null),{data:A}=rr({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:Z,error:re}=await ee.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(re)throw re;return Z},enabled:!!x}),D=dr({mutationFn:async Z=>{if(Z.id){const{error:re}=await ee.from("touchpoint_plans").update({name:Z.name,description:Z.description,active:Z.active}).eq("id",Z.id);if(re)throw re}else{const{error:re}=await ee.from("touchpoint_plans").insert([{name:Z.name,description:Z.description,active:!0}]);if(re)throw re}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),m(!1),a(null),i({title:"Saved successfully"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),$=dr({mutationFn:async Z=>{if(Z.id){const{error:re}=await ee.from("touchpoint_plan_items").update({action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}).eq("id",Z.id);if(re)throw re}else{const{error:re}=await ee.from("touchpoint_plan_items").insert([{plan_id:Z.plan_id,month_number:Z.month_number,action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}]);if(re)throw re}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),i({title:"Item saved"})}}),F=dr({mutationFn:async Z=>{const{error:re}=await ee.from("touchpoint_plan_items").delete().eq("id",Z);if(re)throw re},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),q=dr({mutationFn:async Z=>{const{data:re,error:he}=await ee.from("action_scripts").insert([{...Z,active:!0}]).select().single();if(he)throw he;return re},onSuccess:async Z=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),C&&await $.mutateAsync({id:C.itemId,plan_id:x,month_number:C.month,action_type_id:C.actionTypeId,default_script_id:Z.id}),k(!1),S(null),i({title:"Script created and assigned"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),W=(Z,re,he)=>{S({month:Z,actionTypeId:re,itemId:he}),k(!0)},K=Z=>n.find(re=>re.id===Z);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Touchpoint Plans"}),r.jsx(In,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(te,{onClick:()=>{a(null),m(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(Z=>r.jsxs(Ze,{className:`cursor-pointer transition-colors ${x===Z.id?"border-primary":""}`,onClick:()=>v(Z.id),children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xt,{className:"text-base",children:Z.name}),r.jsx(te,{variant:"ghost",size:"icon",onClick:re=>{re.stopPropagation(),a(Z),m(!0)},children:r.jsx(ya,{className:"h-4 w-4"})})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:Z.description}),r.jsx(Ft,{variant:Z.active?"default":"secondary",className:"mt-2",children:Z.active?"Active":"Inactive"})]})]},Z.id))})})]}),x&&r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Plan Schedule"}),r.jsx(In,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(Z,re)=>re+1).map(Z=>{const re=A==null?void 0:A.find(je=>je.month_number===Z),he=re!=null&&re.default_script_id?K(re.default_script_id):null,ue=n.filter(je=>je.action_type_id===(re==null?void 0:re.action_type_id)&&je.active);return r.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"w-20 font-medium text-sm",children:["Month ",Z]}),r.jsxs(_n,{value:(re==null?void 0:re.action_type_id)||"none",onValueChange:je=>{je==="none"&&re?F.mutate(re.id):je!=="none"&&$.mutate({id:re==null?void 0:re.id,plan_id:x,month_number:Z,action_type_id:je,default_script_id:null})},children:[r.jsx(yn,{className:"w-40",children:r.jsx(bn,{placeholder:"No action"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"No action"}),e.filter(je=>je.active).map(je=>r.jsx(tr,{value:je.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[je.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:je.color}}),je.name]})},je.id))]})]}),re&&r.jsxs(r.Fragment,{children:[r.jsxs(_n,{value:re.default_script_id||"none",onValueChange:je=>{I(null),$.mutate({id:re.id,default_script_id:je==="none"?null:je})},children:[r.jsx(yn,{className:"w-56",children:r.jsx(bn,{placeholder:"Select script"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"No default script"}),ue.map(je=>r.jsxs(tr,{value:je.id,children:[je.title," ",je.tone&&`(${je.tone})`]},je.id))]})]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>W(Z,re.action_type_id,re.id),children:[r.jsx(Mn,{className:"h-3 w-3 mr-1"}),"New Script"]}),he&&r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>I((T==null?void 0:T.id)===he.id?null:he),children:(T==null?void 0:T.id)===he.id?"Hide":"Preview"})]})]}),T&&(re==null?void 0:re.default_script_id)===T.id&&r.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{variant:"outline",children:T.title}),T.tone&&r.jsx(Ft,{variant:"secondary",children:T.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:T.script_body})]})]},Z)})})})]}),r.jsx(Ur,{open:h,onOpenChange:m,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:[c?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const re=new FormData(Z.currentTarget);D.mutate({id:c==null?void 0:c.id,name:re.get("name"),description:re.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",name:"name",defaultValue:c==null?void 0:c.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",name:"description",defaultValue:(c==null?void 0:c.description)||"",rows:3})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:D.isPending,children:[D.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Ur,{open:w,onOpenChange:k,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Create New Script"}),r.jsxs(us,{children:["Create a script for Month ",C==null?void 0:C.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const re=new FormData(Z.currentTarget);q.mutate({title:re.get("title"),action_type_id:C.actionTypeId,tone:re.get("tone"),script_body:re.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script_title",children:"Title"}),r.jsx(xt,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script_tone",children:"Tone"}),r.jsx(xt,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script_body",children:"Script Body"}),r.jsx(gs,{id:"script_body",name:"script_body",rows:6,required:!0,placeholder:"Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in..."})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:q.isPending,children:[q.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function lwt({flags:t}){const{toast:e}=ua(),n=Qr(),s=async(i,o)=>{const{error:c}=await ee.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",i.id);c?e({title:"Error",description:c.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),e({title:"Flag updated"}))};return r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Feature Flags"}),r.jsx(In,{children:"Control which features are enabled for members"})]}),r.jsx(et,{children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Flag"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Notes"}),r.jsx(Mt,{children:"Last Updated"})]})}),r.jsx(Vs,{children:t.map(i=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-mono text-sm",children:i.key}),r.jsx(yt,{children:r.jsx(Js,{checked:i.enabled,onCheckedChange:o=>s(i,{enabled:o})})}),r.jsx(yt,{children:r.jsx(xt,{defaultValue:i.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==i.notes&&s(i,{notes:o.target.value})}})}),r.jsx(yt,{className:"text-muted-foreground text-sm",children:new Date(i.updated_at).toLocaleDateString()})]},i.id))})]})})]})}function cwt({items:t,isLoading:e}){const{toast:n}=ua(),s=Qr(),[i,o]=P.useState(null),[c,a]=P.useState(!1),h=dr({mutationFn:async v=>{if(v.id){const{error:w}=await ee.from("popby_items").update({name:v.name,description:v.description}).eq("id",v.id);if(w)throw w}else{const{error:w}=await ee.from("popby_items").insert([{name:v.name,description:v.description,owner_user_id:null}]);if(w)throw w}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:v=>{n({title:"Error",description:v.message,variant:"destructive"})}}),m=async v=>{await ee.from("popby_items").update({is_active:!v.is_active}).eq("id",v.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},x=async v=>{await ee.from("popby_items").delete().eq("id",v),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Popby Ideas"}),r.jsx(In,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(te,{onClick:()=>{o(null),a(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(et,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ua,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No popby ideas yet. Add your first one!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(v=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:v.name}),r.jsx(yt,{className:"text-muted-foreground",children:v.description}),r.jsx(yt,{children:r.jsx(Js,{checked:v.is_active,onCheckedChange:()=>m(v)})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{o(v),a(!0)},children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x(v.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},v.id))})]})}),r.jsx(Ur,{open:c,onOpenChange:a,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:[i?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:v=>{v.preventDefault();const w=new FormData(v.currentTarget);h.mutate({id:i==null?void 0:i.id,name:w.get("name"),description:w.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function dwt(){var k;const{toast:t}=ua(),e=Qr(),[n,s]=P.useState(null),[i,o]=P.useState(!1),{data:c,isLoading:a}=rr({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:C,error:S}=await ee.from("video_script_categories").select("*").order("sort_order");if(S)throw S;return C}}),{data:h,isLoading:m}=rr({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:C,error:S}=await ee.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(S)throw S;return C}}),x=dr({mutationFn:async C=>{var S,T;if(C.id){const{error:I}=await ee.from("video_scripts").update({title:C.title,script_text:C.script_text,category_id:C.category_id,tags:((S=C.tags)==null?void 0:S.split(",").map(A=>A.trim()).filter(Boolean))||[]}).eq("id",C.id);if(I)throw I}else{const{error:I}=await ee.from("video_scripts").insert([{title:C.title,script_text:C.script_text,category_id:C.category_id||null,tags:((T=C.tags)==null?void 0:T.split(",").map(A=>A.trim()).filter(Boolean))||[]}]);if(I)throw I}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),t({title:"Video script saved!"})},onError:C=>t({title:"Error",description:C.message,variant:"destructive"})}),v=async C=>{await ee.from("video_scripts").update({is_active:!C.is_active}).eq("id",C.id),e.invalidateQueries({queryKey:["admin-video-scripts"]})},w=async C=>{confirm("Delete this video script?")&&(await ee.from("video_scripts").delete().eq("id",C),e.invalidateQueries({queryKey:["admin-video-scripts"]}),t({title:"Script deleted"}))};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Video Scripts"}),r.jsx(In,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(te,{onClick:()=>{s(null),o(!0)},children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:m?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:h==null?void 0:h.map(C=>{var S;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:C.title}),r.jsx(yt,{className:"text-muted-foreground",children:((S=C.category)==null?void 0:S.name)||"Uncategorized"}),r.jsx(yt,{children:r.jsx(Js,{checked:C.is_active,onCheckedChange:()=>v(C)})}),r.jsxs(yt,{className:"flex gap-1",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>{s(C),o(!0)},children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(C.id),children:r.jsx(es,{className:"h-4 w-4"})})]})]},C.id)})})]})}),r.jsx(Ur,{open:i,onOpenChange:o,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:C=>{C.preventDefault();const S=new FormData(C.currentTarget);x.mutate({id:n==null?void 0:n.id,title:S.get("title"),script_text:S.get("script_text"),category_id:S.get("category_id")||null,tags:S.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"title",children:"Title"}),r.jsx(xt,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"category_id",children:"Category"}),r.jsxs(_n,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:c==null?void 0:c.map(C=>r.jsx(tr,{value:C.id,children:C.name},C.id))})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script_text",children:"Script Text"}),r.jsx(gs,{id:"script_text",name:"script_text",defaultValue:n==null?void 0:n.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(xt,{id:"tags",name:"tags",defaultValue:((k=n==null?void 0:n.tags)==null?void 0:k.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(ai,{className:"mt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function uwt(){const{toast:t}=ua(),[e,n]=P.useState(""),[s,i]=P.useState(!0),[o,c]=P.useState(!1);P.useEffect(()=>{(async()=>{i(!0);try{const{data:m}=await ee.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();m!=null&&m.value&&n(m.value)}catch(m){console.error("Error fetching settings:",m)}i(!1)})()},[]);const a=async()=>{c(!0);try{await ee.from("settings").upsert({key:"mapbox_public_token",value:e.trim()}),t({title:"Mapbox token saved!"})}catch{t({title:"Error saving token",variant:"destructive"})}c(!1)};return s?r.jsx(Ze,{children:r.jsx(et,{className:"flex justify-center py-8",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(cl,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(In,{children:"Configure the map feature for popbys"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(xt,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:e,onChange:h=>n(h.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(te,{onClick:a,disabled:o,children:[o&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),e&&r.jsx(Ft,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const hwt=()=>{const[t,e]=P.useState(""),[n,s]=P.useState("grid"),i=ts(),{data:o=[],isLoading:c}=rr({queryKey:["additional-services"],queryFn:async()=>{const{data:h,error:m}=await ee.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(m)throw m;return h}}),a=o.filter(h=>{var x;return h.name.toLowerCase().includes(t.toLowerCase())||((x=h.description)==null?void 0:x.toLowerCase().includes(t.toLowerCase()))});return r.jsx(Dr,{title:"Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Additional Services"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Explore our additional services and offerings"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search services...",value:t,onChange:h=>e(h.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(te,{variant:"outline",size:"sm",onClick:()=>e(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(im,{className:"h-4 w-4"})}),r.jsx(te,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx($f,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," service",a.length!==1?"s":""," found"]}),c&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(4)].map((h,m)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Kr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Kr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Kr,{className:"h-4 w-full mb-4"})]})},m))}),!c&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No services match your search":"No additional services available yet"}),t&&r.jsx(te,{variant:"outline",onClick:()=>e(""),children:"Clear Search"})]}),!c&&a.length>0&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(h=>r.jsxs(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>i(`/additional-services/${h.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:h.preview_image_url?r.jsx("img",{src:h.preview_image_url,alt:h.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(As,{className:"h-8 w-8"})})}),r.jsxs(et,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:h.name}),h.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:jne(h.description)})]})]},h.id))})]})})},fwt=()=>{const{serviceId:t}=hd(),e=ts(),{data:n,isLoading:s}=rr({queryKey:["additional-service",t],queryFn:async()=>{const{data:i,error:o}=await ee.from("additional_services").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;return i},enabled:!!t});return s?r.jsx(Dr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Kr,{className:"h-8 w-48"}),r.jsx(Kr,{className:"h-64 w-full rounded-lg"}),r.jsx(Kr,{className:"h-24 w-full"})]})}):n?r.jsx(Dr,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/additional-services"),className:"gap-2",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(Ze,{className:"overflow-hidden",children:r.jsx("div",{className:"relative bg-muted",children:n.preview_image_url?r.jsx("img",{src:n.preview_image_url,alt:n.name,className:"w-full h-auto max-h-[500px] object-contain mx-auto"}):r.jsx("div",{className:"w-full h-64 flex items-center justify-center text-muted-foreground",children:r.jsx(As,{className:"h-16 w-16"})})})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:n.name}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(li,{className:"h-4 w-4 mr-1"}),"Published ",un(new Date(n.publish_date),"MMMM d, yyyy")]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:n.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(te,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx($s,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Dr,{title:"Not Found",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center py-12",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Service Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"The service you're looking for doesn't exist or has been removed."}),r.jsxs(te,{onClick:()=>e("/additional-services"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},RM=[{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 pwt(){const[t,e]=P.useState(RM[0].id),n=RM.find(s=>s.id===t)||RM[0];return r.jsx(Dr,{title:"AI Toolkit",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(VS,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"AI Toolkit"}),r.jsx("p",{className:"text-muted-foreground",children:"Powerful AI tools to boost your real estate business"})]})]}),r.jsx("div",{className:"md:hidden",children:r.jsxs(_n,{value:t,onValueChange:e,children:[r.jsx(yn,{className:"w-full",children:r.jsx(bn,{placeholder:"Select a tool"})}),r.jsx(vn,{children:RM.map(s=>r.jsx(tr,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(Oa,{value:t,onValueChange:e,className:"w-full",children:r.jsx(Ta,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:RM.map(s=>r.jsx(xn,{value:s.id,className:"flex-1 min-w-[150px] text-xs lg:text-sm whitespace-normal h-auto py-2",children:s.name},s.id))})})}),r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-full max-w-[700px]",dangerouslySetInnerHTML:{__html:n.iframe}})})]})})}const XNe="agent-os-onboarding-completed",ML=[{icon:ug,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:u1,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:fs,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:sm,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:Ua,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"]}],mwt=()=>{const[t,e]=P.useState(!1),[n,s]=P.useState(0),[i,o]=P.useState(!1);P.useEffect(()=>{if(!localStorage.getItem(XNe)){const C=setTimeout(()=>e(!0),500);return()=>clearTimeout(C)}},[]);const c=()=>{n{s(n+1),o(!1)},150)):h()},a=()=>{h()},h=()=>{localStorage.setItem(XNe,"true"),e(!1)},m=ML[n],x=m.icon,v=n===ML.length-1,w=k=>{k||h(),e(k)};return r.jsx(Ur,{open:t,onOpenChange:w,children:r.jsxs(Br,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${m.bgGradient} p-8 pb-12 transition-all duration-500`,children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[r.jsx("div",{className:"absolute -top-4 -right-4 w-32 h-32 bg-white/10 rounded-full blur-2xl animate-pulse"}),r.jsx("div",{className:"absolute -bottom-8 -left-8 w-40 h-40 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl"})]}),r.jsxs("div",{className:`relative mx-auto flex h-20 w-20 items-center justify-center transition-all duration-300 ${i?"scale-75 opacity-0":"scale-100 opacity-100"}`,children:[r.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-2xl blur-xl"}),r.jsx("div",{className:"relative flex h-20 w-20 items-center justify-center rounded-2xl bg-white/20 backdrop-blur-sm border border-white/30 shadow-2xl",children:r.jsx(x,{className:`h-10 w-10 ${m.iconColor} drop-shadow-lg`})})]}),n===0&&r.jsxs("div",{className:"absolute top-4 right-4 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm border border-white/30 text-white text-xs font-medium flex items-center gap-1.5",children:[r.jsx(As,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(Yr,{className:"text-center sm:text-center pb-2",children:[r.jsx(Zr,{className:`text-2xl font-bold transition-all duration-300 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.title}),r.jsx(us,{className:`text-base pt-2 transition-all duration-300 delay-75 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.description})]}),m.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.highlights.map((k,C)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+C*50}ms`},children:[r.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${m.bgGradient} shadow-sm`,children:r.jsx($a,{className:"h-3.5 w-3.5 text-white"})}),r.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:k})]},C))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:ML.map((k,C)=>r.jsx("button",{onClick:()=>{C!==n&&(o(!0),setTimeout(()=>{s(C),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${C===n?"w-8 bg-gradient-to-r "+m.bgGradient:C{const{user:t}=zr();return rr({queryKey:["contact-snoozes",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return e},enabled:!!t})},xwt=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async({contactId:n,days:s})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const i=zl(new Date,s);await ee.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await ee.from("contact_snoozes").insert({contact_id:n,owner_user_id:e.id,snoozed_until:i.toISOString()});if(o)throw o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),t.invalidateQueries({queryKey:["popby-logs"]}),Yi({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{Yi({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},ywt=()=>{const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("contact_snoozes").delete().eq("contact_id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),Yi({title:"Snooze cancelled"})},onError:e=>{Yi({title:"Error cancelling snooze",description:e.message,variant:"destructive"})}})},vwt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function lye({open:t,onOpenChange:e,contactId:n,contactName:s}){const[i,o]=P.useState(null),c=xwt(),a=async()=>{i&&(await c.mutateAsync({contactId:n,days:i}),o(null),e(!1))},h=m=>un(zl(new Date,m),"MMM d, yyyy");return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(Gi,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(us,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:vwt.map(m=>r.jsxs("button",{type:"button",onClick:()=>o(m.days),className:$t("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",i===m.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(li,{className:"h-3.5 w-3.5"}),"Until ",h(m.days)]})]},m.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{onClick:a,disabled:!i||c.isPending,children:c.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const _wt={Crown:Y0,FileText:Si,Users:fs,Globe:rj,Star:Bs,Phone:Ma,MessageSquare:vl,PenTool:sj,Video:Wi,Gift:Ua};function bwt({actions:t,onMarkComplete:e,onViewScript:n,isLoading:s,buildSmsLink:i,buildEmailLink:o}){const c=ts(),[a,h]=P.useState("name"),[m,x]=P.useState("asc"),[v,w]=P.useState(null),[k,C]=P.useState(""),S=$=>{a===$?x(F=>F==="asc"?"desc":"asc"):(h($),x("asc"))},T=P.useMemo(()=>[...t].sort(($,F)=>{var W,K;let q=0;switch(a){case"name":{const Z=`${$.contact.first_name} ${$.contact.last_name||""}`.toLowerCase(),re=`${F.contact.first_name} ${F.contact.last_name||""}`.toLowerCase();q=Z.localeCompare(re);break}case"relationship_type":q=($.relationshipTypeName||"").localeCompare(F.relationshipTypeName||"");break;case"action_type":q=(((W=$.actionType)==null?void 0:W.name)||"").localeCompare(((K=F.actionType)==null?void 0:K.name)||"");break;case"last_touch":q=($.monthNumber||0)-(F.monthNumber||0);break}return m==="asc"?q:-q}),[t,a,m]),I=$=>_wt[$||"Phone"]||Ma,A=({field:$,children:F})=>r.jsxs(te,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>S($),children:[F,a===$?m==="asc"?r.jsx(Ix,{className:"ml-2 h-4 w-4"}):r.jsx(Hw,{className:"ml-2 h-4 w-4"}):r.jsx(Ex,{className:"ml-2 h-4 w-4 opacity-50"})]}),D=($,F,q)=>{w($),C(`${F} ${q||""}`.trim())};return t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/50",children:[r.jsx(Mt,{className:"w-[180px]",children:r.jsx(A,{field:"name",children:"Contact"})}),r.jsx(Mt,{className:"w-[130px]",children:r.jsx(A,{field:"relationship_type",children:"Type"})}),r.jsx(Mt,{className:"w-[120px]",children:r.jsx(A,{field:"action_type",children:"Action"})}),r.jsx(Mt,{className:"w-[130px]",children:"Phone"}),r.jsx(Mt,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Vs,{children:T.map(($,F)=>{var he,ue,je,ne,ye,ie;const q=$.isSpecialDate,W=$.specialDateType,K=q?W==="birthday"?Uh:ui:I(((he=$.actionType)==null?void 0:he.icon)||null),Z=$.contact.phone,re=$.contact.email;return r.jsxs(Er,{className:$t("hover:bg-muted/50 transition-colors",q&&W==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",q&&W==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(yt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>c(`/mission-control/contacts/${$.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[$.contact.first_name," ",$.contact.last_name]})})}),r.jsx(yt,{children:$.relationshipTypeName?r.jsx(Ft,{variant:"secondary",className:"text-xs",children:$.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:q?r.jsx(Ft,{className:$t("gap-1",W==="birthday"&&"bg-pink-500 hover:bg-pink-600",W==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:W==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(Uh,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(ui,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(K,{className:"h-3 w-3"}),(ue=$.actionType)==null?void 0:ue.name]})})}),r.jsx(yt,{children:Z?r.jsx("span",{className:"text-sm font-mono",children:$.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[Z&&r.jsx("a",{href:`tel:${$.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(Ma,{className:"h-3.5 w-3.5"})}),Z&&r.jsx("a",{href:i($.contact.phone,(je=$.script)==null?void 0:je.script_body,$.contact),className:"p-1.5 rounded bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 transition-colors",title:"Text",children:r.jsx(vl,{className:"h-3.5 w-3.5"})}),re&&r.jsx("a",{href:o($.contact.email,(ne=$.script)==null?void 0:ne.script_body,(ye=$.script)==null?void 0:ye.email_subject,(ie=$.actionType)==null?void 0:ie.name,$.contact),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Email",children:r.jsx(oi,{className:"h-3.5 w-3.5"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>D($.contact.id,$.contact.first_name,$.contact.last_name),title:"Snooze",children:r.jsx(Hh,{className:"h-3.5 w-3.5"})}),r.jsxs(te,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var me;return e($.contact.id,$.actionType.id,(me=$.script)==null?void 0:me.id)},disabled:s,children:[r.jsx(Ha,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${$.contact.id}-${F}`)})})]})}),r.jsx(lye,{open:!!v,onOpenChange:$=>!$&&w(null),contactId:v||"",contactName:k})]})}const QNe={Crown:Y0,FileText:Si,Users:fs,Globe:rj,Star:Bs,Phone:Ma,MessageSquare:vl,PenTool:sj,Video:Wi,Gift:Ua},wwt={"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 jwt(){const t=ts(),{user:e}=zr(),{data:n}=Ig(),{data:s}=WOe(),{data:i}=vm(),{data:o}=oxe(),{data:c}=t8e(),a=Rht(),h=e8e(),m=Oht(90),x=XOe(),[v,w]=P.useState(null),[k,C]=P.useState(null),[S,T]=P.useState(!1),[I,A]=P.useState(""),[D,$]=P.useState(!1),[F,q]=P.useState(""),[W,K]=P.useState(fte()),[Z,re]=P.useState("cards"),he=()=>{const Ce=parseInt(F,10);if(isNaN(Ce)||Ce<1){Yi({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}K(Ce),JOe(Ce),$(!1),Yi({title:"Goal updated",description:`Weekly touch goal set to ${Ce}`})},ue=()=>{q(W.toString()),$(!0)};P.useEffect(()=>{(async()=>{if(!(e!=null&&e.id))return;const{data:Je}=await ee.from("profiles").select("name").eq("id",e.id).single();Je!=null&&Je.name&&A(Je.name.split(" ")[0])})()},[e==null?void 0:e.id]),P.useEffect(()=>{a.mutate()},[]);const je=Qh(new Date),ne=zl(je,7),ye=Ce=>{if(!Ce)return null;const Je=new Date(Ce);return new Date(je.getFullYear(),Je.getMonth(),Je.getDate())},ie=(i==null?void 0:i.filter(Ce=>{const Je=ye(Ce.birthday),Ae=ye(Ce.home_anniversary);return Je&&Hl(Je,je)||Ae&&Hl(Ae,je)}))||[],me=(i==null?void 0:i.filter(Ce=>{if(!Ce.birthday&&!Ce.home_anniversary)return!1;const Je=Ae=>{if(!Ae)return!1;const Ye=ye(Ae);return Ye?cte(Ye,je)&&ase(Ye,ne):!1};return Je(Ce.birthday)||Je(Ce.home_anniversary)}).slice(0,5))||[],fe=ie.map(Ce=>{var ge,ft,nt;const Je=ye(Ce.birthday),Ae=Je&&Hl(Je,je),Ye=(o==null?void 0:o.find(Ve=>Ve.name==="Call"))||(o==null?void 0:o[0]);return{contact:Ce,actionType:Ye||{id:"special-date",name:Ae?"Birthday Call":"Anniversary Call",icon:Ae?"Cake":"Home",color:Ae?"#EC4899":"#8B5CF6",description:Ae?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ae?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((nt=(ft=(ge=Ce.tags)==null?void 0:ge[0])==null?void 0:ft.relationship_type)==null?void 0:nt.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Ae?"birthday":"anniversary"}}),Ie=c!==void 0?c||[]:(i==null?void 0:i.slice(0,5).map((Ce,Je)=>{var Ye,ge,ft;const Ae=o==null?void 0:o[Je%((o==null?void 0:o.length)||1)];return Ae?{contact:Ce,actionType:Ae,planName:"Quick Touch",relationshipTypeName:((ft=(ge=(Ye=Ce.tags)==null?void 0:Ye[0])==null?void 0:ge.relationship_type)==null?void 0:ft.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Se=[...fe,...Ie],oe=async(Ce,Je,Ae)=>{await x.mutateAsync({contactId:Ce,actionTypeId:Je,scriptUsedId:Ae}),T(!1),C(null)},ae=Ce=>{Ce.script?(C(Ce),T(!0)):oe(Ce.contact.id,Ce.actionType.id)},Ne=Ce=>QNe[Ce||"Phone"]||Ma,Te=Ce=>QNe[Ce||"Users"]||fs,Be=(Ce,Je)=>Ce.replace(/\{\{FirstName\}\}/g,Je.first_name).replace(/\{\{LastName\}\}/g,Je.last_name||"").replace(/\{\{AgentName\}\}/g,I||"there"),Le=(Ce,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}`})[Ce]||`Hello ${Je}!`,Qe=(Ce,Je,Ae)=>{const Ye=`sms:${Ce}`;if(Je&&Ae){const ge=Be(Je,Ae);return`${Ye}?body=${encodeURIComponent(ge)}`}return Ye},Fe=(Ce,Je,Ae,Ye,ge)=>{const ft=`mailto:${Ce}`,nt=[];if(ge){const Ve=Ae||Le(Ye||"Email",ge.first_name);if(nt.push(`subject=${encodeURIComponent(Ve)}`),Je){const Me=Be(Je,ge);nt.push(`body=${encodeURIComponent(Me)}`)}}return nt.length>0?`${ft}?${nt.join("&")}`:ft};return r.jsxs(Dr,{title:"Mission Control",description:"Your relationship-first contact system",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Mission Control"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your Sphere"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:n==null?void 0:n.filter(Ce=>Ce.active).map(Ce=>{const Je=Te(Ce.icon),Ae=(s==null?void 0:s[Ce.id])||0,Ye=v===Ce.id,ge=wwt[Ce.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Ye?(w(null),t("/mission-control/contacts")):(w(Ce.id),t(`/mission-control/contacts?type=${Ce.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ye?ge:"bg-card hover:bg-accent"} `,children:[r.jsx(Je,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:Ce.name}),r.jsxs("div",{className:`text-sm ${Ye?"opacity-90":"text-muted-foreground"}`,children:[Ae," Contacts"]})]})]},Ce.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(te,{onClick:()=>t("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(kd,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(te,{onClick:()=>t("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Ka,{className:"h-4 w-4 ml-1"})]}),r.jsx(te,{variant:"outline",onClick:()=>t("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(te,{variant:"outline",onClick:()=>t("/mission-control/plans"),className:"w-full",children:"Manage Plans"})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Today in Your InnerCircle"}),c!==void 0&&r.jsxs(Ft,{variant:"outline",className:"gap-1",children:[r.jsx(As,{className:"h-3 w-3"}),"Plan-based"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-1 border rounded-lg p-0.5",children:[r.jsx(te,{variant:Z==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>re("cards"),title:"Card view",children:r.jsx(im,{className:"h-4 w-4"})}),r.jsx(te,{variant:Z==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>re("table"),title:"Table view",children:r.jsx($f,{className:"h-4 w-4"})})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:Se.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),r.jsx(te,{variant:"outline",className:"mt-4",onClick:()=>t("/mission-control/plans"),children:"Manage Plans"})]}):Z==="table"?r.jsx(bwt,{actions:Se,onMarkComplete:oe,onViewScript:ae,isLoading:x.isPending,buildSmsLink:Qe,buildEmailLink:Fe}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Se.map((Ce,Je)=>{var rt,Re,Ge,tt,Et,Lt,Ot;const Ae=Ce.isSpecialDate,Ye=Ce.specialDateType,ge=Ae?Ye==="birthday"?Uh:ui:Ne(((rt=Ce.actionType)==null?void 0:rt.icon)||null),ft=Ce.contact.phone,nt=Ce.contact.email,Ve=Ae?Ye==="birthday"?"#EC4899":"#8B5CF6":((Re=Ce.actionType)==null?void 0:Re.color)||"#3B82F6",Me=Ae?Ye==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Ge=Ce.actionType)==null?void 0:Ge.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Ae?"ring-2 ring-offset-2":""}`,style:Ae?{"--tw-ring-color":Ve}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:Ve},children:[r.jsx(ge,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:Me})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>t(`/mission-control/contacts/${Ce.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Ce.contact.first_name," ",Ce.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[ft&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${Ce.contact.phone}`,className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-primary/10 hover:bg-primary/20 text-primary rounded text-xs font-medium transition-colors",title:"Call",children:[r.jsx(Ma,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:Qe(Ce.contact.phone,(tt=Ce.script)==null?void 0:tt.script_body,Ce.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 rounded text-xs font-medium transition-colors",title:"Text",children:[r.jsx(vl,{className:"h-3 w-3"}),"Text"]})]}),nt&&r.jsxs("a",{href:Fe(Ce.contact.email,(Et=Ce.script)==null?void 0:Et.script_body,(Lt=Ce.script)==null?void 0:Lt.email_subject,(Ot=Ce.actionType)==null?void 0:Ot.name,Ce.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 rounded text-xs font-medium transition-colors",title:"Email",children:[r.jsx(oi,{className:"h-3 w-3"}),"Email"]})]}),!ft&&!nt&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Ce.relationshipTypeName&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:Ce.relationshipTypeName}),Ce.monthNumber>0&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:["Month ",Ce.monthNumber]})]}),Ce.script&&r.jsx(te,{size:"sm",variant:"outline",className:"w-full",onClick:()=>ae(Ce),children:"View Script"}),r.jsx(te,{size:"sm",className:"w-full",onClick:()=>{var Dt;return oe(Ce.contact.id,Ce.actionType.id,(Dt=Ce.script)==null?void 0:Dt.id)},disabled:x.isPending,children:"Mark Complete"})]})]},Ce.contact.id+Je)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsxs(te,{variant:"ghost",className:"h-full w-full",children:[r.jsx(Jm,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(ep,{children:r.jsx(co,{onClick:()=>t("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ze,{className:"md:col-span-2",children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"text-lg",children:"Momentum"}),r.jsxs(Ur,{open:D,onOpenChange:$,children:[r.jsx(Oo,{asChild:!0,children:r.jsx("button",{onClick:ue,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(od,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Br,{className:"sm:max-w-[360px]",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Set Weekly Goal"}),r.jsx(us,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(xt,{id:"weekly-goal-ic",type:"number",min:"1",value:F,onChange:Ce=>q(Ce.target.value),placeholder:"20",onKeyDown:Ce=>{Ce.key==="Enter"&&he()}})]}),r.jsx(te,{onClick:he,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Bc,{value:Math.min(h.actionsThisWeek/W*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(qh,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[h.actionsThisWeek," / ",W]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),h.streak>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-lg",children:"🔥"}),r.jsx("span",{className:"font-medium",children:"Great Job!"}),r.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",h.streak," days)"]})]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(et,{className:"space-y-3",children:[me.length>0?me.map(Ce=>{const Je=Ce.birthday,Ae=Ce.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Je?r.jsx("span",{className:"text-lg",children:"🎂"}):r.jsx("span",{className:"text-lg",children:"🏠"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium",children:[Ce.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",Je?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Je&&Ce.birthday&&un(new Date(Ce.birthday),"MMM d"),Ae&&Ce.home_anniversary&&un(new Date(Ce.home_anniversary),"MMM d")]})]})]},Ce.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),m.count>0&&r.jsxs("button",{onClick:()=>t("/mission-control/contacts?filter=not-touched-90"),className:"flex items-start gap-2 text-sm pt-2 border-t w-full text-left hover:bg-accent/50 -mx-4 px-4 py-2 rounded-md transition-colors",children:[r.jsx(Gi,{className:"h-4 w-4 text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:[m.count," Contact",m.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(m8e,{})]})]}),r.jsx(Ur,{open:S,onOpenChange:T,children:r.jsxs(Br,{className:"max-w-md",children:[r.jsx(Yr,{children:r.jsx(Zr,{className:"flex items-center gap-2",children:k&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.actionType.color||"#3B82F6"}}),k.actionType.name," Script"]})})}),k&&k.script&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",r.jsxs("span",{className:"font-medium text-foreground",children:[k.contact.first_name," ",k.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Be(k.script.script_body,k.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",className:"flex-1",onClick:()=>T(!1),children:"Close"}),r.jsx(te,{className:"flex-1",onClick:()=>{var Ce;return oe(k.contact.id,k.actionType.id,(Ce=k.script)==null?void 0:Ce.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(mwt,{})]})}const lze=()=>{const{user:t}=zr();return rr({queryKey:["popby-items",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${t==null?void 0:t.id}`).eq("is_active",!0).order("name");if(n)throw n;return e},enabled:!!t})},Rse=t=>{const{user:e}=zr();return rr({queryKey:["popby-logs",e==null?void 0:e.id,t],queryFn:async()=>{let n=ee.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(t){const o=new Date;o.setDate(o.getDate()-t),n=n.gte("completed_at",o.toISOString())}const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!e})},cye=()=>{const{user:t}=zr();return rr({queryKey:["relationship-type-popby-defaults",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("relationship_type_popby_defaults").select("*");if(n)throw n;return e},enabled:!!t})},cze=()=>{const{user:t}=zr();return rr({queryKey:["contact-popby-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_popby_settings").select("*");if(n)throw n;return e},enabled:!!t})},dze=()=>{const{data:t}=vm(),{data:e}=Ig(),{data:n}=Rse(),{data:s}=cze(),{data:i}=cye(),o=new Map;n==null||n.forEach(x=>{const v=o.get(x.contact_id);(!v||new Date(x.completed_at)>new Date(v))&&o.set(x.contact_id,x.completed_at)});const c=new Map;i==null||i.forEach(x=>c.set(x.relationship_type_id,x.frequency_days));const a=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{a.set(x.contact_id,x.frequency_days)});const h=Qh(new Date);return(t||[]).map(x=>{let v=90;if(a.has(x.id))v=a.get(x.id);else if(x.tags&&x.tags.length>0){const T=x.tags.map(I=>c.get(I.relationship_type_id)).filter(I=>I!==void 0);T.length>0&&(v=Math.min(...T))}const w=o.get(x.id)||null,k=w?cC(h,Qh(new Date(w))):null,C=k===null||k>=v,S=C&&k!==null?k-v:0;return{...x,lastPopby:w,daysSinceLastPopby:k,frequencyDays:v,isDue:C,daysOverdue:S}}).sort((x,v)=>v.daysOverdue-x.daysOverdue)},uze=()=>dze().filter(e=>e.isDue),kwt=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{error:s}=await ee.from("popby_items").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-items"]}),Yi({title:"Popby item created!"})},onError:n=>{Yi({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},hze=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{error:s}=await ee.from("popby_logs").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-logs"]}),Yi({title:"Popby logged!"})},onError:n=>{Yi({title:"Error logging popby",description:n.message,variant:"destructive"})}})},Nwt=()=>{const t=Qr(),{user:e}=zr();return dr({mutationFn:async n=>{const{error:s}=await ee.from("relationship_type_popby_defaults").upsert({...n,owner_user_id:e==null?void 0:e.id},{onConflict:"relationship_type_id,owner_user_id"});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),Yi({title:"Frequency updated!"})},onError:n=>{Yi({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},Swt=()=>{const{data:t}=Rse(30),e=uze(),n=new Date;n.setDate(n.getDate()-7);const s=(t==null?void 0:t.filter(o=>new Date(o.completed_at)>=n).length)||0,i=(t==null?void 0:t.length)||0;return{thisWeekCount:s,thisMonthCount:i,dueCount:e.length}};function Cwt(){const{user:t}=zr();return rr({queryKey:["contact-touch-logs",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function fze(t){const{data:e}=Cwt(),{data:n}=cze(),{data:s}=cye(),{data:i}=gwt();return P.useMemo(()=>{const o=i==null?void 0:i.find(T=>T.contact_id===t.id),c=o?new Date(o.snoozed_until):null,a=Qh(new Date);if(c&&!ase(c,a))return{nextTouchDate:c,daysUntil:cC(c,a),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:c};const m=((e==null?void 0:e.filter(T=>T.contact_id===t.id))||[]).sort((T,I)=>new Date(I.completed_at).getTime()-new Date(T.completed_at).getTime())[0],x=m?new Date(m.completed_at):null;let v=90;const w=n==null?void 0:n.find(T=>T.contact_id===t.id&&T.is_active);if(w)v=w.frequency_days;else if(t.tags&&t.tags.length>0){const T=t.tags.map(I=>{const A=s==null?void 0:s.find(D=>D.relationship_type_id===I.relationship_type_id);return A==null?void 0:A.frequency_days}).filter(I=>I!==void 0);T.length>0&&(v=Math.min(...T))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:v,lastTouchDate:null,snoozedUntil:null};const k=zl(Qh(x),v),C=cC(k,a);let S;return C<0?S="overdue":C<=7?S="due-soon":S="on-track",{nextTouchDate:k,daysUntil:C,status:S,frequencyDays:v,lastTouchDate:x,snoozedUntil:null}},[t,e,n,s,i])}function Jhe({contact:t}){const e=fze(t),s=(()=>{switch(e.status){case"overdue":return{variant:"destructive",icon:Ul,text:`${Math.abs(e.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Gi,text:e.daysUntil===0?"Due today":`Due in ${e.daysUntil} days`,className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"};case"on-track":return{variant:"secondary",icon:Ha,text:`Next touch in ${e.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:Hh,text:`Snoozed until ${un(e.snoozedUntil,"MMM d")}`,className:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"};case"never-touched":return{variant:"outline",icon:li,text:"Never touched",className:"border-dashed"}}})(),i=s.icon;return r.jsxs(Ft,{variant:s.variant,className:$t("gap-1",s.className),children:[r.jsx(i,{className:"h-3 w-3"}),s.text]})}function Mwt({contact:t,onLogTouch:e,onSnooze:n}){const s=fze(t),i=ywt(),[o,c]=P.useState(!1),a=()=>{switch(s.status){case"overdue":return"text-destructive";case"due-soon":return"text-amber-600 dark:text-amber-400";case"on-track":return"text-emerald-600 dark:text-emerald-400";case"snoozed":return"text-slate-600 dark:text-slate-400";case"never-touched":return"text-muted-foreground"}},h=()=>{switch(s.status){case"overdue":return r.jsx(Ul,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Gi,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(Ha,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(Hh,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(li,{className:"h-5 w-5 text-muted-foreground"})}},m=()=>{switch(s.status){case"overdue":return`${Math.abs(s.daysUntil)} days overdue`;case"due-soon":return s.daysUntil===0?"Due today!":`Due in ${s.daysUntil} days`;case"on-track":return`On track - ${s.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${s.daysUntil} more days`;case"never-touched":return"No touches logged yet"}},x=async()=>{await i.mutateAsync(t.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[h(),r.jsx("span",{className:$t("font-medium",a()),children:m()})]}),s.status==="snoozed"&&s.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",un(s.snoozedUntil,"MMMM d, yyyy")]}),s.status!=="snoozed"&&s.nextTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Scheduled:"})," ",un(s.nextTouchDate,"MMMM d, yyyy")]}),s.lastTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Last touch:"})," ",un(s.lastTouchDate,"MMM d, yyyy")]}),s.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",s.frequencyDays," days"]}),s.status==="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:i.isPending,children:[r.jsx(Es,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),e&&r.jsx(te,{size:"sm",className:"flex-1",onClick:e,children:"Log Touch"})]}),s.status!=="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>c(!0),children:[r.jsx(Hh,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&e&&r.jsx(te,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:e,children:"Log Touch"})]})]})]}),r.jsx(lye,{open:o,onOpenChange:c,contactId:t.id,contactName:`${t.first_name} ${t.last_name||""}`.trim()})]})}const Sce=768;function SI(){const[t,e]=P.useState(void 0);return P.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Sce-1}px)`),s=()=>{e(window.innerWidthn.removeEventListener("change",s)},[]),!!t}const Twt={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"}},Awt={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 JNe({score:t,showScore:e=!1,showTooltip:n=!0,size:s="sm",className:i}){const o=Twt[t.status],c=Awt[s],a=r.jsxs("div",{className:$t("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,c.badge,c.text,i),children:[r.jsx("span",{className:$t("rounded-full",o.bgClass,c.dot)}),e?r.jsx("span",{children:t.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(sI,{children:r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:a}),r.jsx(dm,{side:"top",className:"w-64 p-3",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold",children:"Relationship Score"}),r.jsxs("span",{className:$t("font-bold",o.textClass),children:[t.score,"/100"]})]}),r.jsx(Bc,{value:t.score,className:"h-2"}),r.jsxs("div",{className:"space-y-1.5 text-xs",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Recency"}),r.jsxs("span",{children:[t.breakdown.recency,"/40"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Touchpoints (12mo)"}),r.jsxs("span",{children:[t.breakdown.touchpoints,"/30"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Transactions"}),r.jsxs("span",{children:[t.breakdown.transactions,"/20"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Referrals"}),r.jsxs("span",{children:[t.breakdown.referrals,"/10"]})]})]}),t.daysSinceTouch!==null&&r.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t",children:["Last contact: ",t.daysSinceTouch===0?"Today":`${t.daysSinceTouch} days ago`]}),t.daysSinceTouch===null&&r.jsx("p",{className:"text-xs text-muted-foreground pt-1 border-t italic",children:"Never contacted"})]})})]})}):a}const Ewt=[{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}],Iwt=({open:t,onOpenChange:e,relationshipTypes:n,onSuccess:s})=>{const{user:i}=zr(),{toast:o}=ua(),c=P.useRef(null),[a,h]=P.useState("upload"),[m,x]=P.useState([]),[v,w]=P.useState([]),[k,C]=P.useState({}),[S,T]=P.useState([]),[I,A]=P.useState([]),[D,$]=P.useState(!1),[F,q]=P.useState(null),W=()=>{h("upload"),x([]),w([]),C({}),T([]),A([]),q(null),c.current&&(c.current.value="")},K=()=>{W(),e(!1)},Z=me=>{const fe=me.split(` `).map(oe=>oe.trim()).filter(oe=>oe);if(fe.length===0)return{headers:[],data:[]};const ve=oe=>{const ae=[];let Ne="",Te=!1;for(let Be=0;Be{var Ie;const fe=(Ie=me.target.files)==null?void 0:Ie[0];if(!fe)return;const ve=new FileReader;ve.onload=Se=>{var Be;const oe=(Be=Se.target)==null?void 0:Be.result,{headers:ae,data:Ne}=Z(oe);if(ae.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(ae),w(Ne);const Te={};ae.forEach(Le=>{const Qe=Le.toLowerCase().replace(/[_\s-]/g,"");Qe.includes("firstname")||Qe==="first"?Te.first_name=Le:Qe.includes("lastname")||Qe==="last"?Te.last_name=Le:Qe.includes("email")?Te.email=Le:Qe.includes("phone")||Qe.includes("mobile")||Qe.includes("cell")?Te.phone=Le:Qe.includes("address")||Qe.includes("street")?Te.address=Le:Qe==="city"?Te.city=Le:Qe==="state"||Qe==="province"?Te.state=Le:Qe==="zip"||Qe==="zipcode"||Qe==="postalcode"?Te.zip=Le:Qe.includes("spouse")&&Qe.includes("email")?Te.spouse_email=Le:Qe.includes("spouse")||Qe.includes("partner")?Te.spouse_name=Le:Qe.includes("company")||Qe.includes("organization")||Qe.includes("business")?Te.company_name=Le:Qe.includes("jobtitle")||Qe.includes("title")||Qe.includes("position")?Te.job_title=Le:Qe.includes("birthday")||Qe.includes("dob")||Qe.includes("birthdate")?Te.birthday=Le:Qe.includes("anniversary")||Qe.includes("homeanniversary")?Te.home_anniversary=Le:(Qe.includes("notes")||Qe.includes("comment"))&&(Te.notes=Le)}),C(Te),h("mapping")},ve.readAsText(fe)},he=(me,fe)=>{C(ve=>{if(fe==="none"){const{[me]:Ie,...Se}=ve;return Se}return{...ve,[me]:fe}})},ue=me=>{T(fe=>fe.includes(me)?fe.filter(ve=>ve!==me):[...fe,me])},je=()=>{const me=v.map(fe=>{const ve=oe=>{const ae=k[oe];if(!ae)return"";const Ne=m.indexOf(ae);return Ne>=0?(fe[Ne]||"").trim():""},Ie=ve("first_name"),Se=Ie.length>0;return{first_name:Ie,last_name:ve("last_name"),email:ve("email"),phone:ve("phone"),address:ve("address"),city:ve("city"),state:ve("state"),zip:ve("zip"),spouse_name:ve("spouse_name"),spouse_email:ve("spouse_email"),company_name:ve("company_name"),job_title:ve("job_title"),birthday:ve("birthday"),home_anniversary:ve("home_anniversary"),notes:ve("notes"),isValid:Se,error:Se?void 0:"First name is required"}});A(me),h("preview")},ne=async()=>{if(!(i!=null&&i.id))return;const me=I.filter(Se=>Se.isValid);if(me.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}$(!0);let fe=0,ve=0,Ie=0;try{for(const Se of me)try{let oe=null;if(Se.email){const{data:Ne}=await ee.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("email",Se.email).maybeSingle();oe=Ne}if(!oe&&Se.phone){const{data:Ne}=await ee.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("phone",Se.phone).maybeSingle();oe=Ne}const ae={owner_user_id:i.id,first_name:Se.first_name,last_name:Se.last_name||null,email:Se.email||null,phone:Se.phone||null,address:Se.address||null,city:Se.city||null,state:Se.state||null,zip:Se.zip||null,spouse_name:Se.spouse_name||null,spouse_email:Se.spouse_email||null,company_name:Se.company_name||null,job_title:Se.job_title||null,birthday:Se.birthday||null,home_anniversary:Se.home_anniversary||null,notes:Se.notes||null};if(oe)await ee.from("innercircle_contacts").update(ae).eq("id",oe.id),ve++;else{const{data:Ne}=await ee.from("innercircle_contacts").insert(ae).select("id").single();Ne&&S.length>0&&await ee.from("innercircle_contact_tags").insert(S.map(Te=>({contact_id:Ne.id,relationship_type_id:Te}))),fe++}}catch(oe){console.error("Error importing contact:",oe),Ie++}q({created:fe,updated:ve,failed:Ie}),h("result"),(fe>0||ve>0)&&s(),o({title:"Import Complete",description:`${fe} created, ${ve} updated${Ie>0?`, ${Ie} failed`:""}.`})}catch(Se){console.error("Import error:",Se),o({title:"Import Failed",description:Se.message||"Failed to import contacts",variant:"destructive"})}finally{$(!1)}},ye=I.filter(me=>me.isValid).length,ie=I.filter(me=>!me.isValid).length;return r.jsx(Ur,{open:t,onOpenChange:K,children:r.jsxs(Br,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(J0,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(us,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),a==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:c,onChange:re,className:"hidden"}),r.jsx(Ao,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(te,{onClick:()=>{var me;return(me=c.current)==null?void 0:me.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{const me=`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`,fe=new Blob([me],{type:"text/csv"}),ve=URL.createObjectURL(fe),Ie=document.createElement("a");Ie.href=ve,Ie.download="contact_import_template.csv",Ie.click(),URL.revokeObjectURL(ve)},children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),a==="mapping"&&r.jsxs("div",{className:"flex-1 overflow-auto space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:Ewt.map(me=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(Xe,{className:"w-40 text-sm",children:[me.label,me.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(_n,{value:k[me.key]||"none",onValueChange:fe=>he(me.key,fe),children:[r.jsx(yn,{className:"w-48",children:r.jsx(bn,{placeholder:"Select column..."})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"-- Not mapped --"}),m.map(fe=>r.jsx(tr,{value:fe,children:fe},fe))]})]})]},me.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(me=>r.jsx(Ft,{variant:S.includes(me.id)?"default":"outline",className:"cursor-pointer",onClick:()=>ue(me.id),children:me.name},me.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",v.length," row(s) found in CSV"]})})]}),a==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[ye," valid"]})]}),ie>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Ul,{className:"h-4 w-4"}),r.jsxs("span",{children:[ie," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/30",children:[r.jsx(Mt,{children:"First Name"}),r.jsx(Mt,{children:"Last Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Phone"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Vs,{children:I.slice(0,100).map((me,fe)=>r.jsxs(Er,{children:[r.jsx(yt,{children:me.first_name}),r.jsx(yt,{children:me.last_name}),r.jsx(yt,{children:me.email}),r.jsx(yt,{children:me.phone}),r.jsx(yt,{children:me.isValid?r.jsx(Ft,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ft,{variant:"destructive",children:me.error||"Invalid"})})]},fe))})]}),I.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",I.length," contacts"]})]})]}),a==="result"&&F&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto text-green-500"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground",children:[F.created," contact(s) created, ",F.updated," updated"]}),F.failed>0&&r.jsxs("p",{className:"text-destructive",children:[F.failed," failed to import"]})]}),r.jsxs(ai,{children:[a==="upload"&&r.jsx(te,{variant:"outline",onClick:K,children:"Cancel"}),a==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:W,children:"Back"}),r.jsx(te,{onClick:je,disabled:!k.first_name,children:"Continue"})]}),a==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"outline",onClick:()=>h("mapping"),children:"Back"}),r.jsx(te,{onClick:ne,disabled:D||ye===0,children:D?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${ye} Contact${ye!==1?"s":""}`})]}),a==="result"&&r.jsx(te,{onClick:K,children:"Done"})]})]})})};function Pwt(){const t=ts(),[e]=Pd(),{user:n}=zr(),s=SI(),i=Qr(),o=e.get("type"),c=e.get("filter")??e.get("status"),a=e.get("new")==="true",{contactsWithScores:h,isLoading:m}=dxe(),{data:x}=Ig(),v=GOe(),w=KOe(),k=ZOe(),[C,S]=P.useState(""),[T,I]=P.useState(o||"all"),[A,D]=P.useState(c||"all"),[$,F]=P.useState("name"),[q,W]=P.useState(a),[K,Z]=P.useState(null),[re,he]=P.useState(!1),[ue,je]=P.useState(null),[ne,ye]=P.useState("");P.useEffect(()=>{if(!(n!=null&&n.id))return;const oe=ee.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{i.invalidateQueries({queryKey:["innercircle-contacts"]}),i.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{ee.removeChannel(oe)}},[i,n==null?void 0:n.id]),P.useEffect(()=>{c&&D(c)},[c]);const[ie,me]=P.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",notes:"",tagIds:[]});P.useEffect(()=>{a&&W(!0)},[a]),P.useEffect(()=>{var oe;K&&me({first_name:K.first_name||"",last_name:K.last_name||"",email:K.email||"",phone:K.phone||"",address:K.address||"",city:K.city||"",state:K.state||"",zip_code:K.zip_code||"",birthday:K.birthday||"",home_anniversary:K.home_anniversary||"",notes:K.notes||"",tagIds:((oe=K.tags)==null?void 0:oe.map(ae=>ae.relationship_type_id))||[]})},[K]);const fe=P.useMemo(()=>{if(!h)return[];let oe=h.filter(ae=>{var Be,Le,Qe;const Ne=C===""||`${ae.first_name} ${ae.last_name}`.toLowerCase().includes(C.toLowerCase())||((Be=ae.email)==null?void 0:Be.toLowerCase().includes(C.toLowerCase()))||((Le=ae.phone)==null?void 0:Le.includes(C)),Te=T==="all"||((Qe=ae.tags)==null?void 0:Qe.some(Fe=>Fe.relationship_type_id===T));return Ne&&Te});return A==="not-touched-90"?oe=oe.filter(ae=>{const Ne=ae.relationshipScore.daysSinceTouch;return Ne===null||Ne>90}):A==="at-risk"?oe=oe.filter(ae=>ae.relationshipScore.status==="at-risk"):A==="cooling"?oe=oe.filter(ae=>ae.relationshipScore.status==="cooling"):A==="warm"&&(oe=oe.filter(ae=>ae.relationshipScore.status==="warm")),oe=[...oe].sort((ae,Ne)=>{switch($){case"last-touched":{const Te=ae.relationshipScore.lastTouchDate,Be=Ne.relationshipScore.lastTouchDate;return!Te&&!Be?0:Te?Be?new Date(Te).getTime()-new Date(Be).getTime():1:-1}case"next-touch":{const Te=ae.relationshipScore.daysSinceTouch,Be=Ne.relationshipScore.daysSinceTouch;return Te===null&&Be===null?0:Te===null?-1:Be===null?1:Be-Te}case"score":return ae.relationshipScore.score-Ne.relationshipScore.score;case"date-added":{const Te=ae.created_at,Be=Ne.created_at;return!Te&&!Be?0:Te?Be?new Date(Be).getTime()-new Date(Te).getTime():-1:1}case"name":default:{const Te=`${ae.first_name||""} ${ae.last_name||""}`.toLowerCase(),Be=`${Ne.first_name||""} ${Ne.last_name||""}`.toLowerCase();return Te.localeCompare(Be)}}}),oe},[h,C,T,A,$]),ve=()=>{me({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",notes:"",tagIds:[]})},Ie=async oe=>{oe.preventDefault(),K?(await w.mutateAsync({id:K.id,...ie}),Z(null)):(await v.mutateAsync(ie),W(!1)),ve()},Se=async oe=>{confirm("Are you sure you want to delete this contact?")&&await k.mutateAsync(oe)};return r.jsx(Dr,{title:"Contacts",description:"Manage your InnerCircle contacts",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(id,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name, email, or phone...",value:C,onChange:oe=>S(oe.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:T,onValueChange:I,children:[r.jsx(yn,{className:"w-[160px]",children:r.jsx(bn,{placeholder:"Filter by type"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Types"}),x==null?void 0:x.filter(oe=>oe.active).map(oe=>r.jsx(tr,{value:oe.id,children:oe.name},oe.id))]})]}),r.jsxs(_n,{value:A,onValueChange:D,children:[r.jsx(yn,{className:"w-[160px]",children:r.jsx(bn,{placeholder:"Filter by status"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Status"}),r.jsx(tr,{value:"warm",children:"🟢 Warm"}),r.jsx(tr,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(tr,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(_n,{value:$,onValueChange:F,children:[r.jsx(yn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ex,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(bn,{placeholder:"Sort by"})]})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"name",children:"Name (A-Z)"}),r.jsx(tr,{value:"last-touched",children:"Last Touched"}),r.jsx(tr,{value:"next-touch",children:"Next Touch Due"}),r.jsx(tr,{value:"score",children:"Relationship Score"}),r.jsx(tr,{value:"date-added",children:"Date Added"})]})]}),r.jsxs(te,{onClick:()=>W(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(te,{variant:"outline",onClick:()=>he(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-1"}),"Import CSV"]})]})})}),s?r.jsx("div",{className:"space-y-3",children:m?r.jsx(Ze,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):fe.length===0?r.jsx(Ze,{className:"p-6 text-center text-muted-foreground",children:C||T!=="all"||A!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):fe.map(oe=>{var Ne;const{relationshipScore:ae}=oe;return r.jsx(Ze,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Te=new URLSearchParams;C&&Te.set("search",C),T!=="all"&&Te.set("type",T),A!=="all"&&Te.set("filter",A);const Be=Te.toString();t(`/mission-control/contacts/${oe.id}${Be?`?${Be}`:""}`)},children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[oe.first_name," ",oe.last_name]}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[oe.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(oi,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:oe.email})]}),oe.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Ma,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:oe.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(JNe,{score:ae,size:"sm"}),r.jsx(Jhe,{contact:oe}),(Ne=oe.tags)==null?void 0:Ne.map(Te=>{var Be;return r.jsx(Ft,{variant:"secondary",className:"text-xs",children:(Be=Te.relationship_type)==null?void 0:Be.name},Te.id)})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[ae.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Gi,{className:"h-3 w-3"}),un(new Date(ae.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(li,{className:"h-3 w-3"}),un(new Date(oe.birthday),"MMM d")]}),oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ui,{className:"h-3 w-3"}),un(new Date(oe.home_anniversary),"MMM d")]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1 ml-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Snooze Touch",onClick:Te=>{Te.stopPropagation(),je(oe.id),ye(`${oe.first_name} ${oe.last_name||""}`.trim())},children:r.jsx(Hh,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Te=>{Te.stopPropagation(),Z(oe)},children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Te=>{Te.stopPropagation(),Se(oe.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})]})})},oe.id)})}):r.jsx(Ze,{children:r.jsx(et,{className:"p-0 overflow-x-auto",children:r.jsxs(Us,{className:"min-w-[600px]",children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Contact Info"}),r.jsx(Mt,{children:"Relationship Types"}),r.jsx(Mt,{children:"Last Contact"}),r.jsx(Mt,{children:"Important Dates"}),r.jsx(Mt,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:m?r.jsx(Er,{children:r.jsx(yt,{colSpan:7,className:"text-center py-8",children:"Loading contacts..."})}):fe.length===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:C||T!=="all"||A!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):fe.map(oe=>{var Ne;const{relationshipScore:ae}=oe;return r.jsxs(Er,{className:"cursor-pointer hover:bg-accent/50",onClick:()=>{const Te=new URLSearchParams;C&&Te.set("search",C),T!=="all"&&Te.set("type",T),A!=="all"&&Te.set("status",A);const Be=Te.toString();t(`/mission-control/contacts/${oe.id}${Be?`?${Be}`:""}`)},children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[oe.first_name," ",oe.last_name]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(JNe,{score:ae,size:"sm"}),r.jsx(Jhe,{contact:oe})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[oe.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(oi,{className:"h-3 w-3"}),oe.email]}),oe.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ma,{className:"h-3 w-3"}),oe.phone]})]})}),r.jsx(yt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:(Ne=oe.tags)==null?void 0:Ne.map(Te=>{var Be;return r.jsx(Ft,{variant:"secondary",className:"text-xs",children:(Be=Te.relationship_type)==null?void 0:Be.name},Te.id)})})}),r.jsx(yt,{children:r.jsx("div",{className:"text-sm",children:ae.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Gi,{className:"h-3 w-3"}),un(new Date(ae.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(yt,{children:r.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(li,{className:"h-3 w-3"}),un(new Date(oe.birthday),"MMM d")]}),oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ui,{className:"h-3 w-3"}),un(new Date(oe.home_anniversary),"MMM d")]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",title:"Snooze Touch",onClick:Te=>{Te.stopPropagation(),je(oe.id),ye(`${oe.first_name} ${oe.last_name||""}`.trim())},children:r.jsx(Hh,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:Te=>{Te.stopPropagation(),Z(oe)},children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:Te=>{Te.stopPropagation(),Se(oe.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},oe.id)})})]})})}),r.jsx(Ur,{open:q||!!K,onOpenChange:oe=>{oe||(W(!1),Z(null),ve())},children:r.jsxs(Br,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:K?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:Ie,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"first_name",children:"First Name *"}),r.jsx(xt,{id:"first_name",value:ie.first_name,onChange:oe=>me({...ie,first_name:oe.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"last_name",children:"Last Name"}),r.jsx(xt,{id:"last_name",value:ie.last_name,onChange:oe=>me({...ie,last_name:oe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"email",children:"Email"}),r.jsx(xt,{id:"email",type:"email",value:ie.email,onChange:oe=>me({...ie,email:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone"}),r.jsx(xt,{id:"phone",value:ie.phone,onChange:oe=>me({...ie,phone:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"address",children:"Address"}),r.jsx(xt,{id:"address",value:ie.address,onChange:oe=>me({...ie,address:oe.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"city",children:"City"}),r.jsx(xt,{id:"city",value:ie.city,onChange:oe=>me({...ie,city:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"state",children:"State"}),r.jsx(xt,{id:"state",value:ie.state,onChange:oe=>me({...ie,state:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"zip_code",children:"Zip"}),r.jsx(xt,{id:"zip_code",value:ie.zip_code,onChange:oe=>me({...ie,zip_code:oe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"birthday",children:"Birthday"}),r.jsx(xt,{id:"birthday",type:"date",value:ie.birthday,onChange:oe=>me({...ie,birthday:oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(xt,{id:"home_anniversary",type:"date",value:ie.home_anniversary,onChange:oe=>me({...ie,home_anniversary:oe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(oe=>oe.active).map(oe=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(vc,{checked:ie.tagIds.includes(oe.id),onCheckedChange:ae=>{me(ae?{...ie,tagIds:[...ie.tagIds,oe.id]}:{...ie,tagIds:ie.tagIds.filter(Ne=>Ne!==oe.id)})}}),r.jsx("span",{className:"text-sm",children:oe.name})]},oe.id))})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"notes",children:"Notes"}),r.jsx(gs,{id:"notes",value:ie.notes,onChange:oe=>me({...ie,notes:oe.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>{W(!1),Z(null),ve()},children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:v.isPending||w.isPending,children:[K?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(Iwt,{open:re,onOpenChange:he,relationshipTypes:(x==null?void 0:x.filter(oe=>oe.active))||[],onSuccess:()=>{he(!1)}}),r.jsx(lye,{open:!!ue,onOpenChange:oe=>{oe||je(null)},contactId:ue||"",contactName:ne})]})})}function Lwt(){return rr({queryKey:["video-script-categories"],queryFn:async()=>{const{data:t,error:e}=await ee.from("video_script_categories").select("*").order("sort_order");if(e)throw e;return t}})}function Owt(t){return rr({queryKey:["video-scripts",t],queryFn:async()=>{let e=ee.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:n,error:s}=await e;if(s)throw s;return n}})}function Dwt(){const{user:t}=zr();return rr({queryKey:["user-video-scripts",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await ee.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",t.id).order("title");if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function Rwt(){const{user:t}=zr(),e=Qr();return dr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("user_video_scripts").insert([{owner_user_id:t.id,source_script_id:n.id,category_id:n.category_id,title:n.title,script_text:n.script_text,tags:n.tags,is_custom:!1}]).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["user-video-scripts"]})}})}function Fwt(t){const{user:e}=zr();return rr({queryKey:["agent-videos",e==null?void 0:e.id,t],queryFn:async()=>{if(!(e!=null&&e.id))return[];let n=ee.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",e.id).order("created_at",{ascending:!1});n=n.eq("is_deleted",!1);const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!(e!=null&&e.id)})}function zwt(t){return rr({queryKey:["agent-video",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function pze(){const{user:t}=zr(),e=Qr();return dr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("agent_videos").insert([{owner_user_id:t.id,contact_id:n.contact_id,bunny_video_id:n.bunny_video_id,playback_url:n.playback_url,thumbnail_url:n.thumbnail_url,preview_url:n.preview_url,duration_seconds:n.duration_seconds,file_size_mb:n.file_size_mb||0,title:n.title,notes:n.notes,task_id:n.task_id,status:n.status||"processing",touch_type:n.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function Bwt(){const t=Qr();return dr({mutationFn:async({id:e,bunnyVideoId:n,hardDelete:s=!1})=>{if(console.log("Deleting video:",{id:e,bunnyVideoId:n,hardDelete:s}),n){console.log("Calling bunny-upload delete for videoId:",n);const{data:i,error:o}=await ee.functions.invoke("bunny-upload",{body:{action:"delete",videoId:n,isAgentVideo:!0}});o?console.error("Failed to delete from Bunny:",o):console.log("Bunny delete response:",i)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",e);const{error:i}=await ee.from("agent_videos").delete().eq("id",e);if(i)throw i}else{console.log("Soft deleting from database:",e);const{error:i}=await ee.from("agent_videos").update({is_deleted:!0}).eq("id",e);if(i)throw i}console.log("Video deletion complete")},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function dye(){const{user:t}=zr();return rr({queryKey:["storage-usage",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await ee.from("agent_storage_usage").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e||{user_id:t.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(t!=null&&t.id)})}function $wt(){const{data:t,isLoading:e}=dye(),n=t?t.total_storage_mb0?t.total_storage_mb/t.max_storage_mb*100:0,o=i>=80;return{canRecord:n,remainingMb:s,usagePercent:i,isNearLimit:o,storage:t,isLoading:e}}async function Uwt(t){const{data:e,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:t,isAgentVideo:!0}});if(n)throw n;return e}async function qwt(t){const{data:e,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}async function Vwt(t){const{data:e,error:n}=await ee.functions.invoke("bunny-upload",{body:{action:"status",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}function Hwt(){const{user:t}=zr(),e=Qr();return dr({mutationFn:async({contactId:n,videoId:s,notes:i})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:o}=await ee.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:c,error:a}=await ee.from("contact_touch_logs").insert([{owner_user_id:t.id,contact_id:n,action_type_id:o.id,notes:i||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(a)throw a;return c},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts"]})}})}function Wwt(t){return rr({queryKey:["contact-video-replies",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function Gwt({videoId:t}){var c;const{data:e,isLoading:n,error:s}=zwt(t);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Kr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Kr,{className:"h-4 w-1/3"})]});if(s||!e||e.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Lh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video has been deleted or is no longer available."})]});const i=a=>{let h=a;return h.includes("iframe.mediadelivery.net/play/")&&(h=h.replace("/play/","/embed/"),h+=(h.includes("?")?"&":"?")+"autoplay=true&responsive=true"),h},o=(c=e.playback_url)==null?void 0:c.includes("iframe.mediadelivery.net");return r.jsxs("div",{className:"space-y-4",children:[e.playback_url?r.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?r.jsx("iframe",{src:i(e.playback_url),title:e.title||"Video preview",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:e.playback_url,controls:!0,autoPlay:!0,className:"absolute top-0 left-0 w-full h-full object-contain"})}):r.jsx("div",{className:"w-full aspect-video bg-muted rounded-lg flex items-center justify-center",children:r.jsx("p",{className:"text-muted-foreground",children:"Video is still processing..."})}),e.title&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:e.title}),e.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.notes})]})]})}function Kwt(){var Te,Be;const{contactId:t}=hd(),e=ts(),[n]=Pd(),s=n.get("search")||"",i=n.get("type")||"all",o=n.get("status")||"all",{data:c,isLoading:a}=kht(t||""),{data:h}=Ig(),{data:m}=oxe(),{data:x}=use(365),{data:v}=Rse(365),{data:w}=Wwt(t),{contactsWithScores:k}=dxe(),C=KOe(),S=ZOe(),T=XOe(),[I,A]=P.useState(!1),[D,$]=P.useState({}),[F,q]=P.useState(!1),[W,K]=P.useState(null),[Z,re]=P.useState(""),[he,ue]=P.useState(null),je=Le=>{if(!Le)return null;const Qe=Le.match(/Video ID:\s*([a-f0-9-]+)/i);return Qe?Qe[1]:null},ne=P.useMemo(()=>{if(!k)return[];let Le=k.filter(Qe=>{var Je,Ae,Ye;const Fe=s===""||`${Qe.first_name} ${Qe.last_name}`.toLowerCase().includes(s.toLowerCase())||((Je=Qe.email)==null?void 0:Je.toLowerCase().includes(s.toLowerCase()))||((Ae=Qe.phone)==null?void 0:Ae.includes(s)),Ce=i==="all"||((Ye=Qe.tags)==null?void 0:Ye.some(ge=>ge.relationship_type_id===i));return Fe&&Ce});return o==="not-touched-90"?Le=Le.filter(Qe=>{const Fe=Qe.relationshipScore.daysSinceTouch;return Fe===null||Fe>90}):o==="at-risk"?Le=Le.filter(Qe=>Qe.relationshipScore.status==="at-risk"):o==="cooling"?Le=Le.filter(Qe=>Qe.relationshipScore.status==="cooling"):o==="warm"&&(Le=Le.filter(Qe=>Qe.relationshipScore.status==="warm")),Le.map(Qe=>Qe.id)},[k,s,i,o]),ye=ne.indexOf(t||""),ie=ye>0?ne[ye-1]:null,me=ye1&&ye!==-1,ve=Le=>{const Qe=new URLSearchParams;s&&Qe.set("search",s),i!=="all"&&Qe.set("type",i),o!=="all"&&Qe.set("status",o);const Fe=Qe.toString();return`/mission-control/contacts/${Le}${Fe?`?${Fe}`:""}`},Ie=P.useMemo(()=>{const Le=((x==null?void 0:x.filter(Fe=>Fe.contact_id===t))||[]).map(Fe=>{var Je,Ae;const Ce=je(Fe.notes);return{id:Fe.id,type:"touch",completed_at:Fe.completed_at,name:((Je=Fe.action_type)==null?void 0:Je.name)||"Touch",color:((Ae=Fe.action_type)==null?void 0:Ae.color)||"#3B82F6",notes:Fe.notes,videoId:Ce}}),Qe=((v==null?void 0:v.filter(Fe=>Fe.contact_id===t))||[]).map(Fe=>({id:Fe.id,type:"popby",completed_at:Fe.completed_at,name:"Pop-by",color:"#F97316",notes:Fe.notes,videoId:null}));return[...Le,...Qe].sort((Fe,Ce)=>new Date(Ce.completed_at).getTime()-new Date(Fe.completed_at).getTime())},[x,v,t]),Se=()=>{var Le;c&&($({first_name:c.first_name||"",last_name:c.last_name||"",email:c.email||"",phone:c.phone||"",address:c.address||"",city:c.city||"",state:c.state||"",zip_code:c.zip_code||"",birthday:c.birthday||"",home_anniversary:c.home_anniversary||"",spouse_name:c.spouse_name||"",spouse_email:c.spouse_email||"",company_name:c.company_name||"",job_title:c.job_title||"",notes:c.notes||"",tagIds:((Le=c.tags)==null?void 0:Le.map(Qe=>Qe.relationship_type_id))||[]}),A(!0))},oe=async()=>{await C.mutateAsync({id:t,...D}),A(!1)},ae=async()=>{confirm("Are you sure you want to delete this contact?")&&(await S.mutateAsync(t),e("/mission-control/contacts"))},Ne=async()=>{W&&(await T.mutateAsync({contactId:t,actionTypeId:W,notes:Z}),q(!1),K(null),re(""))};return a?r.jsx(Dr,{title:"Contact Details",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):c?r.jsx(Dr,{title:`${c.first_name} ${c.last_name||""}`,description:"Contact details and activity",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/contacts"),children:[r.jsx(id,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),fe&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ie&&e(ve(ie)),disabled:!ie,className:"px-2",children:[r.jsx(id,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only sm:not-sr-only sm:ml-1",children:"Prev"})]}),r.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[ye+1," of ",ne.length]}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>me&&e(ve(me)),disabled:!me,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Ka,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[r.jsxs(te,{variant:"default",onClick:()=>e(`/mission-control/video/record?contact_id=${t}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Wi,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Ur,{open:F,onOpenChange:q,children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:m==null?void 0:m.filter(Le=>Le.active).map(Le=>r.jsxs("button",{onClick:()=>K(Le.id),className:` p-3 rounded-lg border text-left transition-all ${W===Le.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Le.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Le.description})]},Le.id))})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(gs,{id:"action-notes",value:Z,onChange:Le=>re(Le.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(te,{onClick:Ne,disabled:!W||T.isPending,className:"w-full",children:[r.jsx($a,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(te,{variant:"outline",onClick:Se,children:[r.jsx(Jl,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(te,{variant:"destructive",size:"icon",onClick:ae,children:r.jsx(es,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[c.first_name," ",c.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[c.email&&r.jsxs("a",{href:`mailto:${c.email}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(oi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:c.email})]}),c.phone&&r.jsxs("a",{href:`tel:${c.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(Ma,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:c.phone})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Jhe,{contact:c}),(Te=c.tags)==null?void 0:Te.map(Le=>{const Qe=h==null?void 0:h.find(Fe=>Fe.id===Le.relationship_type_id);return Qe?r.jsx(Ft,{variant:"secondary",className:"text-xs",children:Qe.name},Le.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ze,{className:"md:col-span-2",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Contact Information"})}),r.jsx(et,{children:I?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"first_name",children:"First Name"}),r.jsx(xt,{id:"first_name",value:D.first_name,onChange:Le=>$({...D,first_name:Le.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"last_name",children:"Last Name"}),r.jsx(xt,{id:"last_name",value:D.last_name,onChange:Le=>$({...D,last_name:Le.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"email",children:"Email"}),r.jsx(xt,{id:"email",type:"email",value:D.email,onChange:Le=>$({...D,email:Le.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"phone",children:"Phone"}),r.jsx(xt,{id:"phone",value:D.phone,onChange:Le=>$({...D,phone:Le.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"address",children:"Street Address"}),r.jsx(xt,{id:"address",value:D.address,onChange:Le=>$({...D,address:Le.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(Xe,{htmlFor:"city",children:"City"}),r.jsx(xt,{id:"city",value:D.city,onChange:Le=>$({...D,city:Le.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"state",children:"State"}),r.jsx(xt,{id:"state",value:D.state,onChange:Le=>$({...D,state:Le.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(xt,{id:"zip_code",value:D.zip_code,onChange:Le=>$({...D,zip_code:Le.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"birthday",children:"Birthday"}),r.jsx(xt,{id:"birthday",type:"date",value:D.birthday,onChange:Le=>$({...D,birthday:Le.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(xt,{id:"home_anniversary",type:"date",value:D.home_anniversary,onChange:Le=>$({...D,home_anniversary:Le.target.value})})]})]}),r.jsx(Gd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(xt,{id:"spouse_name",value:D.spouse_name,onChange:Le=>$({...D,spouse_name:Le.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(xt,{id:"spouse_email",type:"email",value:D.spouse_email,onChange:Le=>$({...D,spouse_email:Le.target.value}),placeholder:"Enter spouse email"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"company_name",children:"Company"}),r.jsx(xt,{id:"company_name",value:D.company_name,onChange:Le=>$({...D,company_name:Le.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"job_title",children:"Job Title"}),r.jsx(xt,{id:"job_title",value:D.job_title,onChange:Le=>$({...D,job_title:Le.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:h==null?void 0:h.filter(Le=>Le.active).map(Le=>{var Qe;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(vc,{checked:(Qe=D.tagIds)==null?void 0:Qe.includes(Le.id),onCheckedChange:Fe=>{var Ce;$(Fe?{...D,tagIds:[...D.tagIds||[],Le.id]}:{...D,tagIds:(Ce=D.tagIds)==null?void 0:Ce.filter(Je=>Je!==Le.id)})}}),r.jsx("span",{className:"text-sm",children:Le.name})]},Le.id)})})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"notes",children:"Notes"}),r.jsx(gs,{id:"notes",value:D.notes,onChange:Le=>$({...D,notes:Le.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{onClick:oe,disabled:C.isPending,children:"Save Changes"}),r.jsx(te,{variant:"outline",onClick:()=>A(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ie.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",un(new Date(Ie[0].completed_at),"MMM d, yyyy")," ","(",Ie[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[c.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(oi,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`mailto:${c.email}`,className:"text-primary hover:underline truncate",children:c.email})]}),c.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ma,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`tel:${c.phone}`,className:"text-primary hover:underline",children:c.phone})]})]}),(c.address||c.city||c.state||c.zip_code)&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(cl,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex flex-col",children:[c.address&&r.jsx("span",{children:c.address}),(c.city||c.state||c.zip_code)&&r.jsxs("span",{className:"text-muted-foreground",children:[[c.city,c.state].filter(Boolean).join(", "),c.zip_code&&` ${c.zip_code}`]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.birthday&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",un(new Date(c.birthday),"MMMM d")]})]}),c.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",un(new Date(c.home_anniversary),"MMMM d")]})]})]}),(c.spouse_name||c.spouse_email||c.company_name||c.job_title)&&r.jsxs(r.Fragment,{children:[r.jsx(Gd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(c.spouse_name||c.spouse_email)&&r.jsxs("div",{className:"space-y-1",children:[c.spouse_name&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Spouse: ",c.spouse_name]})]}),c.spouse_email&&r.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[r.jsx(oi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:`mailto:${c.spouse_email}`,className:"text-primary hover:underline",children:c.spouse_email})]})]}),(c.company_name||c.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:c.job_title&&c.company_name?`${c.job_title} at ${c.company_name}`:c.job_title||c.company_name})]})]})]}),r.jsx(Gd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(Be=c.tags)!=null&&Be.length?c.tags.map(Le=>{var Qe;return r.jsx(Ft,{variant:"secondary",children:(Qe=Le.relationship_type)==null?void 0:Qe.name},Le.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),c.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Gd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:c.notes})]})]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mwt,{contact:c,onLogTouch:()=>q(!0)}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Activity Log"})}),r.jsx(et,{children:Ie.length>0?r.jsx("div",{className:"space-y-4",children:Ie.map(Le=>{var Qe;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Le.color},children:Le.type==="popby"?r.jsx(Ua,{className:"h-4 w-4"}):(Qe=Le.name)==null?void 0:Qe.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Le.name}),Le.videoId&&r.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>ue(Le.videoId),children:[r.jsx(wc,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:un(new Date(Le.completed_at),"MMM d, yyyy h:mm a")}),Le.notes&&!Le.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Le.notes})]})]},Le.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),w&&w.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(vl,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:w.map(Le=>{var Qe,Fe;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Qe=Le.video)!=null&&Qe.thumbnail_url?r.jsx("img",{src:Le.video.thumbnail_url,alt:Le.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ue(Le.video_id)}):r.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>ue(Le.video_id),children:r.jsx(Wi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:["Replied to: ",((Fe=Le.video)==null?void 0:Fe.title)||"Untitled Video"]}),r.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>ue(Le.video_id),children:[r.jsx(wc,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:un(new Date(Le.created_at),"MMM d, yyyy h:mm a")}),Le.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Le.message,'"']})]})]},Le.id)})})})]})]}),r.jsx(Ur,{open:!!he,onOpenChange:Le=>!Le&&ue(null),children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Video Preview"})}),he&&r.jsx(Gwt,{videoId:he})]})})]})]})}):r.jsx(Dr,{title:"Contact Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This contact was not found."}),r.jsx(te,{onClick:()=>e("/mission-control/contacts"),children:"Back to Contacts"})]})})}const eSe={Crown:Y0,FileText:Si,Users:fs,Globe:rj,Star:Bs,Phone:Ma,MessageSquare:vl,PenTool:sj,Video:Wi,Gift:Ua},Cce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Zwt(){var Lt,Ot;const t=ts(),{user:e}=zr(),{data:n}=Ig(),{data:s}=Sht(),{data:i}=Pht(),{data:o}=WOe(),{data:c}=oxe(),{data:a}=Nht(),h=Lht(),m=Cht(),x=Tht(),v=Aht(),w=Eht(),k=Iht(),C=Mht(),[S,T]=P.useState(null),[I,A]=P.useState(!1),[D,$]=P.useState(null),[F,q]=P.useState(""),[W,K]=P.useState(""),[Z,re]=P.useState([]),[he,ue]=P.useState(null),[je,ne]=P.useState(null),[ye,ie]=P.useState(!1),[me,fe]=P.useState(""),[ve,Ie]=P.useState(""),[Se,oe]=P.useState(""),[ae,Ne]=P.useState(""),Te=(Dt,kt)=>i==null?void 0:i.some(sr=>sr.plan_id===Dt&&sr.relationship_type_id===kt&&sr.active),Be=Dt=>i==null?void 0:i.find(kt=>kt.relationship_type_id===Dt&&kt.active),Le=async(Dt,kt)=>{const sr=Te(Dt,kt);await h.mutateAsync({planId:Dt,relationshipTypeId:kt,active:!sr})},Qe=(s==null?void 0:s.filter(Dt=>Dt.active&&!Dt.owner_user_id))||[],Fe=(s==null?void 0:s.filter(Dt=>Dt.owner_user_id===(e==null?void 0:e.id)))||[],Ce=n==null?void 0:n.find(Dt=>Dt.id===S),Je=S?Be(S):null,Ae=s==null?void 0:s.find(Dt=>Dt.id===(Je==null?void 0:Je.plan_id)),Ye=async()=>{if(!F.trim())return;const Dt=await m.mutateAsync({name:F,description:W});Dt&&Z.length>0&&await w.mutateAsync({planId:Dt.id,items:Z}),nt()},ge=async()=>{!F.trim()||!D||(await x.mutateAsync({id:D,name:F,description:W}),await w.mutateAsync({planId:D,items:Z}),nt())},ft=Dt=>{var kt;$(Dt.id),q(Dt.name),K(Dt.description||""),re(((kt=Dt.items)==null?void 0:kt.map(sr=>({month_number:sr.month_number,action_type_id:sr.action_type_id,default_script_id:sr.default_script_id||void 0,notes:sr.notes||void 0})))||[]),A(!0)},nt=()=>{A(!1),$(null),q(""),K(""),re([])},Ve=(Dt,kt)=>{ne(kt)},Me=(Dt,kt,sr)=>{re(Pr=>[...Pr.filter(kn=>kn.month_number!==Dt),{month_number:Dt,action_type_id:kt,default_script_id:sr}]),ue(null),ne(null)},rt=Dt=>{re(kt=>kt.filter(sr=>sr.month_number!==Dt))},Re=async()=>{if(!me.trim()||!ve.trim()||!je)return;const Dt=await k.mutateAsync({actionTypeId:je,title:me,scriptBody:ve,emailSubject:Se||void 0,tone:ae||void 0});Dt&&he!==null&&Me(he,je,Dt.id),ie(!1),fe(""),Ie(""),oe(""),Ne("")},Ge=je?a==null?void 0:a.filter(Dt=>Dt.action_type_id===je&&Dt.active):[],tt=Dt=>eSe[Dt||"Phone"]||Ma,Et=Dt=>eSe[Dt||"Users"]||fs;return r.jsxs(Dr,{title:"Touchpoint Plans",description:"Assign plans to your contact groups",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Touchpoint Plans"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(id,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(te,{onClick:()=>A(!0),className:"w-full sm:w-auto",children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Create Custom Plan"]})]}),r.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Your Contact Groups"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a group to assign a touchpoint plan"}),n==null?void 0:n.filter(Dt=>Dt.active).map(Dt=>{const kt=Et(Dt.icon),sr=(o==null?void 0:o[Dt.id])||0,Pr=Be(Dt.id),wn=s==null?void 0:s.find(pn=>pn.id===(Pr==null?void 0:Pr.plan_id)),kn=S===Dt.id;return r.jsxs("button",{onClick:()=>T(Dt.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${kn?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(kt,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:Dt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[sr," contacts"]})]}),wn?r.jsxs(Ft,{variant:"secondary",className:"text-xs",children:[r.jsx(Ba,{className:"h-3 w-3 mr-1"}),wn.name.split(" ")[0]]}):r.jsx(Ft,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},Dt.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:S&&Ce?r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[(()=>{const Dt=Et(Ce.icon);return r.jsx(Dt,{className:"h-5 w-5"})})(),Ce.name," Touchpoint Plan"]}),r.jsxs(In,{children:["Choose a plan for your ",Ce.name," contacts"]})]}),r.jsxs(et,{className:"space-y-6",children:[Ae&&r.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium flex items-center gap-2",children:[r.jsx(Ba,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Ae.name]}),Ae.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ae.description})]}),r.jsx(te,{variant:"outline",size:"sm",onClick:()=>Le(Ae.id,S),children:"Disable"})]}),Ae.items&&Ae.items.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Cce.map((Dt,kt)=>{var kn,pn;const sr=((kn=Ae.items)==null?void 0:kn.filter(qn=>qn.month_number===kt+1))||[],Pr=(pn=sr[0])==null?void 0:pn.action_type,wn=Pr?tt(Pr.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${sr.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:Dt}),wn&&r.jsx(wn,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Pr==null?void 0:Pr.color)||"#3B82F6"}})]},kt)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Ae?"Switch to a Different Plan":"Choose a Plan"}),Qe.length>0&&r.jsxs("div",{className:"space-y-2 mb-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"Pre-built Templates"}),Qe.map(Dt=>{var sr;const kt=(Ae==null?void 0:Ae.id)===Dt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${kt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Dt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((sr=Dt.items)==null?void 0:sr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:C.isPending,onClick:()=>{const Pr=`${Dt.name} (Copy)`;C.mutate({sourcePlanId:Dt.id,newName:Pr})},children:r.jsx(Vl,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:kt?"outline":"default",disabled:kt||h.isPending,onClick:()=>Le(Dt.id,S),children:kt?"Active":"Use This"})]})]},Dt.id)})]}),Fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Fe.map(Dt=>{var sr;const kt=(Ae==null?void 0:Ae.id)===Dt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${kt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Dt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((sr=Dt.items)==null?void 0:sr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>ft(Dt),children:r.jsx(s0,{className:"h-4 w-4"})}),r.jsx(te,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>v.mutate(Dt.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})}),r.jsx(te,{size:"sm",variant:kt?"outline":"default",disabled:kt||h.isPending,onClick:()=>Le(Dt.id,S),children:kt?"Active":"Use This"})]})]},Dt.id)})]}),Qe.length===0&&Fe.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No plans available. Create a custom plan to get started."})]})]})]}):r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(li,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a contact group to view and assign plans"})]})})})]}),r.jsx(Ze,{className:"bg-muted/50",children:r.jsx(et,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx(Ur,{open:I,onOpenChange:Dt=>{Dt?A(!0):nt()},children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:D?"Edit Touchpoint Plan":"Create Custom Touchpoint Plan"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(xt,{id:"plan-name",value:F,onChange:Dt=>q(Dt.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(gs,{id:"plan-description",value:W,onChange:Dt=>K(Dt.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"12-Month Schedule"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),r.jsx("div",{className:"grid grid-cols-6 gap-2",children:Cce.map((Dt,kt)=>{const sr=kt+1,Pr=Z.find(pn=>pn.month_number===sr),wn=Pr?c==null?void 0:c.find(pn=>pn.id===Pr.action_type_id):null,kn=wn?tt(wn.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>ue(he===sr?null:sr),className:` w-full p-3 rounded-lg border text-center transition-all ${Pr?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${he===sr?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:Dt}),kn?r.jsx(kn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(wn==null?void 0:wn.color)||"#3B82F6"}}):r.jsx(Mn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Pr&&r.jsx("button",{type:"button",onClick:pn=>{pn.stopPropagation(),rt(sr)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(Es,{className:"h-3 w-3"})})]},kt)})}),he!==null&&!je&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"text-sm font-medium mb-2",children:["Step 1: Select action for ",Cce[he-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:c==null?void 0:c.filter(Dt=>Dt.active).map(Dt=>{const kt=tt(Dt.icon);return r.jsxs("button",{type:"button",onClick:()=>Ve(he,Dt.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(kt,{className:"h-4 w-4",style:{color:Dt.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:Dt.name})]},Dt.id)})})]}),he!==null&&je&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ne(null),children:[r.jsx(id,{className:"h-4 w-4 mr-1"})," Back"]})]}),r.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-1",children:[r.jsx("button",{type:"button",onClick:()=>Me(he,je),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"No Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Use without a predefined script"})]})}),Ge==null?void 0:Ge.map(Dt=>r.jsx("button",{type:"button",onClick:()=>Me(he,je,Dt.id),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:Dt.title}),Dt.tone&&r.jsx(Ft,{variant:"secondary",className:"text-xs mt-1",children:Dt.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[Dt.script_body.substring(0,100),"..."]})]})},Dt.id)),r.jsxs("button",{type:"button",onClick:()=>ie(!0),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-dashed bg-background hover:bg-accent transition-colors text-left",children:[r.jsx(Mn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),Z.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.length," touchpoint",Z.length!==1?"s":""," per year"]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:nt,children:"Cancel"}),r.jsxs(te,{onClick:D?ge:Ye,disabled:!F.trim()||m.isPending||x.isPending,children:[r.jsx(hg,{className:"h-4 w-4 mr-2"}),D?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Ur,{open:ye,onOpenChange:ie,children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script-title",children:"Script Title"}),r.jsx(xt,{id:"script-title",value:me,onChange:Dt=>fe(Dt.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(_n,{value:ae,onValueChange:Ne,children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select tone..."})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"friendly",children:"Friendly"}),r.jsx(tr,{value:"professional",children:"Professional"}),r.jsx(tr,{value:"casual",children:"Casual"}),r.jsx(tr,{value:"formal",children:"Formal"})]})]})]}),((Ot=(Lt=c==null?void 0:c.find(Dt=>Dt.id===je))==null?void 0:Lt.name)==null?void 0:Ot.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(xt,{id:"script-email-subject",value:Se,onChange:Dt=>oe(Dt.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(Xe,{htmlFor:"script-body",children:"Script Content"}),r.jsx(gs,{id:"script-body",value:ve,onChange:Dt=>Ie(Dt.target.value),placeholder:"Write your script here... You can use {{FirstName}} and {{LastName}} as placeholders.",rows:6}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Tip: Use ","{{FirstName}}"," and ","{{LastName}}"," as placeholders"]})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>ie(!1),children:"Cancel"}),r.jsxs(te,{onClick:Re,disabled:!me.trim()||!ve.trim()||k.isPending,children:[r.jsx(hg,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const Ywt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",Xwt=[{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 Qwt(){const t=ts(),e=uze(),{data:n}=lze(),{data:s}=Ig(),{data:i}=cye(),{data:o}=Rse(90),{data:c}=vm(),a=Swt(),h=hze(),m=kwt(),x=Nwt(),{data:v=[],isLoading:w}=rr({queryKey:["popby-templates"],queryFn:async()=>{const{data:ye,error:ie}=await ee.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",Ywt).order("publish_date",{ascending:!1});if(ie)throw ie;const{data:me}=await ee.from("template_likes").select("template_id"),{data:fe}=await ee.from("template_comments").select("template_id"),ve=new Map;me==null||me.forEach(Se=>{ve.set(Se.template_id,(ve.get(Se.template_id)||0)+1)});const Ie=new Map;return fe==null||fe.forEach(Se=>{Ie.set(Se.template_id,(Ie.get(Se.template_id)||0)+1)}),(ye||[]).map(Se=>({...Se,likesCount:ve.get(Se.id)||0,commentsCount:Ie.get(Se.id)||0}))}}),k=ye=>{const ie=c==null?void 0:c.find(me=>me.id===ye);return ie?`${ie.first_name} ${ie.last_name||""}`.trim():"Unknown"},C=ye=>{if(!ye)return null;const ie=n==null?void 0:n.find(me=>me.id===ye);return(ie==null?void 0:ie.name)||null},[S,T]=P.useState(null),[I,A]=P.useState(!1),[D,$]=P.useState(!1),[F,q]=P.useState(!1),[W,K]=P.useState({popby_item_id:"",notes:""}),[Z,re]=P.useState({name:"",description:""}),he=async()=>{S&&(await h.mutateAsync({contact_id:S.id,popby_item_id:W.popby_item_id||void 0,notes:W.notes||void 0}),A(!1),T(null),K({popby_item_id:"",notes:""}))},ue=async()=>{Z.name.trim()&&(await m.mutateAsync({name:Z.name.trim(),description:Z.description.trim()||void 0}),q(!1),re({name:"",description:""}))},je=async(ye,ie)=>{await x.mutateAsync({relationship_type_id:ye,frequency_days:parseInt(ie)})},ne=ye=>{var me;const ie=i==null?void 0:i.find(fe=>fe.relationship_type_id===ye);return((me=ie==null?void 0:ie.frequency_days)==null?void 0:me.toString())||"90"};return r.jsx(Dr,{title:"Popbys",description:"Drop off gifts to stay top of mind",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Popbys"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:a.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:a.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:a.dueCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(te,{onClick:()=>t("/mission-control/popbys/map"),children:[r.jsx(cl,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(te,{variant:"outline",onClick:()=>$(!0),children:[r.jsx(od,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(te,{variant:"outline",onClick:()=>q(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(Oa,{defaultValue:"due",children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"due",children:"Due for Popby"}),r.jsx(xn,{value:"activity",children:"Recent Activity"}),r.jsx(xn,{value:"library",children:"Popby Library"}),r.jsx(xn,{value:"templates",children:"Popby Templates"})]}),r.jsx(Un,{value:"due",className:"space-y-4 mt-4",children:!e||e.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ua,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No contacts due for a popby right now!"}),r.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):r.jsx("div",{className:"space-y-3",children:e.map(ye=>r.jsx(Ze,{className:"hover:shadow-md transition-shadow",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium",children:[ye.first_name," ",ye.last_name]}),ye.daysOverdue>0&&r.jsxs(Ft,{variant:"destructive",className:"text-xs",children:[ye.daysOverdue,"+ days overdue"]}),ye.daysSinceLastPopby===null&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Never visited"})]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[ye.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(cl,{className:"h-3 w-3"}),ye.city||ye.address]}),ye.tags&&ye.tags.length>0&&r.jsx("span",{children:ye.tags.map(ie=>{var me;return(me=ie.relationship_type)==null?void 0:me.name}).join(", ")})]}),ye.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",un(new Date(ye.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[ye.phone&&r.jsx(te,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${ye.phone}`,children:r.jsx(Ma,{className:"h-4 w-4"})})}),r.jsxs(te,{size:"sm",onClick:()=>{T(ye),A(!0)},children:[r.jsx(Ba,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},ye.id))})}),r.jsx(Un,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Gi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby activity yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Start logging popbys to see your history here."})]})}):r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(et,{className:"space-y-3",children:o.map(ye=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ua,{className:"h-5 w-5 text-orange-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium",children:k(ye.contact_id)}),C(ye.popby_item_id)&&r.jsx(Ft,{variant:"secondary",className:"text-xs",children:C(ye.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:un(new Date(ye.completed_at),"MMM d, yyyy h:mm a")}),ye.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ye.notes})]})]},ye.id))})]})}),r.jsx(Un,{value:"library",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[n==null?void 0:n.map(ye=>r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Ua,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:ye.name}),ye.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ye.description}),!ye.owner_user_id&&r.jsx(Ft,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},ye.id)),r.jsx(Ze,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>q(!0),children:r.jsx(et,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Mn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(Un,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[v.length," template",v.length!==1?"s":""," found"]}),w&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(4)].map((ye,ie)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Kr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Kr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Kr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Kr,{className:"h-5 w-16"}),r.jsx(Kr,{className:"h-5 w-20"})]})]})},ie))}),!w&&v.length===0&&r.jsx(Ze,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(El,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!w&&v.length>0&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:v.map(ye=>r.jsxs(Ze,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>t(`/templates/${ye.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:ye.preview_image_url?r.jsx("img",{src:ye.preview_image_url,alt:ye.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),r.jsxs(et,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:ye.name}),ye.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:jne(ye.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ad,{className:"h-3.5 w-3.5"}),ye.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Wl,{className:"h-3.5 w-3.5"}),ye.commentsCount]})]}),r.jsxs(te,{size:"sm",className:"w-full gap-2",onClick:ie=>{ie.stopPropagation(),t(`/templates/${ye.id}`)},children:[r.jsx($s,{className:"h-4 w-4"}),"View Template"]})]})]},ye.id))})]})]}),r.jsx(Ur,{open:I,onOpenChange:A,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Log Popby for ",S==null?void 0:S.first_name," ",S==null?void 0:S.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Popby Item (optional)"}),r.jsxs(_n,{value:W.popby_item_id,onValueChange:ye=>K(ie=>({...ie,popby_item_id:ye})),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select a popby item..."})}),r.jsx(vn,{children:n==null?void 0:n.map(ye=>r.jsx(tr,{value:ye.id,children:ye.name},ye.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Notes (optional)"}),r.jsx(gs,{placeholder:"Any notes about this popby...",value:W.notes,onChange:ye=>K(ie=>({...ie,notes:ye.target.value}))})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(te,{onClick:he,disabled:h.isPending,children:"Log Popby"})]})]})}),r.jsx(Ur,{open:D,onOpenChange:$,children:r.jsxs(Br,{className:"max-w-md",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Popby Frequency Settings"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),s==null?void 0:s.map(ye=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(Xe,{className:"font-medium",children:ye.name}),r.jsxs(_n,{value:ne(ye.id),onValueChange:ie=>je(ye.id,ie),children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:Xwt.map(ie=>r.jsx(tr,{value:ie.value,children:ie.label},ie.value))})]})]},ye.id))]}),r.jsx(ai,{children:r.jsx(te,{onClick:()=>$(!1),children:"Done"})})]})}),r.jsx(Ur,{open:F,onOpenChange:q,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Name *"}),r.jsx(xt,{placeholder:"e.g., Homemade cookies",value:Z.name,onChange:ye=>re(ie=>({...ie,name:ye.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(gs,{placeholder:"Optional description...",value:Z.description,onChange:ye=>re(ie=>({...ie,description:ye.target.value}))})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(te,{onClick:ue,disabled:!Z.name.trim()||m.isPending,children:"Add Item"})]})]})})]})})}var mze={exports:{}};(function(t,e){(function(n,s){t.exports=s()})(wx,function(){var n,s,i;function o(a,h){if(!n)n=h;else if(!s)s=h;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 = {}; ("+n+")(sharedChunk); ("+s+")(sharedChunk); self.onerror = null;",x={};n(x),i=h(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([m],{type:"text/javascript"})))}}o(["exports"],function(a){var h=1e-6,m=typeof Float32Array<"u"?Float32Array:Array;function x(f,l){var u=l[0],g=l[1],y=l[2],j=l[3],N=u*j-y*g;return N?(f[0]=j*(N=1/N),f[1]=-g*N,f[2]=-y*N,f[3]=u*N,f):null}function v(){var f=new m(9);return m!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[5]=0,f[6]=0,f[7]=0),f[0]=1,f[4]=1,f[8]=1,f}function w(f,l){var u=l[0],g=l[1],y=l[2],j=l[3],N=l[4],E=l[5],R=l[6],B=l[7],H=l[8];return f[0]=N*H-E*B,f[1]=y*B-g*H,f[2]=g*E-y*N,f[3]=E*R-j*H,f[4]=u*H-y*R,f[5]=y*j-u*E,f[6]=j*B-N*R,f[7]=g*R-u*B,f[8]=u*N-g*j,f}function k(f,l,u){var g=l[0],y=l[1],j=l[2],N=l[3],E=l[4],R=l[5],B=l[6],H=l[7],G=l[8],X=u[0],J=u[1],se=u[2],pe=u[3],ke=u[4],we=u[5],Oe=u[6],ze=u[7],qe=u[8];return f[0]=X*g+J*N+se*B,f[1]=X*y+J*E+se*H,f[2]=X*j+J*R+se*G,f[3]=pe*g+ke*N+we*B,f[4]=pe*y+ke*E+we*H,f[5]=pe*j+ke*R+we*G,f[6]=Oe*g+ze*N+qe*B,f[7]=Oe*y+ze*E+qe*H,f[8]=Oe*j+ze*R+qe*G,f}function C(){var f=new m(16);return m!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f}function S(f){var l=new m(16);return l[0]=f[0],l[1]=f[1],l[2]=f[2],l[3]=f[3],l[4]=f[4],l[5]=f[5],l[6]=f[6],l[7]=f[7],l[8]=f[8],l[9]=f[9],l[10]=f[10],l[11]=f[11],l[12]=f[12],l[13]=f[13],l[14]=f[14],l[15]=f[15],l}function T(f){return f[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function I(f,l){var u=l[0],g=l[1],y=l[2],j=l[3],N=l[4],E=l[5],R=l[6],B=l[7],H=l[8],G=l[9],X=l[10],J=l[11],se=l[12],pe=l[13],ke=l[14],we=l[15],Oe=u*E-g*N,ze=u*R-y*N,qe=u*B-j*N,dt=g*R-y*E,it=g*B-j*E,pt=y*B-j*R,wt=H*pe-G*se,St=H*ke-X*se,Gt=H*we-J*se,Pt=G*ke-X*pe,Jt=G*we-J*pe,or=X*we-J*ke,lr=Oe*or-ze*Jt+qe*Pt+dt*Gt-it*St+pt*wt;return lr?(f[0]=(E*or-R*Jt+B*Pt)*(lr=1/lr),f[1]=(y*Jt-g*or-j*Pt)*lr,f[2]=(pe*pt-ke*it+we*dt)*lr,f[3]=(X*it-G*pt-J*dt)*lr,f[4]=(R*Gt-N*or-B*St)*lr,f[5]=(u*or-y*Gt+j*St)*lr,f[6]=(ke*qe-se*pt-we*ze)*lr,f[7]=(H*pt-X*qe+J*ze)*lr,f[8]=(N*Jt-E*Gt+B*wt)*lr,f[9]=(g*Gt-u*Jt-j*wt)*lr,f[10]=(se*it-pe*qe+we*Oe)*lr,f[11]=(G*qe-H*it-J*Oe)*lr,f[12]=(E*St-N*Pt-R*wt)*lr,f[13]=(u*Pt-g*St+y*wt)*lr,f[14]=(pe*ze-se*dt-ke*Oe)*lr,f[15]=(H*dt-G*ze+X*Oe)*lr,f):null}function A(f,l,u){var g=l[0],y=l[1],j=l[2],N=l[3],E=l[4],R=l[5],B=l[6],H=l[7],G=l[8],X=l[9],J=l[10],se=l[11],pe=l[12],ke=l[13],we=l[14],Oe=l[15],ze=u[0],qe=u[1],dt=u[2],it=u[3];return f[0]=ze*g+qe*E+dt*G+it*pe,f[1]=ze*y+qe*R+dt*X+it*ke,f[2]=ze*j+qe*B+dt*J+it*we,f[3]=ze*N+qe*H+dt*se+it*Oe,f[4]=(ze=u[4])*g+(qe=u[5])*E+(dt=u[6])*G+(it=u[7])*pe,f[5]=ze*y+qe*R+dt*X+it*ke,f[6]=ze*j+qe*B+dt*J+it*we,f[7]=ze*N+qe*H+dt*se+it*Oe,f[8]=(ze=u[8])*g+(qe=u[9])*E+(dt=u[10])*G+(it=u[11])*pe,f[9]=ze*y+qe*R+dt*X+it*ke,f[10]=ze*j+qe*B+dt*J+it*we,f[11]=ze*N+qe*H+dt*se+it*Oe,f[12]=(ze=u[12])*g+(qe=u[13])*E+(dt=u[14])*G+(it=u[15])*pe,f[13]=ze*y+qe*R+dt*X+it*ke,f[14]=ze*j+qe*B+dt*J+it*we,f[15]=ze*N+qe*H+dt*se+it*Oe,f}function D(f,l,u){var g,y,j,N,E,R,B,H,G,X,J,se,pe=u[0],ke=u[1],we=u[2];return l===f?(f[12]=l[0]*pe+l[4]*ke+l[8]*we+l[12],f[13]=l[1]*pe+l[5]*ke+l[9]*we+l[13],f[14]=l[2]*pe+l[6]*ke+l[10]*we+l[14],f[15]=l[3]*pe+l[7]*ke+l[11]*we+l[15]):(y=l[1],j=l[2],N=l[3],E=l[4],R=l[5],B=l[6],H=l[7],G=l[8],X=l[9],J=l[10],se=l[11],f[0]=g=l[0],f[1]=y,f[2]=j,f[3]=N,f[4]=E,f[5]=R,f[6]=B,f[7]=H,f[8]=G,f[9]=X,f[10]=J,f[11]=se,f[12]=g*pe+E*ke+G*we+l[12],f[13]=y*pe+R*ke+X*we+l[13],f[14]=j*pe+B*ke+J*we+l[14],f[15]=N*pe+H*ke+se*we+l[15]),f}function $(f,l,u){var g=u[0],y=u[1],j=u[2];return f[0]=l[0]*g,f[1]=l[1]*g,f[2]=l[2]*g,f[3]=l[3]*g,f[4]=l[4]*y,f[5]=l[5]*y,f[6]=l[6]*y,f[7]=l[7]*y,f[8]=l[8]*j,f[9]=l[9]*j,f[10]=l[10]*j,f[11]=l[11]*j,f[12]=l[12],f[13]=l[13],f[14]=l[14],f[15]=l[15],f}function F(f,l,u){var g=Math.sin(u),y=Math.cos(u),j=l[4],N=l[5],E=l[6],R=l[7],B=l[8],H=l[9],G=l[10],X=l[11];return l!==f&&(f[0]=l[0],f[1]=l[1],f[2]=l[2],f[3]=l[3],f[12]=l[12],f[13]=l[13],f[14]=l[14],f[15]=l[15]),f[4]=j*y+B*g,f[5]=N*y+H*g,f[6]=E*y+G*g,f[7]=R*y+X*g,f[8]=B*y-j*g,f[9]=H*y-N*g,f[10]=G*y-E*g,f[11]=X*y-R*g,f}function q(f,l,u){var g=Math.sin(u),y=Math.cos(u),j=l[0],N=l[1],E=l[2],R=l[3],B=l[8],H=l[9],G=l[10],X=l[11];return l!==f&&(f[4]=l[4],f[5]=l[5],f[6]=l[6],f[7]=l[7],f[12]=l[12],f[13]=l[13],f[14]=l[14],f[15]=l[15]),f[0]=j*y-B*g,f[1]=N*y-H*g,f[2]=E*y-G*g,f[3]=R*y-X*g,f[8]=j*g+B*y,f[9]=N*g+H*y,f[10]=E*g+G*y,f[11]=R*g+X*y,f}function W(f,l,u){var g=Math.sin(u),y=Math.cos(u),j=l[0],N=l[1],E=l[2],R=l[3],B=l[4],H=l[5],G=l[6],X=l[7];return l!==f&&(f[8]=l[8],f[9]=l[9],f[10]=l[10],f[11]=l[11],f[12]=l[12],f[13]=l[13],f[14]=l[14],f[15]=l[15]),f[0]=j*y+B*g,f[1]=N*y+H*g,f[2]=E*y+G*g,f[3]=R*y+X*g,f[4]=B*y-j*g,f[5]=H*y-N*g,f[6]=G*y-E*g,f[7]=X*y-R*g,f}function K(f,l){return f[0]=l[0],f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=l[1],f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=l[2],f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function Z(f,l,u){var g,y,j,N=u[0],E=u[1],R=u[2],B=Math.sqrt(N*N+E*E+R*R);return B0&&(j=1/Math.sqrt(j)),f[0]=l[0]*j,f[1]=l[1]*j,f[2]=l[2]*j,f}function Ce(f,l){return f[0]*l[0]+f[1]*l[1]+f[2]*l[2]}function Je(f,l,u){var g=l[0],y=l[1],j=l[2],N=u[0],E=u[1],R=u[2];return f[0]=y*R-j*E,f[1]=j*N-g*R,f[2]=g*E-y*N,f}function Ae(f,l,u,g){var y=l[0],j=l[1],N=l[2];return f[0]=y+g*(u[0]-y),f[1]=j+g*(u[1]-j),f[2]=N+g*(u[2]-N),f}function Ye(f,l,u){var g=l[0],y=l[1],j=l[2],N=u[3]*g+u[7]*y+u[11]*j+u[15];return f[0]=(u[0]*g+u[4]*y+u[8]*j+u[12])/(N=N||1),f[1]=(u[1]*g+u[5]*y+u[9]*j+u[13])/N,f[2]=(u[2]*g+u[6]*y+u[10]*j+u[14])/N,f}function ge(f,l,u){var g=l[0],y=l[1],j=l[2];return f[0]=g*u[0]+y*u[3]+j*u[6],f[1]=g*u[1]+y*u[4]+j*u[7],f[2]=g*u[2]+y*u[5]+j*u[8],f}function ft(f,l,u){var g=u[0],y=u[1],j=u[2],N=u[3],E=l[0],R=l[1],B=l[2],H=y*B-j*R,G=j*E-g*B,X=g*R-y*E;return f[0]=E+N*(H+=H)+y*(X+=X)-j*(G+=G),f[1]=R+N*G+j*H-g*X,f[2]=B+N*X+g*G-y*H,f}function nt(f){return f[0]=0,f[1]=0,f[2]=0,f}function Ve(f,l){return f[0]===l[0]&&f[1]===l[1]&&f[2]===l[2]}var Me=ve,rt=Ie,Re=ye;function Ge(){var f=new m(4);return m!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function tt(f,l,u){return f[0]=l[0]*u,f[1]=l[1]*u,f[2]=l[2]*u,f[3]=l[3]*u,f}function Et(f,l){var u=l[0],g=l[1],y=l[2],j=l[3],N=u*u+g*g+y*y+j*j;return N>0&&(N=1/Math.sqrt(N)),f[0]=u*N,f[1]=g*N,f[2]=y*N,f[3]=j*N,f}function Lt(f,l,u){var g=l[0],y=l[1],j=l[2],N=l[3];return f[0]=u[0]*g+u[4]*y+u[8]*j+u[12]*N,f[1]=u[1]*g+u[5]*y+u[9]*j+u[13]*N,f[2]=u[2]*g+u[6]*y+u[10]*j+u[14]*N,f[3]=u[3]*g+u[7]*y+u[11]*j+u[15]*N,f}function Ot(){var f=new m(4);return m!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function Dt(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function kt(f,l,u){u*=.5;var g=l[0],y=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return f[0]=g*R+N*E,f[1]=y*R+j*E,f[2]=j*R-y*E,f[3]=N*R-g*E,f}function sr(f,l,u){u*=.5;var g=l[0],y=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return f[0]=g*R-j*E,f[1]=y*R+N*E,f[2]=j*R+g*E,f[3]=N*R-y*E,f}je(),Ge();var Pr,wn,kn,pn=Et,qn=(Pr=je(),wn=ie(1,0,0),kn=ie(0,1,0),function(f,l,u){var g=Ce(l,u);return g<-.999999?(Je(Pr,wn,l),Re(Pr)<1e-6&&Je(Pr,kn,l),Fe(Pr,Pr),function(y,j,N){N*=.5;var E=Math.sin(N);y[0]=E*j[0],y[1]=E*j[1],y[2]=E*j[2],y[3]=Math.cos(N)}(f,Pr,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(Je(Pr,l,u),f[0]=Pr[0],f[1]=Pr[1],f[2]=Pr[2],f[3]=1+g,pn(f,f))});function Fs(){var f=new m(2);return m!=Float32Array&&(f[0]=0,f[1]=0),f}function _r(f,l){var u=new m(2);return u[0]=f,u[1]=l,u}function js(f,l,u){return f[0]=l,f[1]=u,f}function Ii(f,l,u){return f[0]=l[0]+u[0],f[1]=l[1]+u[1],f}function fi(f,l,u){return f[0]=l[0]-u[0],f[1]=l[1]-u[1],f}function Aa(f,l,u){return f[0]=l[0]*u,f[1]=l[1]*u,f}function ca(f){var l=f[0],u=f[1];return Math.sqrt(l*l+u*u)}function Yo(f,l){var u=l[0],g=l[1],y=u*u+g*g;return y>0&&(y=1/Math.sqrt(y)),f[0]=l[0]*y,f[1]=l[1]*y,f}function Xo(f,l){return f[0]*l[0]+f[1]*l[1]}Ot(),Ot(),v();var Hs,Ki,bs=fi;function Ci(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}Fs();var Mi=function(){if(Ki)return Hs;function f(l,u,g,y){this.cx=3*l,this.bx=3*(g-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(y-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=u,this.p2x=g,this.p2y=y}return Ki=1,Hs=f,f.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,u){if(u===void 0&&(u=1e-6),l<0)return 0;if(l>1)return 1;for(var g=l,y=0;y<8;y++){var j=this.sampleCurveX(g)-l;if(Math.abs(j)j?E=g:R=g,g=.5*(R-E)+E;return g},solve:function(l,u){return this.sampleCurveY(this.solveCurveX(l,u))}},Hs}(),Eo=Ci(Mi);function ir(f,l){this.x=f,this.y=l}function ho(f,l){if(Array.isArray(f)){if(!Array.isArray(l)||f.length!==l.length)return!1;for(let u=0;u=1)return 1;const l=f*f,u=l*f;return 4*(f<.5?u:3*(f-l)+u-.75)}function Vn(f,l,u,g){const y=new Eo(f,l,u,g);return function(j){return y.solve(j)}}const bt=Vn(.25,.1,.25,1);function _e(f,l,u){return Math.min(u,Math.max(l,f))}function De(f,l,u){return(u=_e((u-f)/(l-f),0,1))*u*(3-2*u)}function We(f,l,u){const g=u-l,y=((f-l)%g+g)%g+l;return y===l?u:y}function vt(f,l,u){if(!f.length)return u(null,[]);let g=f.length;const y=new Array(f.length);let j=null;f.forEach((N,E)=>{l(N,(R,B)=>{R&&(j=R),y[E]=B,--g==0&&u(j,y)})})}let gt=1;function Ct(){return gt++}function Bt(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function At(f,l){f.forEach(u=>{l[u]&&(l[u]=l[u].bind(l))})}function Ut(f,l,u){const g={};for(const y in f)g[y]=l.call(this,f[y],y,f);return g}function mr(f,l,u){const g={};for(const y in f)l.call(this,f[y],y,f)&&(g[y]=f[y]);return g}function ar(f){return Array.isArray(f)?f.map(ar):typeof f=="object"&&f?Ut(f,ar):f}function Gr(f,l){for(let u=0;u=0)return!0;return!1}const en={};function $r(f){en[f]||(typeof console<"u"&&console.warn(f),en[f]=!0)}function Qn(f,l,u){return(u.y-f.y)*(l.x-f.x)>(l.y-f.y)*(u.x-f.x)}function Zn(f){let l=0;for(let u,g,y=0,j=f.length,N=j-1;y@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(u,g,y,j)=>{const N=y||j;return l[g]=!N||N.toLowerCase(),""}),l["max-age"]){const u=parseInt(l["max-age"],10);isNaN(u)?delete l["max-age"]:l["max-age"]=u}return l}let Va=null;function Ea(f,l){return[f[4*l],f[4*l+1],f[4*l+2],f[4*l+3]]}function oo(f,l,u,g){for(;l>1;f[y]>1;f[y]<=g?l=y+1:u=y}return l}function Ws(f){return f>0?1/(1.001-f):1+f}function ha(f){return f>0?1-1/(1.001-f):-f}function Fi(f,l,u){return(f-l.min)*(u.max-u.min)/(l.max-l.min)+u.min}const ks={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(!ks.API_URL)return null;try{const f=new URL(ks.API_URL);return f.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":f.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ra(f){return ks.API_URL_REGEX.test(f)}function bl(f){return ks.API_SPRITE_REGEX.test(f)}let Pl,Sc,np,Qo,pd,Jo;function ru(){return Pl==null&&(Pl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Pl}const Do={now:()=>Qo!==void 0?Qo:performance.now(),setNow(f){Qo=f},restoreNow(){Qo=void 0},frame(f){const l=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(l)}},getImageData(f,l=0){const{width:u,height:g}=f;pd||(pd=document.createElement("canvas"));const y=pd.getContext("2d",{willReadFrequently:!0});if(!y)throw new Error("failed to create canvas 2d context");return(u>pd.width||g>pd.height)&&(pd.width=u,pd.height=g),y.clearRect(-l,-l,u+2*l,g+2*l),y.drawImage(f,0,0,u,g),y.getImageData(-l,-l,u+2*l,g+2*l)},resolveURL:f=>(Sc||(Sc=document.createElement("a")),Sc.href=f,Sc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(np==null&&(np=window.matchMedia("(prefers-reduced-motion: reduce)")),np.matches)},hasCanvasFingerprintNoise(){if(Jo!==void 0)return Jo;if(!ru())return Jo=!1,!1;const f=new OffscreenCanvas(85,1),l=f.getContext("2d",{willReadFrequently:!0});let u=0;for(let y=0;y0?`?${j}`:""}`}const Yl="mapbox-tiles";let sp=500,wm=50;const Uc=["language","worldview","jobid"];let zu,Cc;function qc(){try{return caches}catch{}}function md(){const f=qc();f&&zu==null&&(zu=f.open(Yl))}let Dd=1/0;const nu={supported:!1,testSupport:function(f){!dy&&ip&&(ap?sk(f):Bu=f)}};let Bu,ip,dy=!1,ap=!1;const op=typeof self<"u"?self:{};function sk(f){const l=f.createTexture();f.bindTexture(f.TEXTURE_2D,l);try{if(f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,ip),f.isContextLost())return;nu.supported=!0}catch{}f.deleteTexture(l),dy=!0}op.document&&(ip=op.document.createElement("img"),ip.onload=function(){Bu&&sk(Bu),Bu=null,ap=!0},ip.onerror=function(){dy=!0,Bu=null},ip.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Og={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(Og);class Vc extends Error{constructor(l,u,g){u===401&&Ra(g)&&(l+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(l),this.status=u,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const uy=Os()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,lp=function(f,l){if(!(/^file:/.test(u=f.url)||/^file:/.test(uy())&&!/^\w+:/.test(u))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,y){const j=new AbortController,N=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:uy(),referrerPolicy:g.referrerPolicy,signal:j.signal});let E=!1,R=!1;const B=(H=N.url).indexOf("sku=")>0&&Ra(H);var H;g.type==="json"&&N.headers.set("Accept","application/json");const G=(J,se,pe)=>{if(R)return;if(J&&J.message!=="SecurityError"&&$r(J.toString()),se&&pe)return X(se);const ke=Date.now();fetch(N).then(we=>{if(we.ok){const Oe=B?we.clone():null;return X(we,Oe,ke)}return y(new Vc(we.statusText,we.status,g.url))}).catch(we=>{we.name!=="AbortError"&&y(new Error(`${we.message} ${g.url}`))})},X=(J,se,pe)=>{(g.type==="arrayBuffer"?J.arrayBuffer():g.type==="json"?J.json():J.text()).then(ke=>{R||(se&&pe&&function(we,Oe,ze){if(md(),zu==null)return;const qe=ja(Oe.headers.get("Cache-Control")||"");if(qe["no-store"])return;const dt={status:Oe.status,statusText:Oe.statusText,headers:new Headers};Oe.headers.forEach((wt,St)=>dt.headers.set(St,wt)),qe["max-age"]&&dt.headers.set("Expires",new Date(ze+1e3*qe["max-age"]).toUTCString());const it=dt.headers.get("Expires");if(!it||new Date(it).getTime()-ze<42e4)return;let pt=Fu(we.url,{persistentParams:Uc});if(Oe.status===206){const wt=we.headers.get("Range");if(!wt)return;dt.status=200,pt=sf(pt,{range:wt})}(function(wt,St){if(Cc===void 0)try{new Response(new ReadableStream),Cc=!0}catch{Cc=!1}Cc?St(wt.body):wt.blob().then(St).catch(Gt=>$r(Gt.message))})(Oe,wt=>{const St=new Response((Gt=Oe.status)!==200&&Gt!==404&&[101,103,204,205,304].includes(Gt)?null:wt,dt);var Gt;md(),zu!=null&&zu.then(Pt=>Pt.put(pt,St)).catch(Pt=>$r(Pt.message))})}(N,se,pe),E=!0,y(null,ke,J.headers))}).catch(ke=>{R||y(new Error(ke.message))})};return B?function(J,se){if(md(),zu==null)return se(null);zu.then(pe=>{let ke=Fu(J.url,{persistentParams:Uc});const we=J.headers.get("Range");we&&(ke=sf(ke,{range:we})),pe.match(ke).then(Oe=>{const ze=function(qe){if(!qe)return!1;const dt=new Date(qe.headers.get("Expires")||0),it=ja(qe.headers.get("Cache-Control")||"");return Number(dt)>Date.now()&&!it["no-cache"]}(Oe);pe.delete(ke).catch(se),ze&&pe.put(ke,Oe.clone()).catch(se),se(null,Oe,ze)}).catch(se)}).catch(se)}(N,G):G(null,null),{cancel:()=>{R=!0,E||j.abort()}}}(f,l);if(Os(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,l,void 0,!0)}var u;return function(g,y){const j=new XMLHttpRequest;j.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(j.responseType="arraybuffer");for(const N in g.headers)j.setRequestHeader(N,g.headers[N]);return g.type==="json"&&(j.responseType="text",j.setRequestHeader("Accept","application/json")),j.withCredentials=g.credentials==="include",j.onerror=()=>{y(new Error(j.statusText))},j.onload=()=>{if((j.status>=200&&j.status<300||j.status===0)&&j.response!==null){let N=j.response;if(g.type==="json")try{N=JSON.parse(j.response)}catch(R){return y(R)}const E=new Headers;j.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(R=>{const B=R.split(": "),H=B.shift(),G=B.join(": ");E.append(H,G)}),y(null,N,E)}else y(new Vc(j.statusText,j.status,g.url))},j.send(g.body),{cancel:()=>j.abort()}}(f,l)},$u=function(f,l){return lp(Object.assign(f,{type:"arrayBuffer"}),l)};function w5(f){const l=document.createElement("a");return l.href=f,l.protocol===location.protocol&&l.host===location.host}const jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Cr,cr;Cr=[],cr=0;const vs=function(f,l){if(nu.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),cr>=ks.MAX_PARALLEL_IMAGE_REQUESTS){const j={requestParameters:f,callback:l,cancelled:!1,cancel(){this.cancelled=!0}};return Cr.push(j),j}cr++;let u=!1;const g=()=>{if(!u)for(u=!0,cr--;Cr.length&&cr{g(),j?l(j):N&&(self.createImageBitmap?function(R,B){const H=new Blob([new Uint8Array(R)],{type:"image/png"});createImageBitmap(H).then(G=>{B(null,G)}).catch(G=>{B(new Error(`Could not load image because of ${G.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(N,(R,B)=>l(R,B,E)):function(R,B){const H=new Image;H.onload=()=>{B(null,H),URL.revokeObjectURL(H.src),H.onload=null,requestAnimationFrame(()=>{H.src=jt})},H.onerror=()=>B(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 G=new Blob([new Uint8Array(R)],{type:"image/png"});H.src=R.byteLength?URL.createObjectURL(G):jt}(N,(R,B)=>l(R,B,E)))});return{cancel:()=>{y.cancel(),g()}}};var Ds,jo,eo,to={exports:{}},Dg={exports:{}},X1={exports:{}},j5=function(){if(eo)return to.exports;eo=1;var f=(Ds||(Ds=1,Dg.exports=function(u,g){var y,j,N,E,R,B,H,G;for(j=u.length-(y=3&u.length),N=g,R=3432918353,B=461845907,G=0;G>>16)*R&65535)<<16)&4294967295)<<15|H>>>17))*B+(((H>>>16)*B&65535)<<16)&4294967295)<<13|N>>>19))+((5*(N>>>16)&65535)<<16)&4294967295))+((58964+(E>>>16)&65535)<<16);switch(H=0,y){case 3:H^=(255&u.charCodeAt(G+2))<<16;case 2:H^=(255&u.charCodeAt(G+1))<<8;case 1:N^=H=(65535&(H=(H=(65535&(H^=255&u.charCodeAt(G)))*R+(((H>>>16)*R&65535)<<16)&4294967295)<<15|H>>>17))*B+(((H>>>16)*B&65535)<<16)&4294967295}return N^=u.length,N=2246822507*(65535&(N^=N>>>16))+((2246822507*(N>>>16)&65535)<<16)&4294967295,N=3266489909*(65535&(N^=N>>>13))+((3266489909*(N>>>16)&65535)<<16)&4294967295,(N^=N>>>16)>>>0}),Dg.exports),l=(jo||(jo=1,X1.exports=function(u,g){for(var y,j=u.length,N=g^j,E=0;j>=4;)y=1540483477*(65535&(y=255&u.charCodeAt(E)|(255&u.charCodeAt(++E))<<8|(255&u.charCodeAt(++E))<<16|(255&u.charCodeAt(++E))<<24))+((1540483477*(y>>>16)&65535)<<16),N=1540483477*(65535&N)+((1540483477*(N>>>16)&65535)<<16)^(y=1540483477*(65535&(y^=y>>>24))+((1540483477*(y>>>16)&65535)<<16)),j-=4,++E;switch(j){case 3:N^=(255&u.charCodeAt(E+2))<<16;case 2:N^=(255&u.charCodeAt(E+1))<<8;case 1:N=1540483477*(65535&(N^=255&u.charCodeAt(E)))+((1540483477*(N>>>16)&65535)<<16)}return N=1540483477*(65535&(N^=N>>>13))+((1540483477*(N>>>16)&65535)<<16),(N^=N>>>15)>>>0}),X1.exports);return to.exports=f,to.exports.murmur3=f,to.exports.murmur2=l,to.exports}(),ik=Ci(j5);class af{constructor(l,...u){Object.assign(this,u[0]||{}),this.type=l}}class Q1 extends af{constructor(l,u={}){super("error",Object.assign({error:l},u))}}function k5(f,l,u){u[f]&&u[f].indexOf(l)!==-1||(u[f]=u[f]||[],u[f].push(l))}function jm(f,l,u){if(u&&u[f]){const g=u[f].indexOf(l);g!==-1&&u[f].splice(g,1)}}class Rg{on(l,u){return this._listeners=this._listeners||{},k5(l,u,this._listeners),this}off(l,u){return jm(l,u,this._listeners),jm(l,u,this._oneTimeListeners),this}once(l,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},k5(l,u,this._oneTimeListeners),this):new Promise(g=>{this.once(l,g)})}fire(l,u){const g=typeof l=="string"?new af(l,u):l,y=g.type;if(this.listens(y)){g.target=this;const j=this._listeners&&this._listeners[y]?this._listeners[y].slice():[];for(const R of j)R.call(this,g);const N=this._oneTimeListeners&&this._oneTimeListeners[y]?this._oneTimeListeners[y].slice():[];for(const R of N)jm(y,R,this._oneTimeListeners),R.call(this,g);const E=this._eventedParent;if(E){const R=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,R),E.fire(g)}}else g instanceof Q1&&console.error(g.error);return this}listens(l){return!!(this._listeners&&this._listeners[l]&&this._listeners[l].length>0||this._oneTimeListeners&&this._oneTimeListeners[l]&&this._oneTimeListeners[l].length>0||this._eventedParent&&this._eventedParent.listens(l))}setEventedParent(l,u){return this._eventedParent=l,this._eventedParentData=u,this}}class Mc{constructor(l){typeof l=="string"?this.name=l:(this.name=l.name,this.iconsetId=l.iconsetId)}static from(l){return new Mc(l)}static toString(l){return l.iconsetId?`${l.name}${l.iconsetId}`:l.name}static parse(l){const[u,g]=l.split("");return new Mc({name:u,iconsetId:g})}static isEqual(l,u){return l.name===u.name&&l.iconsetId===u.iconsetId}toString(){return Mc.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var ak,J1={},Uu=function(){if(ak)return J1;ak=1;var f={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function l(j){return(j=Math.round(j))<0?0:j>255?255:j}function u(j){return l(j[j.length-1]==="%"?parseFloat(j)/100*255:parseInt(j))}function g(j){return(N=j[j.length-1]==="%"?parseFloat(j)/100:parseFloat(j))<0?0:N>1?1:N;var N}function y(j,N,E){return E<0?E+=1:E>1&&(E-=1),6*E<1?j+(N-j)*E*6:2*E<1?N:3*E<2?j+(N-j)*(2/3-E)*6:j}try{J1.parseCSSColor=function(j){var N,E=j.replace(/ /g,"").toLowerCase();if(E in f)return f[E].slice();if(E[0]==="#")return E.length===4?(N=parseInt(E.substr(1),16))>=0&&N<=4095?[(3840&N)>>4|(3840&N)>>8,240&N|(240&N)>>4,15&N|(15&N)<<4,1]:null:E.length===7&&(N=parseInt(E.substr(1),16))>=0&&N<=16777215?[(16711680&N)>>16,(65280&N)>>8,255&N,1]:null;var R=E.indexOf("("),B=E.indexOf(")");if(R!==-1&&B+1===E.length){var H=E.substr(0,R),G=E.substr(R+1,B-(R+1)).split(","),X=1;switch(H){case"rgba":if(G.length!==4)return null;X=g(G.pop());case"rgb":return G.length!==3?null:[u(G[0]),u(G[1]),u(G[2]),X];case"hsla":if(G.length!==4)return null;X=g(G.pop());case"hsl":if(G.length!==3)return null;var J=(parseFloat(G[0])%360+360)%360/360,se=g(G[1]),pe=g(G[2]),ke=pe<=.5?pe*(se+1):pe+se-pe*se,we=2*pe-ke;return[l(255*y(we,ke,J+1/3)),l(255*y(we,ke,J)),l(255*y(we,ke,J-1/3)),X];default:return null}}return null}}catch{}return J1}();class vi{constructor(l,u,g,y=1){this.r=l,this.g=u,this.b=g,this.a=y}static parse(l){if(!l)return;if(l instanceof vi)return l;if(typeof l!="string")return;const u=Uu.parseCSSColor(l);return u?new vi(u[0]/255,u[1]/255,u[2]/255,u[3]):void 0}toString(){const[l,u,g,y]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*l)},${Math.round(255*u)},${Math.round(255*g)},${y})`}toNonPremultipliedRenderColor(l){const{r:u,g,b:y,a:j}=this;return new DI(l,u,g,y,j)}toPremultipliedRenderColor(l){const{r:u,g,b:y,a:j}=this;return new RI(l,u*j,g*j,y*j,j)}clone(){return new vi(this.r,this.g,this.b,this.a)}}class OI{constructor(l,u,g,y,j,N=!1){if(this.premultiplied=!1,this.premultiplied=N,l){const E=l.image.height,R=E*E;this.premultiplied?(u=j===0?0:u/j*(E-1),g=j===0?0:g/j*(E-1),y=j===0?0:y/j*(E-1)):(u*=E-1,g*=E-1,y*=E-1);const B=Math.floor(u),H=Math.floor(g),G=Math.floor(y),X=Math.ceil(u),J=Math.ceil(g),se=Math.ceil(y),pe=u-B,ke=g-H,we=y-G,Oe=l.image.data,ze=4*(B+H*R+G*E),qe=4*(B+H*R+se*E),dt=4*(B+J*R+G*E),it=4*(B+J*R+se*E),pt=4*(X+H*R+G*E),wt=4*(X+H*R+se*E),St=4*(X+J*R+G*E),Gt=4*(X+J*R+se*E);if(ze<0||Gt>=Oe.length)throw new Error("out of range");this.r=Rn(Rn(Rn(Oe[ze],Oe[qe],we),Rn(Oe[dt],Oe[it],we),ke),Rn(Rn(Oe[pt],Oe[wt],we),Rn(Oe[St],Oe[Gt],we),ke),pe)/255*(this.premultiplied?j:1),this.g=Rn(Rn(Rn(Oe[ze+1],Oe[qe+1],we),Rn(Oe[dt+1],Oe[it+1],we),ke),Rn(Rn(Oe[pt+1],Oe[wt+1],we),Rn(Oe[St+1],Oe[Gt+1],we),ke),pe)/255*(this.premultiplied?j:1),this.b=Rn(Rn(Rn(Oe[ze+2],Oe[qe+2],we),Rn(Oe[dt+2],Oe[it+2],we),ke),Rn(Rn(Oe[pt+2],Oe[wt+2],we),Rn(Oe[St+2],Oe[Gt+2],we),ke),pe)/255*(this.premultiplied?j:1),this.a=j}else this.r=u,this.g=g,this.b=y,this.a=j}toArray(){const{r:l,g:u,b:g,a:y}=this;return[255*l,255*u,255*g,y]}toHslaArray(){let{r:l,g:u,b:g,a:y}=this;if(this.premultiplied){if(y===0)return[0,0,0,0];const se=1/y;l*=se,u*=se,g*=se}const j=Math.min(Math.max(l,0),1),N=Math.min(Math.max(u,0),1),E=Math.min(Math.max(g,0),1),R=Math.min(j,N,E),B=Math.max(j,N,E),H=B-R,G=.5*(R+B);if(H===0)return[0,0,100*G,y];const X=G>.5?H/(2-B-R):H/(B+R);let J;switch(B){case j:J=60*((N-E)/H+(NRn(g,l[y],u))}vi.black=new vi(0,0,0,1),vi.white=new vi(1,1,1,1),vi.transparent=new vi(0,0,0,0),vi.red=new vi(1,0,0,1),vi.blue=new vi(0,0,1,1);var ev=Object.freeze({__proto__:null,array:N5,color:function(f,l,u){return new vi(Rn(f.r,l.r,u),Rn(f.g,l.g,u),Rn(f.b,l.b,u),Rn(f.a,l.a,u))},number:Rn});class qu extends Error{constructor(l,u){super(u),this.message=u,this.key=l}}class hy{constructor(l,u=[]){this.parent=l,this.bindings={};for(const[g,y]of u)this.bindings[g]=y}concat(l){return new hy(this,l)}get(l){if(this.bindings[l])return this.bindings[l];if(this.parent)return this.parent.get(l);throw new Error(`${l} not found in scope.`)}has(l){return!!this.bindings[l]||!!this.parent&&this.parent.has(l)}}const vh={kind:"null"},fn={kind:"number"},Gs={kind:"string"},Ti={kind:"boolean"},gd={kind:"color"},of={kind:"object"},yi={kind:"value"},ok={kind:"collator"},tv={kind:"formatted"},rv={kind:"resolvedImage"};function cc(f,l){return{kind:"array",itemType:f,N:l}}function ko(f){if(f.kind==="array"){const l=ko(f.itemType);return typeof f.N=="number"?`array<${l}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${l}>`}return f.kind}const Oie=[vh,fn,Gs,Ti,gd,tv,of,cc(yi),rv];function km(f,l){if(l.kind==="error")return null;if(f.kind==="array"){if(l.kind==="array"&&(l.N===0&&l.itemType.kind==="value"||!km(f.itemType,l.itemType))&&(typeof f.N!="number"||f.N===l.N))return null}else{if(f.kind===l.kind)return null;if(f.kind==="value"){for(const u of Oie)if(!km(u,l))return null}}return`Expected ${ko(f)} but found ${ko(l)} instead.`}function S5(f,l){return l.some(u=>u.kind===f.kind)}function nv(f,l){return l.some(u=>u==="null"?f===null:u==="array"?Array.isArray(f):u==="object"?f&&!Array.isArray(f)&&typeof f=="object":u===typeof f)}function lk(f,l){return f.kind==="array"&&l.kind==="array"?f.N===l.N&&lk(f.itemType,l.itemType):f.kind===l.kind}class C5{constructor(l,u,g){this.sensitivity=l?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(l,u){return this.collator.compare(l,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ck{constructor(l,u,g,y,j){this.text=l.normalize?l.normalize():l,this.image=u,this.scale=g,this.fontStack=y,this.textColor=j}}class Hc{constructor(l){this.sections=l}static fromString(l){return new Hc([new ck(l,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(l=>l.text.length!==0||!!l.image&&l.image.hasPrimary())}static factory(l){return l instanceof Hc?l:Hc.fromString(l)}toString(){return this.sections.length===0?"":this.sections.map(l=>l.text).join("")}serialize(){const l=["format"];for(const u of this.sections){if(u.image){const y=u.image.getPrimary().id.toString();l.push(["image",y]);continue}l.push(u.text);const g={};u.fontStack&&(g["text-font"]=["literal",u.fontStack.split(",")]),u.scale&&(g["font-scale"]=u.scale),u.textColor&&(g["text-color"]=["rgba"].concat(u.textColor.toNonPremultipliedRenderColor(null).toArray())),l.push(g)}return l}}class cp{constructor(l,u={}){this.id=Mc.from(l),this.params=u.params,this.sx=u.sx||1,this.sy=u.sy||1}toString(){return JSON.stringify(this)}static parse(l){let u,g,y,j;try{({id:u,params:g,sx:y,sy:j}=JSON.parse(l)||{})}catch{return null}return u?new cp(u,{params:g,sx:y,sy:j}):null}scaleSelf(l,u=l){return this.sx*=l,this.sy*=u,this}}class Wc{constructor(l,u,g,y,j=!1){this.primaryId=Mc.from(l),this.primaryOptions=u,g&&(this.secondaryId=Mc.from(g)),this.secondaryOptions=y,this.available=j}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new cp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new cp(this.secondaryId,this.secondaryOptions):null}static from(l){return typeof l=="string"?Wc.build({name:l}):l}static build(l,u,g,y){return!l||typeof l=="object"&&!("name"in l)?null:new Wc(l,g,u,y)}}function Fg(f,l,u,g){return typeof f=="number"&&f>=0&&f<=255&&typeof l=="number"&&l>=0&&l<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,l,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,l,u,g]:[f,l,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fy(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof vi||f instanceof C5||f instanceof Hc||f instanceof Wc)return!0;if(Array.isArray(f)){for(const l of f)if(!fy(l))return!1;return!0}if(typeof f=="object"){for(const l in f)if(!fy(f[l]))return!1;return!0}return!1}function dl(f){if(f===null)return vh;if(typeof f=="string")return Gs;if(typeof f=="boolean")return Ti;if(typeof f=="number")return fn;if(f instanceof vi)return gd;if(f instanceof C5)return ok;if(f instanceof Hc)return tv;if(f instanceof Wc)return rv;if(Array.isArray(f)){const l=f.length;let u;for(const g of f){const y=dl(g);if(u){if(u===y)continue;u=yi;break}u=y}return cc(u||yi,l)}return of}function Vu(f){const l=typeof f;return f===null?"":l==="string"||l==="number"||l==="boolean"?String(f):f instanceof Hc||f instanceof Wc||f instanceof vi?f.toString():JSON.stringify(f)}class dp{constructor(l,u){this.type=l,this.value=u}static parse(l,u){if(l.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${l.length-1} instead.`);if(!fy(l[1]))return u.error("invalid value");const g=l[1];let y=dl(g);const j=u.expectedType;return y.kind!=="array"||y.N!==0||!j||j.kind!=="array"||typeof j.N=="number"&&j.N!==0||(y=j),new dp(y,g)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof vi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Hc?this.value.serialize():this.value}}class el{constructor(l){this.name="ExpressionEvaluationError",this.message=l}toJSON(){return this.message}}const M5={string:Gs,number:fn,boolean:Ti,object:of};class _h{constructor(l,u){this.type=l,this.args=u}static parse(l,u){if(l.length<2)return u.error("Expected at least one argument.");let g,y=1;const j=l[0];if(j==="array"){let E,R;if(l.length>2){const B=l[1];if(typeof B!="string"||!(B in M5)||B==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);E=M5[B],y++}else E=yi;if(l.length>3){if(l[2]!==null&&(typeof l[2]!="number"||l[2]<0||l[2]!==Math.floor(l[2])))return u.error('The length argument to "array" must be a positive integer literal',2);R=l[2],y++}g=cc(E,R)}else g=M5[j];const N=[];for(;yl.outputDefined())}serialize(){const l=this.type,u=[l.kind];if(l.kind==="array"){const g=l.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){u.push(g.kind);const y=l.N;(typeof y=="number"||this.args.length>1)&&u.push(y)}}return u.concat(this.args.map(g=>g.serialize()))}}class lf{constructor(l){this.type=tv,this.sections=l}static parse(l,u){if(l.length<2)return u.error("Expected at least one argument.");const g=l[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const y=[];let j=!1;for(let N=1;N<=l.length-1;++N){const E=l[N];if(j&&typeof E=="object"&&!Array.isArray(E)){j=!1;let R=null;if(E["font-scale"]&&(R=u.parseObjectValue(E["font-scale"],N,"font-scale",fn),!R))return null;let B=null;if(E["text-font"]&&(B=u.parseObjectValue(E["text-font"],N,"text-font",cc(Gs)),!B))return null;let H=null;if(E["text-color"]&&(H=u.parseObjectValue(E["text-color"],N,"text-color",gd),!H))return null;const G=y[y.length-1];G.scale=R,G.font=B,G.textColor=H}else{const R=u.parse(l[N],N,yi);if(!R)return null;const B=R.type.kind;if(B!=="string"&&B!=="value"&&B!=="null"&&B!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");j=!0,y.push({content:R,scale:null,font:null,textColor:null})}}return new lf(y)}evaluate(l){return new Hc(this.sections.map(u=>{const g=u.content.evaluate(l);return lk(dl(g),rv)?new ck("",g,null,null,null):new ck(Vu(g),null,u.scale?u.scale.evaluate(l):null,u.font?u.font.evaluate(l).join(","):null,u.textColor?u.textColor.evaluate(l):null)}))}eachChild(l){for(const u of this.sections)l(u.content),u.scale&&l(u.scale),u.font&&l(u.font),u.textColor&&l(u.textColor)}outputDefined(){return!1}serialize(){const l=["format"];for(const u of this.sections){l.push(u.content.serialize());const g={};u.scale&&(g["font-scale"]=u.scale.serialize()),u.font&&(g["text-font"]=u.font.serialize()),u.textColor&&(g["text-color"]=u.textColor.serialize()),l.push(g)}return l}}class ns{constructor(l,u,g,y){this._imageWarnHistory={},this.type=rv,this.namePrimary=l,this.nameSecondary=u,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),y&&(this.paramsSecondary=y.params,this.iconsetIdSecondary=y.iconset?y.iconset.id:void 0)}static parse(l,u){if(l.length<2)return u.error("Expected two or more arguments.");let g=1;const y=[];function j(){if(gMc.isEqual(N,j)),y.available){const N=y.getSecondary()?y.getSecondary().id:null;N&&(y.available=l.availableImages.some(E=>Mc.isEqual(E,N)))}}return y}eachChild(l){if(l(this.namePrimary),this.paramsPrimary)for(const u in this.paramsPrimary)this.paramsPrimary[u]&&l(this.paramsPrimary[u]);if(this.nameSecondary&&(l(this.nameSecondary),this.paramsSecondary))for(const u in this.paramsSecondary)this.paramsSecondary[u]&&l(this.paramsSecondary[u])}outputDefined(){return!1}serializeOptions(l,u){const g={};if(u&&(g.iconset={id:u}),l){g.params={};for(const y in l)l[y]&&(g.params[y]=l[y].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const l=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const u=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);u&&l.push(u)}if(this.nameSecondary&&(l.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const u=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);u&&l.push(u)}return l}}function cn(f){return zn(f)?"string":py(f)?"number":uk(f)?"boolean":Array.isArray(f)?"array":f===null?"null":dk(f)?"object":typeof f}function dk(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function zn(f){return typeof f=="string"||f instanceof String}function py(f){return typeof f=="number"||f instanceof Number}function uk(f){return typeof f=="boolean"||f instanceof Boolean}const Fn={"to-boolean":Ti,"to-color":gd,"to-number":fn,"to-string":Gs};class cf{constructor(l,u){this.type=l,this.args=u}static parse(l,u){if(l.length<2)return u.error("Expected at least one argument.");const g=l[0],y=[];let j=vh;if(g==="to-array"){if(!Array.isArray(l[1]))return null;const N=l[1].length;if(u.expectedType){if(u.expectedType.kind!=="array")return u.error(`Expected ${u.expectedType.kind} but found array.`);j=cc(u.expectedType.itemType,N)}else{if(!(N>0&&fy(l[1][0])))return null;j=cc(dl(l[1][0]),N)}for(let E=0;E4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:Fg(u[0],u[1],u[2],u[3]),!g))return new vi(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new el(g||`Could not parse color from value '${typeof u=="string"?u:String(JSON.stringify(u))}'`)}if(this.type.kind==="number"){let u=null;for(const g of this.args){if(u=g.evaluate(l),u===null)return 0;const y=Number(u);if(!isNaN(y))return y}throw new el(`Could not convert ${JSON.stringify(u)} to number.`)}return this.type.kind==="formatted"?Hc.fromString(Vu(this.args[0].evaluate(l))):this.type.kind==="resolvedImage"?Wc.build(Vu(this.args[0].evaluate(l))):this.type.kind==="array"?this.args.map(u=>u.evaluate(l)):Vu(this.args[0].evaluate(l))}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}serialize(){if(this.type.kind==="formatted")return new lf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ns(this.args[0]).serialize();const l=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(u=>{l.push(u.serialize())}),l}}const T5=["Unknown","Point","LineString","Polygon"];class hk{constructor(l,u,g){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=l,this.options=u,this.iconImageUseTheme=g}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?T5[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(l){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const l=this.featureDistanceData.center,u=this.featureDistanceData.scale,{x:g,y}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*u-l[0])+this.featureDistanceData.bearing[1]*(y*u-l[1])}return 0}parseColor(l){let u=this._parseColorCache[l];return u||(u=this._parseColorCache[l]=vi.parse(l)),u}getConfig(l){return this.options?this.options.get(l):null}}class Gc{constructor(l,u,g,y,j){this.name=l,this.type=u,this._evaluate=g,this.args=y,this._overloadIndex=j}evaluate(l){if(!this._evaluate){const u=Gc.definitions[this.name];this._evaluate=Array.isArray(u)?u[2]:u.overloads[this._overloadIndex][1]}return this._evaluate(l,this.args)}eachChild(l){this.args.forEach(l)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(l=>l.serialize()))}static parse(l,u){const g=l[0],y=Gc.definitions[g];if(!y)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const j=Array.isArray(y)?y[0]:y.type,N=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,E=[];let R=null,B=-1;for(const[H,G]of N){if(Array.isArray(H)&&H.length!==l.length-1)continue;E.push(H),B++,R=new kk(u.registry,u.path,null,u.scope,void 0,u._scope,u.options,u.iconImageUseTheme);const X=[];let J=!1;for(let se=1;seX)).map(fk).join(" | "),G=[];for(let X=1;Xu;){if(g-u>600){const R=g-u+1,B=l-u+1,H=Math.log(R),G=.5*Math.exp(2*H/3),X=.5*Math.sqrt(H*G*(R-G)/R)*(B-R/2<0?-1:1);pk(f,l,Math.max(u,Math.floor(l-B*G/R+X)),Math.min(g,Math.floor(l+(R-B)*G/R+X)),y)}const j=f[l];let N=u,E=g;for(bh(f,u,l),y(f[g],j)>0&&bh(f,u,g);N0;)E--}y(f[u],j)===0?bh(f,u,E):(E++,bh(f,E,g)),E<=l&&(u=E+1),l<=E&&(g=E-1)}}function bh(f,l,u){const g=f[l];f[l]=f[u],f[u]=g}function A5(f,l){return fl?1:0}function Nm(f){let l=0;for(let u,g,y=0,j=f.length,N=j-1;y=l[2]||f[1]<=l[1]||f[3]>=l[3])}function Die(f,l,u){const g=f[0]-l[0],y=f[1]-l[1],j=f[0]-u[0],N=f[1]-u[1];return g*N-j*y==0&&g*j<=0&&y*N<=0}function my(f,l,u=!1){let g=!1;for(let E=0,R=l.length;E(y=f)[1]!=(N=se)[1]>y[1]&&y[0]<(N[0]-j[0])*(y[1]-j[1])/(N[1]-j[1])+j[0]&&(g=!g)}}var y,j,N;return g}function iv(f,l,u,g){const y=g[0]-u[0],j=g[1]-u[1],N=(f[0]-u[0])*j-y*(f[1]-u[1]),E=(l[0]-u[0])*j-y*(l[1]-u[1]);return N>0&&E<0||N<0&&E>0}function av(f,l,u,g){return(y=[g[0]-u[0],g[1]-u[1]])[0]*(j=[l[0]-f[0],l[1]-f[1]])[1]-y[1]*j[0]!=0&&!(!iv(f,l,u,g)||!iv(u,g,f,l));var y,j}function up(f){const l=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new ir(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of f[0])l.x>g.x&&(l.x=g.x),l.y>g.y&&(l.y=g.y),u.xu[2]){const y=.5*g;let j=f[0]-u[0]>y?-g:u[0]-f[0]>y?g:0;j===0&&(j=f[0]-u[2]>y?-g:u[2]-f[0]>y?g:0),f[0]+=j}Hu(l,f)}function $I(f,l,u,g){const y=Math.pow(2,g.z)*Sm,j=[g.x*Sm,g.y*Sm],N=[];if(!f)return N;for(const E of f)for(const R of E){const B=[R.x+j[0],R.y+j[1]];BI(B,l,u,y),N.push(B)}return N}function mk(f,l,u,g){const y=Math.pow(2,g.z)*Sm,j=[g.x*Sm,g.y*Sm],N=[];if(!f)return N;for(const R of f){const B=[];for(const H of R){const G=[H.x+j[0],H.y+j[1]];Hu(l,G),B.push(G)}N.push(B)}if(l[2]-l[0]<=y/2){(E=l)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const R of N)for(const B of R)BI(B,l,u,y)}var E;return N}class Mm{constructor(l,u){this.type=Ti,this.geojson=l,this.geometries=u}static parse(l,u){if(l.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${l.length-1} instead.`);if(fy(l[1])){const g=l[1];if(g.type==="FeatureCollection")for(let y=0;yu)return gk(j,N,(u-(g-E))/E)}return l[l.length-1]}pointToSegmentDistance(l,u,g){let[y,j]=u,N=su(g[0]-y)*this.kx,E=(g[1]-j)*this.ky;if(N!==0||E!==0){const R=(su(l[0]-y)*this.kx*N+(l[1]-j)*this.ky*E)/(N*N+E*E);R>1?(y=g[0],j=g[1]):R>0&&(y+=N/this.kx*R,j+=E/this.ky*R)}return N=su(l[0]-y)*this.kx,E=(l[1]-j)*this.ky,Math.sqrt(N*N+E*E)}pointOnLine(l,u){let g=1/0,y=l[0][0],j=l[0][1],N=0,E=0;for(let R=0;R1?(B=l[R+1][0],H=l[R+1][1]):J>0&&(B+=G/this.kx*J,H+=X/this.ky*J)),G=su(u[0]-B)*this.kx,X=(u[1]-H)*this.ky;const se=G*G+X*X;sej.index||y.index===j.index&&y.t>j.t){const B=y;y=j,j=B}const N=[y.point],E=y.index+1,R=j.index;!P5(g[E],N[0])&&E<=R&&N.push(g[E]);for(let B=E+1;B<=R;B++)N.push(g[B]);return P5(g[R],j.point)||N.push(j.point),N}lineSliceAlong(l,u,g){let y=0;const j=[];for(let N=0;Nl&&j.length===0&&j.push(gk(E,R,(l-(y-B))/B)),y>=u)return j.push(gk(E,R,(u-(y-B))/B)),j;y>l&&j.push(R)}return j}bufferPoint(l,u){const g=u/this.ky,y=u/this.kx;return[l[0]-y,l[1]-g,l[0]+y,l[1]+g]}bufferBBox(l,u){const g=u/this.ky,y=u/this.kx;return[l[0]-y,l[1]-g,l[2]+y,l[3]+g]}insideBBox(l,u){return su(l[0]-u[0])>=0&&su(l[0]-u[2])<=0&&l[1]>=u[1]&&l[1]<=u[3]}}function P5(f,l){return f[0]===l[0]&&f[1]===l[1]}function gk(f,l,u){const g=su(l[0]-f[0]);return[f[0]+g*u,f[1]+(l[1]-f[1])*u]}function su(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class xk{constructor(l=[],u=(g,y)=>gy?1:0){if(this.data=l,this.length=this.data.length,this.compare=u,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;const l=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),l}peek(){return this.data[0]}_up(l){const{data:u,compare:g}=this,y=u[l];for(;l>0;){const j=l-1>>1,N=u[j];if(g(y,N)>=0)break;u[l]=N,l=j}u[l]=y}_down(l){const{data:u,compare:g}=this,y=this.length>>1,j=u[l];for(;l=0)break;u[l]=u[N],l=N}u[l]=j}}var Mr=8192;function L5(f,l){return l.dist-f.dist}const yk=100,vk=50;function O5(f){const l=[1/0,1/0,-1/0,-1/0];if(l.length!==f.length)return!1;for(let u=0;u=f[0]&&f[1]f[1])return[null,null];const u=lv(f);if(l){if(u===2)return[f,null];const g=Math.floor(u/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(u===1)return[f,null];const g=Math.floor(u/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function zg(f,l){const u=[1/0,1/0,-1/0,-1/0];if(!df(l,f.length))return u;for(let g=l[0];g<=l[1];++g)Hu(u,f[g]);return u}function Bg(f){const l=[1/0,1/0,-1/0,-1/0];for(let u=0;ul[2]&&(g=f[0]-l[2]),f[1]>l[3]&&(y=f[1]-l[3]),f[3]=g)return g;if(sv(y,j)){if(F5(f,l))return 0}else if(F5(l,f))return 0;let N=g;for(const E of f)for(let R=0,B=E.length,H=B-1;R=j)continue;const H=B.range1;if(lv(H)<=E){if(!df(H,f.length))return NaN;if(l){const G=Uie(f,H,u,g);if((j=Math.min(j,G))===0)return j}else for(let G=H[0];G<=H[1];++G){const X=$ie(f[G],u,g);if((j=Math.min(j,X))===0)return j}}else{const G=D5(H,l);if(G[0]!==null){const X=Tm(zg(f,G[0]),R,g);X=N)continue;const G=H.range1,X=H.range2;if(lv(G)<=R&&lv(X)<=B){if(!df(G,f.length)||!df(X,u.length))return NaN;if(l&&g?N=Math.min(N,Ks(f,G,u,X,y)):l||g?l&&!g?N=Math.min(N,R5(u,X,f,G,y)):!l&&g&&(N=Math.min(N,R5(f,G,u,X,y))):N=Math.min(N,Bie(f,G,u,X,y)),N===0)return N}else{const J=D5(G,l),se=D5(X,g);_a(E,N,y,f,u,J[0],se[0]),_a(E,N,y,f,u,J[0],se[1]),_a(E,N,y,f,u,J[1],se[0]),_a(E,N,y,f,u,J[1],se[1])}}return N}function z5(f,l,u,g,y=1/0){let j=y;const N=zg(f,[0,f.length-1]);for(const E of u)if(!(j!==1/0&&Tm(N,zg(E,[0,E.length-1]),g)>=j)&&(j=Math.min(j,HI(f,l,E,!0,g,j)),j===0))return j;return j}function wk(f,l,u,g,y=1/0){let j=y;const N=zg(f,[0,f.length-1]);for(const E of u){if(j!==1/0&&Tm(N,Bg(E),g)>=j)continue;const R=Vie(f,l,E,g,j);if(isNaN(R))return R;if((j=Math.min(j,R))===0)return j}return j}function B5(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class $g{constructor(l,u){this.type=fn,this.geojson=l,this.geometries=u}static parse(l,u){if(l.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${l.length-1} instead.`);if(fy(l[1])){const g=l[1];if(g.type==="FeatureCollection"){for(let y=0;y{l&&!yy(u)&&(l=!1)}),l}function cv(f){if(f instanceof Gc&&f.name==="feature-state")return!1;let l=!0;return f.eachChild(u=>{l&&!cv(u)&&(l=!1)}),l}function vy(f,l){if(f instanceof Gc&&l.indexOf(f.name)>=0)return!1;let u=!0;return f.eachChild(g=>{u&&!vy(g,l)&&(u=!1)}),u}function WI(f,l,u){return[f,l,u].filter(Boolean).join("")}function $5(f,l){switch(f){case"string":return Vu(l);case"number":return+l;case"boolean":return!!l;case"color":return vi.parse(l);case"formatted":return Hc.fromString(Vu(l));case"resolvedImage":return Wc.build(Vu(l))}return l}function GI(f,l,u,g){return g!==void 0&&(f=g*Math.round(f/g)),l!==void 0&&fu&&(f=u),f}class _y{constructor(l,u,g,y=!1){this.type=l,this.key=u,this.scope=g,this.featureConstant=y}static parse(l,u){let g=u.expectedType;if(g==null&&(g=yi),l.length<2||l.length>3)return u.error("Invalid number of arguments for 'config' expression.");const y=u.parse(l[1],1);if(!(y instanceof dp))return u.error("Key name of 'config' expression must be a string literal.");let j,N=!0;const E=Vu(y.value);if(l.length>=3){const R=u.parse(l[2],2);if(!(R instanceof dp))return u.error("Scope of 'config' expression must be a string literal.");j=Vu(R.value)}if(u.options){const R=WI(E,j,u._scope),B=u.options.get(R);B&&(N=yy(B.value||B.default))}return new _y(g,E,j,N)}evaluate(l){const u=WI(this.key,this.scope,l.scope),g=l.getConfig(u);if(!g)return null;const{type:y,value:j,values:N,minValue:E,maxValue:R,stepValue:B}=g,H=g.default.evaluate(l);let G=H;if(j){const X=l.scope;l.scope=(X||"").split("").slice(1).join(""),G=j.evaluate(l),l.scope=X}return y&&(G=$5(y,G)),G===void 0||E===void 0&&R===void 0&&B===void 0||(typeof G=="number"?G=GI(G,E,R,B):Array.isArray(G)&&(G=G.map(X=>typeof X=="number"?GI(X,E,R,B):X))),j!==void 0&&G!==void 0&&N&&!N.includes(G)&&(G=H,y&&(G=$5(y,G))),(y&&y!==this.type||G!==void 0&&!lk(dl(G),this.type))&&(G=$5(this.type.kind,G)),G}eachChild(){}outputDefined(){return!1}serialize(){const l=["config",this.key];return this.scope&&l.concat(this.scope),l}}class jk{constructor(l,u){this.type=u.type,this.name=l,this.boundExpression=u}static parse(l,u){if(l.length!==2||typeof l[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=l[1];return u.scope.has(g)?new jk(g,u.scope.get(g)):u.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class kk{constructor(l,u=[],g,y=new hy,j=[],N,E,R){this.registry=l,this.path=u,this.key=u.map(B=>typeof B=="string"?`['${B}']`:`[${B}]`).join(""),this.scope=y,this.errors=j,this.expectedType=g,this._scope=N,this.options=E,this.iconImageUseTheme=R}parse(l,u,g,y,j={}){return u||g?this.concat(u,null,g,y)._parse(l,j):this._parse(l,j)}parseObjectValue(l,u,g,y,j,N={}){return this.concat(u,g,y,j)._parse(l,N)}_parse(l,u){function g(y,j,N){return N==="assert"?new _h(j,[y]):N==="coerce"?new cf(j,[y]):y}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=typeof l[0]=="string"?this.registry[l[0]]:void 0;if(y){let j=y.parse(l,this);if(!j)return null;if(this.expectedType){const N=this.expectedType,E=j.type;if(N.kind!=="string"&&N.kind!=="number"&&N.kind!=="boolean"&&N.kind!=="object"&&N.kind!=="array"||E.kind!=="value")if(N.kind!=="color"&&N.kind!=="formatted"&&N.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string"){if(this.checkSubtype(N,E))return null}else j=g(j,N,u.typeAnnotation||"coerce");else j=g(j,N,u.typeAnnotation||"assert")}if(!(j instanceof dp)&&j.type.kind!=="resolvedImage"&&U5(j)){const N=new hk(this._scope,this.options,this.iconImageUseTheme);try{j=new dp(j.type,j.evaluate(N))}catch(E){return this.error(E.message),null}}return j}return cf.parse(["to-array",l],this)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,u,g,y){let j=typeof l=="number"?this.path.concat(l):this.path;j=typeof u=="string"?j.concat(u):j;const N=y?this.scope.concat(y):this.scope;return new kk(this.registry,j,g||null,N,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(l,...u){const g=`${this.key}${u.map(y=>`[${y}]`).join("")}`;this.errors.push(new qu(g,l))}checkSubtype(l,u){const g=km(l,u);return g&&this.error(g),g}}function U5(f){if(f instanceof jk)return U5(f.boundExpression);if(f instanceof Gc&&f.name==="error"||f instanceof wl||f instanceof Mm||f instanceof $g||f instanceof _y)return!1;const l=f instanceof cf||f instanceof _h;let u=!0;return f.eachChild(g=>{u=l?u&&U5(g):u&&g instanceof dp}),!!u&&yy(f)&&vy(f,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Nk(f,l){const u=f.length-1;let g,y,j=0,N=u,E=0;for(;j<=N;)if(E=Math.floor((j+N)/2),g=f[E],y=f[E+1],g<=l){if(E===u||ll))throw new el("Input is not a number.");N=E-1}return 0}class dv{constructor(l,u,g){this.type=l,this.input=u,this.labels=[],this.outputs=[];for(const[y,j]of g)this.labels.push(y),this.outputs.push(j)}static parse(l,u){if(l.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(l[1],1,fn);if(!g)return null;const y=[];let j=null;u.expectedType&&u.expectedType.kind!=="value"&&(j=u.expectedType);for(let N=1;N=E)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);const G=u.parse(R,H,j);if(!G)return null;j=j||G.type,y.push([E,G])}return new dv(j,g,y)}evaluate(l){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(l);const y=this.input.evaluate(l);if(y<=u[0])return g[0].evaluate(l);const j=u.length;return y>=u[j-1]?g[j-1].evaluate(l):g[Nk(u,y)].evaluate(l)}eachChild(l){l(this.input);for(const u of this.outputs)l(u)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}serialize(){const l=["step",this.input.serialize()];for(let u=0;u0&&l.push(this.labels[u]),l.push(this.outputs[u].serialize());return l}}const KI=.95047,ZI=1.08883,YI=4/29,by=6/29,XI=3*by*by,Hie=by*by*by,Wie=Math.PI/180,Gie=180/Math.PI;function q5(f){return f>Hie?Math.pow(f,1/3):f/XI+YI}function V5(f){return f>by?f*f*f:XI*(f-YI)}function H5(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function W5(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function QI(f){const l=W5(f.r),u=W5(f.g),g=W5(f.b),y=q5((.4124564*l+.3575761*u+.1804375*g)/KI),j=q5((.2126729*l+.7151522*u+.072175*g)/1);return{l:116*j-16,a:500*(y-j),b:200*(j-q5((.0193339*l+.119192*u+.9503041*g)/ZI)),alpha:f.a}}function Sk(f){let l=(f.l+16)/116,u=isNaN(f.a)?l:l+f.a/500,g=isNaN(f.b)?l:l-f.b/200;return l=1*V5(l),u=KI*V5(u),g=ZI*V5(g),new vi(H5(3.2404542*u-1.5371385*l-.4985314*g),H5(-.969266*u+1.8760108*l+.041556*g),H5(.0556434*u-.2040259*l+1.0572252*g),f.alpha)}function Ck(f,l,u){const g=l-f;return f+u*(g>180||g<-180?g-360*Math.round(g/360):g)}const wy={forward:QI,reverse:Sk,interpolate:function(f,l,u){return{l:Rn(f.l,l.l,u),a:Rn(f.a,l.a,u),b:Rn(f.b,l.b,u),alpha:Rn(f.alpha,l.alpha,u)}}},uv={forward:function(f){const{l,a:u,b:g}=QI(f),y=Math.atan2(g,u)*Gie;return{h:y<0?y+360:y,c:Math.sqrt(u*u+g*g),l,alpha:f.a}},reverse:function(f){const l=f.h*Wie,u=f.c;return Sk({l:f.l,a:Math.cos(l)*u,b:Math.sin(l)*u,alpha:f.alpha})},interpolate:function(f,l,u){return{h:Ck(f.h,l.h,u),c:Rn(f.c,l.c,u),l:Rn(f.l,l.l,u),alpha:Rn(f.alpha,l.alpha,u)}}};var JI=Object.freeze({__proto__:null,hcl:uv,lab:wy});class iu{constructor(l,u,g,y,j){this.type=l,this.operator=u,this.interpolation=g,this.input=y,this.labels=[],this.outputs=[];for(const[N,E]of j)this.labels.push(N),this.outputs.push(E)}static interpolationFactor(l,u,g,y){let j=0;if(l.name==="exponential")j=Mk(u,l.base,g,y);else if(l.name==="linear")j=Mk(u,1,g,y);else if(l.name==="cubic-bezier"){const N=l.controlPoints;j=new Eo(N[0],N[1],N[2],N[3]).solve(Mk(u,1,g,y))}return j}static parse(l,u){let[g,y,j,...N]=l;if(!Array.isArray(y)||y.length===0)return u.error("Expected an interpolation type expression.",1);if(y[0]==="linear")y={name:"linear"};else if(y[0]==="exponential"){const B=y[1];if(typeof B!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);y={name:"exponential",base:B}}else{if(y[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(y[0])}`,1,0);{const B=y.slice(1);if(B.length!==4||B.some(H=>typeof H!="number"||H<0||H>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:B}}}if(l.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length-1>3&&(l.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(j=u.parse(j,2,fn),!j)return null;const E=[];let R=null;g==="interpolate-hcl"||g==="interpolate-lab"?R=gd:u.expectedType&&u.expectedType.kind!=="value"&&(R=u.expectedType);for(let B=0;B=H)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const se=u.parse(G,J,R);if(!se)return null;R=R||se.type,E.push([H,se])}return R.kind==="number"||R.kind==="color"||R.kind==="array"&&R.itemType.kind==="number"&&typeof R.N=="number"?new iu(R,g,y,j,E):u.error(`Type ${ko(R)} is not interpolatable.`)}evaluate(l){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(l);const y=this.input.evaluate(l);if(y<=u[0])return g[0].evaluate(l);const j=u.length;if(y>=u[j-1])return g[j-1].evaluate(l);const N=Nk(u,y),E=iu.interpolationFactor(this.interpolation,y,u[N],u[N+1]),R=g[N].evaluate(l),B=g[N+1].evaluate(l);return this.operator==="interpolate"?ev[this.type.kind.toLowerCase()](R,B,E):this.operator==="interpolate-hcl"?uv.reverse(uv.interpolate(uv.forward(R),uv.forward(B),E)):wy.reverse(wy.interpolate(wy.forward(R),wy.forward(B),E))}eachChild(l){l(this.input);for(const u of this.outputs)l(u)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}serialize(){let l;l=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const u=[this.operator,l,this.input.serialize()];for(let g=0;gkm(y,E.type));return new hv(N?yi:g,j)}evaluate(l){let u,g=null,y=0;for(const j of this.args){if(y++,g=j.evaluate(l),g&&g instanceof Wc&&!g.available&&(u||(u=g),g=null,y===this.args.length))return u;if(g!==null)break}return g}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}serialize(){const l=["coalesce"];return this.eachChild(u=>{l.push(u.serialize())}),l}}class hp{constructor(l,u){this.type=u.type,this.bindings=[].concat(l),this.result=u}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(const u of this.bindings)l(u[1]);l(this.result)}static parse(l,u){if(l.length<4)return u.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);const g=[];for(let j=1;j=g.length)throw new el("Array index out of bounds: index exceeds array size");if(u!==Math.floor(u))throw new el("Array index must be an integer. Use at-interpolated for fractional indices");return g[u]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Ak{constructor(l,u,g){this.type=l,this.index=u,this.input=g}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,fn),y=u.parse(l[2],2,cc(u.expectedType||yi));return g&&y?new Ak(y.type.itemType,g,y):null}evaluate(l){const u=this.index.evaluate(l),g=this.input.evaluate(l);if(u<0)throw new el(`Array index out of bounds: ${u} < 0.`);if(u>g.length-1)throw new el(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u===Math.floor(u))return g[u];const y=Math.floor(u),j=Math.ceil(u),N=g[y],E=g[j];if(typeof N!="number"||typeof E!="number")throw new el(`Cannot interpolate between non-number values at index ${u}.`);const R=u-y;return N*(1-R)+E*R}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class G5{constructor(l,u){this.type=Ti,this.needle=l,this.haystack=u}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,yi),y=u.parse(l[2],2,yi);return g&&y?S5(g.type,[Ti,Gs,fn,vh,yi])?new G5(g,y):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${ko(g.type)} instead`):null}evaluate(l){const u=this.needle.evaluate(l),g=this.haystack.evaluate(l);if(g==null)return!1;if(!nv(u,["boolean","string","number","null"]))throw new el(`Expected first argument to be of type boolean, string, number or null, but found ${ko(dl(u))} instead.`);if(!nv(g,["string","array"]))throw new el(`Expected second argument to be of type array or string, but found ${ko(dl(g))} instead.`);return g.indexOf(u)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class jy{constructor(l,u,g){this.type=fn,this.needle=l,this.haystack=u,this.fromIndex=g}static parse(l,u){if(l.length<=2||l.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,yi),y=u.parse(l[2],2,yi);if(!g||!y)return null;if(!S5(g.type,[Ti,Gs,fn,vh,yi]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${ko(g.type)} instead`);if(l.length===4){const j=u.parse(l[3],3,fn);return j?new jy(g,y,j):null}return new jy(g,y)}evaluate(l){const u=this.needle.evaluate(l),g=this.haystack.evaluate(l);if(!nv(u,["boolean","string","number","null"]))throw new el(`Expected first argument to be of type boolean, string, number or null, but found ${ko(dl(u))} instead.`);if(!nv(g,["string","array"]))throw new el(`Expected second argument to be of type array or string, but found ${ko(dl(g))} instead.`);if(this.fromIndex){const y=this.fromIndex.evaluate(l);return g.indexOf(u,y)}return g.indexOf(u)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const l=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),l]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class fv{constructor(l,u,g,y,j,N){this.inputType=l,this.type=u,this.input=g,this.cases=y,this.outputs=j,this.otherwise=N}static parse(l,u){if(l.length<5)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return u.error("Expected an even number of arguments.");let g,y;u.expectedType&&u.expectedType.kind!=="value"&&(y=u.expectedType);const j={},N=[];for(let B=2;BNumber.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof se=="number"&&Math.floor(se)!==se)return X.error("Numeric branch labels must be integer values.");if(g){if(X.checkSubtype(g,dl(se)))return null}else g=dl(se);if(j[String(se)]!==void 0)return X.error("Branch labels must be unique.");j[String(se)]=N.length}const J=u.parse(G,B,y);if(!J)return null;y=y||J.type,N.push(J)}const E=u.parse(l[1],1,yi);if(!E)return null;const R=u.parse(l[l.length-1],l.length-1,y);return R?E.type.kind!=="value"&&u.concat(1).checkSubtype(g,E.type)?null:new fv(g,y,E,j,N,R):null}evaluate(l){const u=this.input.evaluate(l);return(lk(dl(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every(l=>l.outputDefined())&&this.otherwise.outputDefined()}serialize(){const l=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),g=[],y={};for(const N of u){const E=y[this.cases[N]];E===void 0?(y[this.cases[N]]=g.length,g.push([this.cases[N],[N]])):g[E][1].push(N)}const j=N=>this.inputType.kind==="number"?Number(N):N;for(const[N,E]of g)l.push(E.length===1?j(E[0]):E.map(j)),l.push(this.outputs[N].serialize());return l.push(this.otherwise.serialize()),l}}class pv{constructor(l,u,g){this.type=l,this.branches=u,this.otherwise=g}static parse(l,u){if(l.length<4)return u.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const y=[];for(let N=1;Nu.outputDefined())&&this.otherwise.outputDefined()}serialize(){const l=["case"];return this.eachChild(u=>{l.push(u.serialize())}),l}}class Ek{constructor(l,u,g,y){this.type=l,this.input=u,this.beginIndex=g,this.endIndex=y}static parse(l,u){if(l.length<=2||l.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,yi),y=u.parse(l[2],2,fn);if(!g||!y)return null;if(!S5(g.type,[cc(yi),Gs,yi]))return u.error(`Expected first argument to be of type array or string, but found ${ko(g.type)} instead`);if(l.length===4){const j=u.parse(l[3],3,fn);return j?new Ek(g.type,g,y,j):null}return new Ek(g.type,g,y)}evaluate(l){const u=this.input.evaluate(l),g=this.beginIndex.evaluate(l);if(!nv(u,["string","array"]))throw new el(`Expected first argument to be of type array or string, but found ${ko(dl(u))} instead.`);if(this.endIndex){const y=this.endIndex.evaluate(l);return u.slice(g,y)}return u.slice(g)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const l=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),l]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class K5{constructor(l,u){this.type=cc(Gs),this.str=l,this.delimiter=u}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);const g=u.parse(l[1],1,Gs),y=u.parse(l[2],2,Gs);return g&&y?new K5(g,y):void 0}evaluate(l){const u=this.str.evaluate(l),g=this.delimiter.evaluate(l);return u.split(g)}eachChild(l){l(this.str),l(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Z5(f,l){return f==="=="||f==="!="?l.kind==="boolean"||l.kind==="string"||l.kind==="number"||l.kind==="null"||l.kind==="value":l.kind==="string"||l.kind==="number"||l.kind==="value"}function Y5(f,l,u,g){return g.compare(l,u)===0}function ky(f,l,u){const g=f!=="=="&&f!=="!=";return class gze{constructor(j,N,E){this.type=Ti,this.lhs=j,this.rhs=N,this.collator=E,this.hasUntypedArgument=j.type.kind==="value"||N.type.kind==="value"}static parse(j,N){if(j.length!==3&&j.length!==4)return N.error("Expected two or three arguments.");const E=j[0];let R=N.parse(j[1],1,yi);if(!R)return null;if(!Z5(E,R.type))return N.concat(1).error(`"${E}" comparisons are not supported for type '${ko(R.type)}'.`);let B=N.parse(j[2],2,yi);if(!B)return null;if(!Z5(E,B.type))return N.concat(2).error(`"${E}" comparisons are not supported for type '${ko(B.type)}'.`);if(R.type.kind!==B.type.kind&&R.type.kind!=="value"&&B.type.kind!=="value")return N.error(`Cannot compare types '${ko(R.type)}' and '${ko(B.type)}'.`);g&&(R.type.kind==="value"&&B.type.kind!=="value"?R=new _h(B.type,[R]):R.type.kind!=="value"&&B.type.kind==="value"&&(B=new _h(R.type,[B])));let H=null;if(j.length===4){if(R.type.kind!=="string"&&B.type.kind!=="string"&&R.type.kind!=="value"&&B.type.kind!=="value")return N.error("Cannot use collator to compare non-string types.");if(H=N.parse(j[3],3,ok),!H)return null}return new gze(R,B,H)}evaluate(j){const N=this.lhs.evaluate(j),E=this.rhs.evaluate(j);if(g&&this.hasUntypedArgument){const R=dl(N),B=dl(E);if(R.kind!==B.kind||R.kind!=="string"&&R.kind!=="number")throw new el(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${R.kind}, ${B.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const R=dl(N),B=dl(E);if(R.kind!=="string"||B.kind!=="string")return l(j,N,E)}return this.collator?u(j,N,E,this.collator.evaluate(j)):l(j,N,E)}eachChild(j){j(this.lhs),j(this.rhs),this.collator&&j(this.collator)}outputDefined(){return!0}serialize(){const j=[f];return this.eachChild(N=>{j.push(N.serialize())}),j}}}const Kie=ky("==",function(f,l,u){return l===u},Y5),Zie=ky("!=",function(f,l,u){return l!==u},function(f,l,u,g){return!Y5(0,l,u,g)}),eP=ky("<",function(f,l,u){return l",function(f,l,u){return l>u},function(f,l,u,g){return g.compare(l,u)>0}),Ik=ky("<=",function(f,l,u){return l<=u},function(f,l,u,g){return g.compare(l,u)<=0}),Yie=ky(">=",function(f,l,u){return l>=u},function(f,l,u,g){return g.compare(l,u)>=0});class Pk{constructor(l,u,g,y,j,N){this.type=Gs,this.number=l,this.locale=u,this.currency=g,this.unit=y,this.minFractionDigits=j,this.maxFractionDigits=N}static parse(l,u){if(l.length!==3)return u.error("Expected two arguments.");const g=u.parse(l[1],1,fn);if(!g)return null;const y=l[2];if(typeof y!="object"||Array.isArray(y))return u.error("NumberFormat options argument must be an object.");let j=null;if(y.locale&&(j=u.parseObjectValue(y.locale,2,"locale",Gs),!j))return null;let N=null;if(y.currency&&(N=u.parseObjectValue(y.currency,2,"currency",Gs),!N))return null;let E=null;if(y.unit&&(E=u.parseObjectValue(y.unit,2,"unit",Gs),!E))return null;let R=null;if(y["min-fraction-digits"]&&(R=u.parseObjectValue(y["min-fraction-digits"],2,"min-fraction-digits",fn),!R))return null;let B=null;return y["max-fraction-digits"]&&(B=u.parseObjectValue(y["max-fraction-digits"],2,"max-fraction-digits",fn),!B)?null:new Pk(g,j,N,E,R,B)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(l):void 0,unit:this.unit?this.unit.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.unit&&l(this.unit),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const l={};return this.locale&&(l.locale=this.locale.serialize()),this.currency&&(l.currency=this.currency.serialize()),this.unit&&(l.unit=this.unit.serialize()),this.minFractionDigits&&(l["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(l["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),l]}}class X5{constructor(l){this.type=fn,this.input=l}static parse(l,u){if(l.length!==2)return u.error(`Expected 1 argument, but found ${l.length-1} instead.`);const g=u.parse(l[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${ko(g.type)} instead.`):new X5(g):null}evaluate(l){const u=this.input.evaluate(l);if(typeof u=="string"||Array.isArray(u))return u.length;throw new el(`Expected value to be of type string or array, but found ${ko(dl(u))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}serialize(){const l=["length"];return this.eachChild(u=>{l.push(u.serialize())}),l}}function rP(f){return function(){f=1831565813+(f|=0)|0;let l=Math.imul(f^f>>>15,1|f);return l=l+Math.imul(l^l>>>7,61|l)^l,((l^l>>>14)>>>0)/4294967296}}const Ny={"==":Kie,"!=":Zie,">":tP,"<":eP,">=":Yie,"<=":Ik,array:_h,at:Tk,"at-interpolated":Ak,boolean:_h,case:pv,coalesce:hv,collator:wl,format:lf,image:ns,in:G5,"index-of":jy,interpolate:iu,"interpolate-hcl":iu,"interpolate-lab":iu,length:X5,let:hp,literal:dp,match:fv,number:_h,"number-format":Pk,object:_h,slice:Ek,step:dv,string:_h,"to-boolean":cf,"to-color":cf,"to-number":cf,"to-string":cf,var:jk,within:Mm,distance:$g,config:_y,split:K5};function Q5(f,[l,u,g,y]){l=l.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const j=y?y.evaluate(f):1,N=Fg(l,u,g,j);if(N)throw new el(N);return new vi(l/255,u/255,g/255,j)}function J5(f,[l,u,g,y]){l=l.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const j=y?y.evaluate(f):1,N=function(B,H,G,X){return typeof B=="number"&&B>=0&&B<=360?typeof H=="number"&&H>=0&&H<=100&&typeof G=="number"&&G>=0&&G<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[B,H,G,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[B,H,G,X]:[B,H,G]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[B,H,G,X]:[B,H,G]).join(", ")}]: 'h' must be between 0 and 360.`}(l,u,g,j);if(N)throw new el(N);const E=`hsla(${l}, ${u}%, ${g}%, ${j})`,R=vi.parse(E);if(!R)throw new el(`Failed to parse HSLA color: ${E}`);return R}function nP(f,l){return f in l}function e3(f,l){const u=l[f];return u===void 0?null:u}function Em(f){return{type:f}}function Ug(f){if(f instanceof _y)return new Set([f.key]);let l=new Set;return f.eachChild(u=>{l=new Set([...l,...Ug(u)])}),l}function Lk(f){if(f instanceof Gc&&f.name==="is-active-floor")return!0;let l=!1;return f.eachChild(u=>{!l&&Lk(u)&&(l=!0)}),l}function sP(f){return{result:"success",value:f}}function Im(f){return{result:"error",value:f}}function t3(f,l){return!!f&&!!f.parameters&&f.parameters.indexOf(l)>-1}function mv(f){return f["property-type"]==="data-driven"}function iP(f){return t3(f.expression,"measure-light")}function aP(f){return t3(f.expression,"zoom")}function Ok(f){return!!f.expression&&f.expression.interpolated}function Dk(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function oP(f){return f}function lP(f,l){const u=l.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",y=g||!(g||f.property!==void 0),j=f.type||(Ok(l)?"exponential":"interval");if(u&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map(B=>[B[0],vi.parse(B[1])])),f.default=vi.parse(f.default?f.default:l.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!JI[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let N,E,R;if(j==="exponential")N=cP;else if(j==="interval")N=Qie;else if(j==="categorical"){N=Xie,E=Object.create(null);for(const B of f.stops)E[B[0]]=B[1];R=typeof f.stops[0][0]}else{if(j!=="identity")throw new Error(`Unknown function type "${j}"`);N=dP}if(g){const B={},H=[];for(let J=0;JJ[0]),evaluate:({zoom:J},se)=>cP({stops:G,base:f.base},l,J).evaluate(J,se)}}if(y){const B=j==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:B,interpolationFactor:iu.interpolationFactor.bind(void 0,B),zoomStops:f.stops.map(H=>H[0]),evaluate:({zoom:H})=>N(f,l,H,E,R)}}return{kind:"source",evaluate(B,H){const G=H&&H.properties?H.properties[f.property]:void 0;return G===void 0?uf(f.default,l.default):N(f,l,G,E,R)}}}function uf(f,l,u){return f!==void 0?f:l!==void 0?l:u!==void 0?u:void 0}function Xie(f,l,u,g,y){return uf(typeof u===y?g[u]:void 0,f.default,l.default)}function Qie(f,l,u){if(!py(u))return uf(f.default,l.default);const g=f.stops.length;if(g===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[g-1][0])return f.stops[g-1][1];const y=Nk(f.stops.map(j=>j[0]),u);return f.stops[y][1]}function cP(f,l,u){const g=f.base!==void 0?f.base:1;if(!py(u))return uf(f.default,l.default);const y=f.stops.length;if(y===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[y-1][0])return f.stops[y-1][1];const j=Nk(f.stops.map(H=>H[0]),u),N=function(H,G,X,J){const se=J-X,pe=H-X;return se===0?0:G===1?pe/se:(Math.pow(G,pe)-1)/(Math.pow(G,se)-1)}(u,g,f.stops[j][0],f.stops[j+1][0]),E=f.stops[j][1],R=f.stops[j+1][1];let B=ev[l.type]||oP;if(f.colorSpace&&f.colorSpace!=="rgb"){const H=JI[f.colorSpace];B=(G,X)=>H.reverse(H.interpolate(H.forward(G),H.forward(X),N))}return typeof E.evaluate=="function"?{evaluate(...H){const G=E.evaluate.apply(void 0,H),X=R.evaluate.apply(void 0,H);if(G!==void 0&&X!==void 0)return B(G,X,N)}}:B(E,R,N)}function dP(f,l,u){return l.type==="color"?u=vi.parse(u):l.type==="formatted"?u=Hc.fromString(u.toString()):l.type==="resolvedImage"?u=Wc.build(u.toString()):cn(u)===l.type||l.type==="enum"&&l.values[u]||(u=void 0),uf(u,f.default,l.default)}Gc.register(Ny,{error:[{kind:"error"},[Gs],(f,[l])=>{throw new el(l.evaluate(f))}],typeof:[Gs,[yi],(f,[l])=>ko(dl(l.evaluate(f)))],"to-rgba":[cc(fn,4),[gd],(f,[l])=>l.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[cc(fn,4),[gd],(f,[l])=>l.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[gd,[fn,fn,fn],Q5],rgba:[gd,[fn,fn,fn,fn],Q5],hsl:[gd,[fn,fn,fn],J5],hsla:[gd,[fn,fn,fn,fn],J5],has:{type:Ti,overloads:[[[Gs],(f,[l])=>nP(l.evaluate(f),f.properties())],[[Gs,of],(f,[l,u])=>nP(l.evaluate(f),u.evaluate(f))]]},get:{type:yi,overloads:[[[Gs],(f,[l])=>e3(l.evaluate(f),f.properties())],[[Gs,of],(f,[l,u])=>e3(l.evaluate(f),u.evaluate(f))]]},"feature-state":[yi,[Gs],(f,[l])=>e3(l.evaluate(f),f.featureState||{})],properties:[of,[],f=>f.properties()],"geometry-type":[Gs,[],f=>f.geometryType()],worldview:[Gs,[],f=>f.globals.worldview||""],"is-active-floor":[Ti,Em(Gs),(f,l)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const u=f.globals.activeFloors;return l.some(g=>{const y=g.evaluate(f);return u.has(y)})}],id:[yi,[],f=>f.id()],zoom:[fn,[],f=>f.globals.zoom],pitch:[fn,[],f=>f.globals.pitch||0],"distance-from-center":[fn,[],f=>f.distanceFromCenter()],"measure-light":[fn,[Gs],(f,[l])=>f.measureLight(l.evaluate(f))],"heatmap-density":[fn,[],f=>f.globals.heatmapDensity||0],"line-progress":[fn,[],f=>f.globals.lineProgress||0],"raster-value":[fn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[fn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[fn,[],f=>f.globals.skyRadialProgress||0],accumulated:[yi,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[fn,Em(fn),(f,l)=>{let u=0;for(const g of l)u+=g.evaluate(f);return u}],"*":[fn,Em(fn),(f,l)=>{let u=1;for(const g of l)u*=g.evaluate(f);return u}],"-":{type:fn,overloads:[[[fn,fn],(f,[l,u])=>l.evaluate(f)-u.evaluate(f)],[[fn],(f,[l])=>-l.evaluate(f)]]},"/":[fn,[fn,fn],(f,[l,u])=>l.evaluate(f)/u.evaluate(f)],"%":[fn,[fn,fn],(f,[l,u])=>l.evaluate(f)%u.evaluate(f)],ln2:[fn,[],()=>Math.LN2],pi:[fn,[],()=>Math.PI],e:[fn,[],()=>Math.E],"^":[fn,[fn,fn],(f,[l,u])=>Math.pow(l.evaluate(f),u.evaluate(f))],sqrt:[fn,[fn],(f,[l])=>Math.sqrt(l.evaluate(f))],log10:[fn,[fn],(f,[l])=>Math.log(l.evaluate(f))/Math.LN10],ln:[fn,[fn],(f,[l])=>Math.log(l.evaluate(f))],log2:[fn,[fn],(f,[l])=>Math.log2(l.evaluate(f))],sin:[fn,[fn],(f,[l])=>Math.sin(l.evaluate(f))],cos:[fn,[fn],(f,[l])=>Math.cos(l.evaluate(f))],tan:[fn,[fn],(f,[l])=>Math.tan(l.evaluate(f))],asin:[fn,[fn],(f,[l])=>Math.asin(l.evaluate(f))],acos:[fn,[fn],(f,[l])=>Math.acos(l.evaluate(f))],atan:[fn,[fn],(f,[l])=>Math.atan(l.evaluate(f))],min:[fn,Em(fn),(f,l)=>Math.min(...l.map(u=>u.evaluate(f)))],max:[fn,Em(fn),(f,l)=>Math.max(...l.map(u=>u.evaluate(f)))],abs:[fn,[fn],(f,[l])=>Math.abs(l.evaluate(f))],round:[fn,[fn],(f,[l])=>{const u=l.evaluate(f);return u<0?-Math.round(-u):Math.round(u)}],floor:[fn,[fn],(f,[l])=>Math.floor(l.evaluate(f))],ceil:[fn,[fn],(f,[l])=>Math.ceil(l.evaluate(f))],"filter-==":[Ti,[Gs,yi],(f,[l,u])=>f.properties()[l.value]===u.value],"filter-id-==":[Ti,[yi],(f,[l])=>f.id()===l.value],"filter-type-==":[Ti,[Gs],(f,[l])=>f.geometryType()===l.value],"filter-<":[Ti,[Gs,yi],(f,[l,u])=>{const g=f.properties()[l.value],y=u.value;return typeof g==typeof y&&g{const u=f.id(),g=l.value;return typeof u==typeof g&&u":[Ti,[Gs,yi],(f,[l,u])=>{const g=f.properties()[l.value],y=u.value;return typeof g==typeof y&&g>y}],"filter-id->":[Ti,[yi],(f,[l])=>{const u=f.id(),g=l.value;return typeof u==typeof g&&u>g}],"filter-<=":[Ti,[Gs,yi],(f,[l,u])=>{const g=f.properties()[l.value],y=u.value;return typeof g==typeof y&&g<=y}],"filter-id-<=":[Ti,[yi],(f,[l])=>{const u=f.id(),g=l.value;return typeof u==typeof g&&u<=g}],"filter->=":[Ti,[Gs,yi],(f,[l,u])=>{const g=f.properties()[l.value],y=u.value;return typeof g==typeof y&&g>=y}],"filter-id->=":[Ti,[yi],(f,[l])=>{const u=f.id(),g=l.value;return typeof u==typeof g&&u>=g}],"filter-has":[Ti,[yi],(f,[l])=>l.value in f.properties()],"filter-has-id":[Ti,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Ti,[cc(Gs)],(f,[l])=>l.value.indexOf(f.geometryType())>=0],"filter-id-in":[Ti,[cc(yi)],(f,[l])=>l.value.indexOf(f.id())>=0],"filter-in-small":[Ti,[Gs,cc(yi)],(f,[l,u])=>u.value.indexOf(f.properties()[l.value])>=0],"filter-in-large":[Ti,[Gs,cc(yi)],(f,[l,u])=>function(g,y,j,N){for(;j<=N;){const E=j+N>>1;if(y[E]===g)return!0;y[E]>g?N=E-1:j=E+1}return!1}(f.properties()[l.value],u.value,0,u.value.length-1)],all:{type:Ti,overloads:[[[Ti,Ti],(f,[l,u])=>l.evaluate(f)&&u.evaluate(f)],[Em(Ti),(f,l)=>{for(const u of l)if(!u.evaluate(f))return!1;return!0}]]},any:{type:Ti,overloads:[[[Ti,Ti],(f,[l,u])=>l.evaluate(f)||u.evaluate(f)],[Em(Ti),(f,l)=>{for(const u of l)if(u.evaluate(f))return!0;return!1}]]},"!":[Ti,[Ti],(f,[l])=>!l.evaluate(f)],"is-supported-script":[Ti,[Gs],(f,[l])=>{const u=f.globals&&f.globals.isSupportedScript;return!u||u(l.evaluate(f))}],upcase:[Gs,[Gs],(f,[l])=>l.evaluate(f).toUpperCase()],downcase:[Gs,[Gs],(f,[l])=>l.evaluate(f).toLowerCase()],concat:[Gs,Em(yi),(f,l)=>l.map(u=>Vu(u.evaluate(f))).join("")],"resolved-locale":[Gs,[ok],(f,[l])=>l.evaluate(f).resolvedLocale()],random:[fn,[fn,fn,yi],(f,l)=>{const[u,g,y]=l.map(N=>N.evaluate(f));if(u>g||u===g)return u;let j;if(typeof y=="string")j=function(N){let E=0;if(N.length===0)return E;for(let R=0;RJSON.stringify(G)).join(", ")}, but found ${JSON.stringify(H)} instead.`);return H}catch(H){const G=H;return this._warningHistory[G.message]||(this._warningHistory[G.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${G.message}`)),this._defaultValue}}}function gv(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in Ny}function Pm(f,l,u,g,y){const j=new kk(Ny,[],l?function(E){const R={color:gd,string:Gs,number:fn,enum:Gs,boolean:Ti,formatted:tv,resolvedImage:rv};return E.type==="array"?cc(R[E.value]||yi,E.length):R[E.type]}(l):void 0,void 0,void 0,u,g,y),N=j.parse(f,void 0,void 0,void 0,l&&l.type==="string"?{typeAnnotation:"coerce"}:void 0);return N?sP(new Rk(N,l,u,g,y)):Im(j.errors)}class Sy{constructor(l,u,g,y){this.kind=l,this._styleExpression=u,this.isLightConstant=g,this.isLineProgressConstant=y,this.isStateDependent=l!=="constant"&&!cv(u.expression),this.configDependencies=Ug(u.expression),this.isIndoorDependent=Lk(u.expression)}evaluateWithoutErrorHandling(l,u,g,y,j,N){return this._styleExpression.evaluateWithoutErrorHandling(l,u,g,y,j,N)}evaluate(l,u,g,y,j,N,E){return this._styleExpression.evaluate(l,u,g,y,j,N,void 0,void 0,E)}}class qg{constructor(l,u,g,y,j,N){this.kind=l,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=l!=="camera"&&!cv(u.expression),this.isIndoorDependent=Lk(u.expression),this.isLightConstant=j,this.isLineProgressConstant=N,this.configDependencies=Ug(u.expression),this.interpolationType=y}evaluateWithoutErrorHandling(l,u,g,y,j,N){return this._styleExpression.evaluateWithoutErrorHandling(l,u,g,y,j,N)}evaluate(l,u,g,y,j,N){return this._styleExpression.evaluate(l,u,g,y,j,N)}interpolationFactor(l,u,g){return this.interpolationType?iu.interpolationFactor(this.interpolationType,l,u,g):0}}function r3(f,l,u,g,y){if((f=Pm(f,l,u,g,y)).result==="error")return f;const j=f.value.expression,N=yy(j);if(!N&&!mv(l))return Im([new qu("","data expressions not supported")]);const E=vy(j,["zoom","pitch","distance-from-center"]);if(!E&&!aP(l))return Im([new qu("","zoom expressions not supported")]);const R=vy(j,["measure-light"]);if(!R&&!iP(l))return Im([new qu("","measure-light expression not supported")]);const B=vy(j,["line-progress"]);if(!B&&!function(X){return t3(X.expression,"line-progress")}(l))return Im([new qu("","line-progress expression not supported")]);const H=l.expression&&l.expression.relaxZoomRestriction,G=wh(j);return G||E||H?G instanceof qu?Im([G]):G instanceof iu&&!Ok(l)?Im([new qu("",'"interpolate" expressions cannot be used with this property')]):sP(G?new qg(N&&B?"camera":"composite",f.value,G.labels,G instanceof iu?G.interpolation:void 0,R,B):new Sy(N&&B?"constant":"source",f.value,R,B)):Im([new qu("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Fk{constructor(l,u){this._parameters=l,this._specification=u,Object.assign(this,lP(this._parameters,this._specification))}static deserialize(l){return new Fk(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function wh(f){let l=null;if(f instanceof hp)l=wh(f.result);else if(f instanceof hv){for(const u of f.args)if(l=wh(u),l)break}else(f instanceof dv||f instanceof iu)&&f.input instanceof Gc&&f.input.name==="zoom"&&(l=f);return l instanceof qu||f.eachChild(u=>{const g=wh(u);g instanceof qu?l=g:l&&g&&l!==g&&(l=new qu("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),l}var n3,uP,hP=function(){if(uP)return n3;uP=1,n3=l;var f=3;function l(u,g,y){var j=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var N=new Int32Array(this.arrayBuffer);u=N[0],this.d=(g=N[1])+2*(y=N[2]);for(var E=0;E=X[pe+0]&&j>=X[pe+1])?(R[se]=!0,E.push(G[se])):R[se]=!1}}},l.prototype._forEachCell=function(u,g,y,j,N,E,R,B){for(var H=this._convertToCellCoord(u),G=this._convertToCellCoord(g),X=this._convertToCellCoord(y),J=this._convertToCellCoord(j),se=H;se<=X;se++)for(var pe=G;pe<=J;pe++){var ke=this.d*pe+se;if((!B||B(this._convertFromCellCoord(se),this._convertFromCellCoord(pe),this._convertFromCellCoord(se+1),this._convertFromCellCoord(pe+1)))&&N.call(this,u,g,y,j,ke,E,R,B))return}},l.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},l.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},l.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,g=f+this.cells.length+1+1,y=0,j=0;j=0||(y[j]=fp(f[j],l)));f instanceof Error&&(y.message=f.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return g!=="Object"&&(y.$name=g),y}throw new Error("can't serialize object of type "+typeof f)}function Lm(f){if(f==null||typeof f=="boolean"||typeof f=="number"||typeof f=="string"||f instanceof Boolean||f instanceof Number||f instanceof String||f instanceof Date||f instanceof RegExp||xv(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(Lm);if(typeof f=="object"){const l=f.$name||"Object";if(l==="Map"){const y=f.entries||[],j=new Map;for(let N=0;Nf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519,Osage:f=>f>=66736&&f<=66815,"CJK Unified Ideographs Extension B":f=>f>=131072&&f<=173791};function yv(f){for(const l of f)if(zk(l.charCodeAt(0)))return!0;return!1}function s3(f){for(const l of f)if(!fP(l.charCodeAt(0)))return!1;return!0}function fP(f){return!(Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f))}function zk(f){return!(f!==746&&f!==747&&(f<4352||!(Tn["Bopomofo Extended"](f)||Tn.Bopomofo(f)||Tn["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||Tn["CJK Compatibility Ideographs"](f)||Tn["CJK Compatibility"](f)||Tn["CJK Radicals Supplement"](f)||Tn["CJK Strokes"](f)||!(!Tn["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||Tn["CJK Unified Ideographs Extension A"](f)||Tn["CJK Unified Ideographs"](f)||Tn["Enclosed CJK Letters and Months"](f)||Tn["Hangul Compatibility Jamo"](f)||Tn["Hangul Jamo Extended-A"](f)||Tn["Hangul Jamo Extended-B"](f)||Tn["Hangul Jamo"](f)||Tn["Hangul Syllables"](f)||Tn.Hiragana(f)||Tn["Ideographic Description Characters"](f)||Tn.Kanbun(f)||Tn["Kangxi Radicals"](f)||Tn["Katakana Phonetic Extensions"](f)||Tn.Katakana(f)&&f!==12540||!(!Tn["Halfwidth and Fullwidth Forms"](f)||f===65288||f===65289||f===65293||f>=65306&&f<=65310||f===65339||f===65341||f===65343||f>=65371&&f<=65503||f===65507||f>=65512&&f<=65519)||!(!Tn["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||Tn["Unified Canadian Aboriginal Syllabics"](f)||Tn["Unified Canadian Aboriginal Syllabics Extended"](f)||Tn["Vertical Forms"](f)||Tn["Yijing Hexagram Symbols"](f)||Tn["Yi Syllables"](f)||Tn["Yi Radicals"](f))))}function Bk(f){return!(zk(f)||function(l){return!!(Tn["Latin-1 Supplement"](l)&&(l===167||l===169||l===174||l===177||l===188||l===189||l===190||l===215||l===247)||Tn["General Punctuation"](l)&&(l===8214||l===8224||l===8225||l===8240||l===8241||l===8251||l===8252||l===8258||l===8263||l===8264||l===8265||l===8273)||Tn["Letterlike Symbols"](l)||Tn["Number Forms"](l)||Tn["Miscellaneous Technical"](l)&&(l>=8960&&l<=8967||l>=8972&&l<=8991||l>=8996&&l<=9e3||l===9003||l>=9085&&l<=9114||l>=9150&&l<=9165||l===9167||l>=9169&&l<=9179||l>=9186&&l<=9215)||Tn["Control Pictures"](l)&&l!==9251||Tn["Optical Character Recognition"](l)||Tn["Enclosed Alphanumerics"](l)||Tn["Geometric Shapes"](l)||Tn["Miscellaneous Symbols"](l)&&!(l>=9754&&l<=9759)||Tn["Miscellaneous Symbols and Arrows"](l)&&(l>=11026&&l<=11055||l>=11088&&l<=11097||l>=11192&&l<=11243)||Tn["CJK Symbols and Punctuation"](l)||Tn.Katakana(l)||Tn["Private Use Area"](l)||Tn["CJK Compatibility Forms"](l)||Tn["Small Form Variants"](l)||Tn["Halfwidth and Fullwidth Forms"](l)||l===8734||l===8756||l===8757||l>=9984&&l<=10087||l>=10102&&l<=10131||l===65532||l===65533)}(f))}function $k(f){return Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function i3(f){return f>=1424&&f<=2303||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function pp(f,l){return!(!l&&i3(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||Tn.Khmer(f))}function Jie(f){for(const l of f)if(i3(l.charCodeAt(0)))return!0;return!1}const Rd={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let a3=null,Kc=Rd.unavailable,mp=null;const vv=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(Kc=Rd.error),a3&&a3(f)};function Uk(){qk.fire(new af("pluginStateChange",{pluginStatus:Kc,pluginURL:mp}))}const qk=new Rg,_v=function(){return Kc},pP=function(){if(Kc!==Rd.deferred||!mp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Kc=Rd.loading,Uk(),mp&&$u({url:mp},f=>{f?vv(f):(Kc=Rd.loaded,Uk())})},gp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Kc===Rd.loaded||gp.applyArabicShaping!=null,isLoading:()=>Kc===Rd.loading,setState(f){Kc=f.pluginStatus,mp=f.pluginURL},isParsing:()=>Kc===Rd.parsing,isParsed:()=>Kc===Rd.parsed,getPluginURL:()=>mp};class Ji{constructor(l,u){this.zoom=l,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.transition=u.transition,this.pitch=u.pitch,this.brightness=u.brightness,this.worldview=u.worldview,this.activeFloors=u.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(l){return function(u,g){for(const y of u)if(!pp(y.charCodeAt(0),g))return!1;return!0}(l,gp.isLoaded())}}class Vk{constructor(l,u,g,y,j){this.property=l,this.value=u,this.expression=function(N,E,R,B,H){if(Dk(N))return new Fk(N,E);if(gv(N)||Array.isArray(N)&&N.length>0){const G=r3(N,E,R,B,H);if(G.result==="error")throw new Error(G.value.map(X=>`${X.key}: ${X.message}`).join(", "));return G.value}{let G=N;return typeof N=="string"&&E.type==="color"&&(G=vi.parse(N)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>G}}}(u===void 0?l.specification.default:u,l.specification,g,y,j)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(l,u,g,y){return this.property.possiblyEvaluate(this,l,u,g,y)}}class o3{constructor(l,u,g,y){this.property=l,this.value=new Vk(l,void 0,u,g,y)}transitioned(l,u){return new gP(this.property,this.value,u,Object.assign({},l.transition,this.transition),l.now)}untransitioned(){return new gP(this.property,this.value,null,{},0)}}class mP{constructor(l,u,g,y){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues),this._scope=u,this._options=g,this._iconImageUseTheme=y,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(l){return ar(this._values[l].value.value)}setValue(l,u){this._values.hasOwnProperty(l)||(this._values[l]=new o3(this._values[l].property,this._scope,this._options,this._iconImageUseTheme)),this._values[l].value=new Vk(this._values[l].property,u===null?void 0:ar(u),this._scope,this._options,this._iconImageUseTheme),this._values[l].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[l].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[l].value.isIndoorDependent())}setTransitionOrValue(l,u){u&&(this._options=u);const g=this._properties.properties;if(l)for(const y in l){const j=l[y];if(y.endsWith("-transition")){const N=y.slice(0,-11);g[N]&&this.setTransition(N,j)}else g.hasOwnProperty(y)&&this.setValue(y,j)}}getTransition(l){return ar(this._values[l].transition)}setTransition(l,u){this._values.hasOwnProperty(l)||(this._values[l]=new o3(this._values[l].property)),this._values[l].transition=ar(u)||void 0}serialize(){const l={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(l[u]=g);const y=this.getTransition(u);y!==void 0&&(l[`${u}-transition`]=y)}return l}transitioned(l,u){const g=new xP(this._properties);for(const y of Object.keys(this._values))g._values[y]=this._values[y].transitioned(l,u._values[y]);return g}untransitioned(){const l=new xP(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].untransitioned();return l}isIndoorDependent(){return this._isIndoorDependent}}class gP{constructor(l,u,g,y,j){const N=y.delay||0,E=y.duration||0;j=j||0,this.property=l,this.value=u,this.begin=j+N,this.end=this.begin+E,l.specification.transition&&(y.delay||y.duration)&&(this.prior=g)}possiblyEvaluate(l,u,g){const y=l.now||0,j=this.value.possiblyEvaluate(l,u,g),N=this.prior;if(N){if(y>this.end)return this.prior=null,j;if(this.value.isDataDriven())return this.prior=null,j;if(y":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function vP(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function Hk(f){if(Array.isArray(f))return f.map(Hk);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const l={};for(const u in f)l[u]=Hk(f[u]);return l}return vP(f)}function hf(f){if(f===!0||f===!1)return!0;if(!Array.isArray(f)||f.length===0)return!1;switch(f[0]){case"has":return f.length>=2&&f[1]!=="$id"&&f[1]!=="$type";case"in":return f.length>=3&&(typeof f[1]!="string"||Array.isArray(f[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return f.length!==3||Array.isArray(f[1])||Array.isArray(f[2]);case"any":case"all":for(const l of f.slice(1))if(!hf(l)&&typeof l!="boolean")return!1;return!0;default:return!0}}function Wk(f,l="",u=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};hf(f)||(f=Gk(f));const y=f;let j=!0;try{j=function(H){if(!My(H))return H;let G=Hk(H);return _P(G),G=Kg(G),G}(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(y,null,2)} `)}let N=null,E=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){E=Rt[`filter_${g}`];const H=Pm(j,E,l,u);if(H.result==="error")throw new Error(H.value.map(G=>`${G.key}: ${G.message}`).join(", "));N=(G,X,J)=>H.value.evaluate(G,X,{},J)}let R=null,B=null;if(j!==y){const H=Pm(y,E,l,u);if(H.result==="error")throw new Error(H.value.map(G=>`${G.key}: ${G.message}`).join(", "));R=(G,X,J,se,pe)=>H.value.evaluate(G,X,{},J,void 0,void 0,se,pe),B=!yy(H.value.expression)}return{filter:N,dynamicFilter:R||void 0,needGeometry:bP(j),needFeature:!!B}}function Kg(f){if(!Array.isArray(f))return f;const l=function(u){if(eae.has(u[0])){for(let g=1;gKg(u))}function _P(f){let l=!1;const u=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function tae(f,l){return fl?1:0}function bP(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let l=1;l"||l==="<="||l===">="?Kk(f[1],f[2],l):l==="any"?(u=f.slice(1),["any"].concat(u.map(Gk))):l==="all"?["all"].concat(f.slice(1).map(Gk)):l==="none"?["all"].concat(f.slice(1).map(Gk).map(bv)):l==="in"?Zk(f[1],f.slice(2)):l==="!in"?bv(Zk(f[1],f.slice(2))):l==="has"?Yk(f[1]):l!=="!has"||bv(Yk(f[1]));var u}function Kk(f,l,u){switch(f){case"$type":return[`filter-type-${u}`,l];case"$id":return[`filter-id-${u}`,l];default:return[`filter-${u}`,f,l]}}function Zk(f,l){if(l.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",l]];case"$id":return["filter-id-in",["literal",l]];default:return l.length>200&&!l.some(u=>typeof u!=typeof l[0])?["filter-in-large",f,["literal",l.sort(tae)]]:["filter-in-small",f,["literal",l]]}}function Yk(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function bv(f){return["!",f]}const Zg="";function jh(f,l){return l?`${f}${Zg}${l}`:f}let wP;const jP=()=>wP||(wP=new Fa({"icon-size":new Ir(Rt.layout_symbol["icon-size"]),"icon-image":new Ir(Rt.layout_symbol["icon-image"]),"icon-rotate":new Ir(Rt.layout_symbol["icon-rotate"]),"icon-offset":new Ir(Rt.layout_symbol["icon-offset"]),"text-size":new Ir(Rt.layout_symbol["text-size"]),"text-rotate":new Ir(Rt.layout_symbol["text-rotate"]),"text-offset":new Ir(Rt.layout_symbol["text-offset"])}));class kP{constructor(l,u,g,y,j,N){const E=Pm(l,Rt.appearance.condition);if(E.result==="success"&&(this.condition=E.value),this.name=u,g){this.properties=new Wg(jP()),this.unevaluatedLayout=new yP(jP(),y,j,N);for(const R in g)this.unevaluatedLayout.setValue(R,g[R])}}isActive(l){return!(this.condition||!l.isHidden||this.name!=="hidden")||this.condition.evaluate(l.globals,l.feature,l.featureState,l.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(l){return this.properties.get(l)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(l){return this.unevaluatedLayout._values[l]}recalculate(l,u,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(l,void 0,u,g))}serialize(){const l={};return l.condition=this.condition.expression.serialize(),this.name&&(l.name=this.name),this.unevaluatedLayout&&(l.properties=this.unevaluatedLayout.serialize()),l}hasIconProperties(){const l=this.hasProperty("icon-image"),u=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),y=this.hasProperty("icon-rotate");return l||u||g||y}hasTextProperties(){const l=this.hasProperty("text-size"),u=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return l||u||g}hasProperty(l){return this.getUnevaluatedProperty(l).value!==void 0}}const NP="-transition",ff=new Set(["fill","line","background","hillshade","raster"]);class Zc extends Rg{constructor(l,u,g,y,j,N){if(super(),this.id=l.id,this.fqid=jh(this.id,g),this.type=l.type,this.scope=g,this.lut=y,this.options=j,this.iconImageUseTheme=N,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},l.type!=="custom"){if(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type&&l.type!=="background"&&l.type!=="sky"&&l.type!=="slot"){this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter;const E=Pm(this.filter,Rt[`filter_${l.type}`]);E.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...E.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||E.value.isIndoorDependent)}if(l.slot&&(this.slot=l.slot),l.appearances&&this.setAppearances(l.appearances),u.layout&&(this._unevaluatedLayout=new yP(u.layout,this.scope,j,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),u.paint){this._transitionablePaint=new mP(u.paint,this.scope,j);for(const E in l.paint)this.setPaintProperty(E,l.paint[E]);for(const E in l.layout)this.setLayoutProperty(E,l.layout[E]);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 Wg(u.paint)}}}onAdd(l){}onRemove(l){}isDraped(l){return!this.is3D(!0)&&ff.has(this.type)}getLayoutProperty(l){return l==="visibility"?this.visibility:this._unevaluatedLayout.getValue(l)}setLayoutProperty(l,u){if(this.type==="custom"&&l==="visibility")return void(this.visibility=u);const g=this._unevaluatedLayout;g._properties.properties[l]&&(g.setValue(l,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),l==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(l){this.appearances=[],l.forEach(u=>{this.appearances.push(new kP(u.condition,u.name,u.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(l){return l.endsWith(NP)?this._transitionablePaint.getTransition(l.slice(0,-11)):this._transitionablePaint.getValue(l)}isPaintProperty(l){return!!this._transitionablePaint._properties.properties[l]}setPaintProperty(l,u){const g=this._transitionablePaint,y=g._properties.properties;if(l.endsWith(NP)){const G=l.slice(0,-11);return y[G]&&g.setTransition(G,u||void 0),!1}if(!y[l])return!1;const j=g._values[l],N=j.value.isDataDriven(),E=j.value;g.setValue(l,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(l);const R=g._values[l].value,B=R.isDataDriven(),H=l.endsWith("pattern")||l==="line-dasharray";return B||N||H||this._handleOverridablePaintPropertyUpdate(l,E,R)}_handleSpecialPaintPropertyUpdate(l){}getProgramIds(){return null}getDefaultProgramParams(l,u,g){return null}_handleOverridablePaintPropertyUpdate(l,u,g){return!1}isHidden(l){return!!(this.minzoom&&l=this.maxzoom)||this.visibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(l,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,u,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,u)}serialize(){const l={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&&(l.appearances=this.appearances.map(u=>u.serialize())),mr(l,(u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length))}is3D(l){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 l in this.paint._values){const u=this.paint.get(l);if(u instanceof Hg&&mv(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}for(const l of this.appearances)if(!cv(l.condition.expression))return!0;return!1}compileFilter(l){this._filterCompiled||(this._featureFilter=Wk(this.filter,this.scope,l),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(l){this._stats&&(l.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(l,u,g){return{}}queryRadius(l){}queryIntersectsFeature(l,u,g,y,j,N,E,R,B){}}const SP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class wv{constructor(l,u){this._structArray=l,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const rae=new ArrayBuffer(0);class fa{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(l,u){return l._trim(),u&&l.arrayBuffer&&u.add(l.arrayBuffer),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){const u=Object.create(this.prototype);return u.arrayBuffer=l.arrayBuffer,u.length=l.length,l.arrayBuffer?u.capacity=l.arrayBuffer.byteLength/u.bytesPerElement:(u.capacity=0,u.arrayBuffer=rae),u._refreshViews(),u}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this._reallocCount++,this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}reserveForAdditional(l){this.reserve(this.length+l)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...l){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...l){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 Ss(f,l=1){let u=0,g=0;return{members:f.map(y=>{const j=SP[y.type].BYTES_PER_ELEMENT,N=u=CP(u,Math.max(l,j)),E=y.components||1;return g=Math.max(g,j),u+=j*E,{name:y.name,type:y.type,components:E,offset:N}}),size:CP(u,Math.max(g,l)),alignment:l}}function CP(f,l){return Math.ceil(f/l)*l}class Om extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u){const g=this.length;return this.resize(g+1),this.emplace(g,l,u)}emplace(l,u,g){const y=2*l;return this.int16[y+0]=u,this.int16[y+1]=g,l}}Om.prototype.bytesPerElement=4,Xr(Om,"StructArrayLayout2i4");class Ty extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g){const y=this.length;return this.resize(y+1),this.emplace(y,l,u,g)}emplace(l,u,g,y){const j=3*l;return this.int16[j+0]=u,this.int16[j+1]=g,this.int16[j+2]=y,l}}Ty.prototype.bytesPerElement=6,Xr(Ty,"StructArrayLayout3i6");class Ay extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,y){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,y)}emplace(l,u,g,y,j){const N=4*l;return this.int16[N+0]=u,this.int16[N+1]=g,this.int16[N+2]=y,this.int16[N+3]=j,l}}Ay.prototype.bytesPerElement=8,Xr(Ay,"StructArrayLayout4i8");class xp extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.float32[1*l+0]=u,l}}xp.prototype.bytesPerElement=4,Xr(xp,"StructArrayLayout1f4");class l3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g){const y=this.length;return this.resize(y+1),this.emplace(y,l,u,g)}emplace(l,u,g,y){const j=4*l,N=2*l;return this.int16[j+0]=u,this.int16[j+1]=g,this.float32[N+1]=y,l}}l3.prototype.bytesPerElement=8,Xr(l3,"StructArrayLayout2i1f8");class c3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g){const y=this.length;return this.resize(y+1),this.emplace(y,l,u,g)}emplace(l,u,g,y){const j=4*l;return this.int16[j+0]=u,this.int16[j+1]=g,this.int16[j+2]=y,l}}c3.prototype.bytesPerElement=8,Xr(c3,"StructArrayLayout3i8");class d3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,y,j)}emplace(l,u,g,y,j,N){const E=5*l;return this.int16[E+0]=u,this.int16[E+1]=g,this.int16[E+2]=y,this.int16[E+3]=j,this.int16[E+4]=N,l}}d3.prototype.bytesPerElement=10,Xr(d3,"StructArrayLayout5i10");class Xk extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,y,j,N,E)}emplace(l,u,g,y,j,N,E,R){const B=6*l,H=12*l,G=3*l;return this.int16[B+0]=u,this.int16[B+1]=g,this.uint8[H+4]=y,this.uint8[H+5]=j,this.uint8[H+6]=N,this.uint8[H+7]=E,this.float32[G+2]=R,l}}Xk.prototype.bytesPerElement=12,Xr(Xk,"StructArrayLayout2i4ub1f12");class au extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g){const y=this.length;return this.resize(y+1),this.emplace(y,l,u,g)}emplace(l,u,g,y){const j=3*l;return this.float32[j+0]=u,this.float32[j+1]=g,this.float32[j+2]=y,l}}au.prototype.bytesPerElement=12,Xr(au,"StructArrayLayout3f12");class xd extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,y,j)}emplace(l,u,g,y,j,N){const E=6*l,R=3*l;return this.uint16[E+0]=u,this.uint16[E+1]=g,this.uint16[E+2]=y,this.uint16[E+3]=j,this.float32[R+2]=N,l}}xd.prototype.bytesPerElement=12,Xr(xd,"StructArrayLayout4ui1f12");class Yg extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,y){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,y)}emplace(l,u,g,y,j){const N=4*l;return this.uint16[N+0]=u,this.uint16[N+1]=g,this.uint16[N+2]=y,this.uint16[N+3]=j,l}}Yg.prototype.bytesPerElement=8,Xr(Yg,"StructArrayLayout4ui8");class Qk extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,y,j,N)}emplace(l,u,g,y,j,N,E){const R=6*l;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=y,this.int16[R+3]=j,this.int16[R+4]=N,this.int16[R+5]=E,l}}Qk.prototype.bytesPerElement=12,Xr(Qk,"StructArrayLayout6i12");class u3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E,R,B,H,G,X){const J=this.length;return this.resize(J+1),this.emplace(J,l,u,g,y,j,N,E,R,B,H,G,X)}emplace(l,u,g,y,j,N,E,R,B,H,G,X,J){const se=12*l;return this.int16[se+0]=u,this.int16[se+1]=g,this.int16[se+2]=y,this.int16[se+3]=j,this.uint16[se+4]=N,this.uint16[se+5]=E,this.uint16[se+6]=R,this.uint16[se+7]=B,this.int16[se+8]=H,this.int16[se+9]=G,this.int16[se+10]=X,this.int16[se+11]=J,l}}u3.prototype.bytesPerElement=24,Xr(u3,"StructArrayLayout4i4ui4i24");class h3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,y,j,N)}emplace(l,u,g,y,j,N,E){const R=10*l,B=5*l;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=y,this.float32[B+2]=j,this.float32[B+3]=N,this.float32[B+4]=E,l}}h3.prototype.bytesPerElement=20,Xr(h3,"StructArrayLayout3i3f20");class Dm extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,y)}emplace(l,u,g,y,j){const N=4*l;return this.float32[N+0]=u,this.float32[N+1]=g,this.float32[N+2]=y,this.float32[N+3]=j,l}}Dm.prototype.bytesPerElement=16,Xr(Dm,"StructArrayLayout4f16");class Jk extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint32[1*l+0]=u,l}}Jk.prototype.bytesPerElement=4,Xr(Jk,"StructArrayLayout1ul4");class ou extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u){const g=this.length;return this.resize(g+1),this.emplace(g,l,u)}emplace(l,u,g){const y=2*l;return this.uint16[y+0]=u,this.uint16[y+1]=g,l}}ou.prototype.bytesPerElement=4,Xr(ou,"StructArrayLayout2ui4");class eN extends fa{_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(l,u,g,y,j,N,E,R,B,H,G,X,J){const se=this.length;return this.resize(se+1),this.emplace(se,l,u,g,y,j,N,E,R,B,H,G,X,J)}emplace(l,u,g,y,j,N,E,R,B,H,G,X,J,se){const pe=20*l,ke=10*l;return this.int16[pe+0]=u,this.int16[pe+1]=g,this.int16[pe+2]=y,this.int16[pe+3]=j,this.int16[pe+4]=N,this.float32[ke+3]=E,this.float32[ke+4]=R,this.float32[ke+5]=B,this.float32[ke+6]=H,this.int16[pe+14]=G,this.uint32[ke+8]=X,this.uint16[pe+18]=J,this.uint16[pe+19]=se,l}}eN.prototype.bytesPerElement=40,Xr(eN,"StructArrayLayout5i4f1i1ul2ui40");class tN extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,y,j,N,E)}emplace(l,u,g,y,j,N,E,R){const B=8*l;return this.int16[B+0]=u,this.int16[B+1]=g,this.int16[B+2]=y,this.int16[B+4]=j,this.int16[B+5]=N,this.int16[B+6]=E,this.int16[B+7]=R,l}}tN.prototype.bytesPerElement=16,Xr(tN,"StructArrayLayout3i2i2i16");class rN extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,y,j)}emplace(l,u,g,y,j,N){const E=4*l,R=8*l;return this.float32[E+0]=u,this.float32[E+1]=g,this.float32[E+2]=y,this.int16[R+6]=j,this.int16[R+7]=N,l}}rN.prototype.bytesPerElement=16,Xr(rN,"StructArrayLayout2f1f2i16");class f3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,y,j,N)}emplace(l,u,g,y,j,N,E){const R=20*l,B=5*l;return this.uint8[R+0]=u,this.uint8[R+1]=g,this.float32[B+1]=y,this.float32[B+2]=j,this.float32[B+3]=N,this.float32[B+4]=E,l}}f3.prototype.bytesPerElement=20,Xr(f3,"StructArrayLayout2ub4f20");class Ro extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g){const y=this.length;return this.resize(y+1),this.emplace(y,l,u,g)}emplace(l,u,g,y){const j=3*l;return this.uint16[j+0]=u,this.uint16[j+1]=g,this.uint16[j+2]=y,l}}Ro.prototype.bytesPerElement=6,Xr(Ro,"StructArrayLayout3ui6");class Ey extends fa{_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(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt){const it=this.length;return this.resize(it+1),this.emplace(it,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt)}emplace(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt,it){const pt=30*l,wt=15*l,St=60*l;return this.int16[pt+0]=u,this.int16[pt+1]=g,this.int16[pt+2]=y,this.float32[wt+2]=j,this.float32[wt+3]=N,this.uint16[pt+8]=E,this.uint16[pt+9]=R,this.uint32[wt+5]=B,this.uint32[wt+6]=H,this.uint32[wt+7]=G,this.uint16[pt+16]=X,this.uint16[pt+17]=J,this.uint16[pt+18]=se,this.float32[wt+10]=pe,this.float32[wt+11]=ke,this.uint8[St+48]=we,this.uint8[St+49]=Oe,this.uint8[St+50]=ze,this.uint32[wt+13]=qe,this.int16[pt+28]=dt,this.uint8[St+58]=it,l}}Ey.prototype.bytesPerElement=60,Xr(Ey,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class p3 extends fa{_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(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt,it,pt,wt,St,Gt,Pt,Jt,or,lr,gr,yr,hr){const fr=this.length;return this.resize(fr+1),this.emplace(fr,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt,it,pt,wt,St,Gt,Pt,Jt,or,lr,gr,yr,hr)}emplace(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt,it,pt,wt,St,Gt,Pt,Jt,or,lr,gr,yr,hr,fr){const Qt=20*l,Kt=40*l,pr=80*l;return this.float32[Qt+0]=u,this.float32[Qt+1]=g,this.int16[Kt+4]=y,this.int16[Kt+5]=j,this.int16[Kt+6]=N,this.int16[Kt+7]=E,this.int16[Kt+8]=R,this.int16[Kt+9]=B,this.int16[Kt+10]=H,this.int16[Kt+11]=G,this.int16[Kt+12]=X,this.uint16[Kt+13]=J,this.uint16[Kt+14]=se,this.uint16[Kt+15]=pe,this.uint16[Kt+16]=ke,this.uint16[Kt+17]=we,this.uint16[Kt+18]=Oe,this.uint16[Kt+19]=ze,this.uint16[Kt+20]=qe,this.uint16[Kt+21]=dt,this.uint16[Kt+22]=it,this.uint16[Kt+23]=pt,this.uint16[Kt+24]=wt,this.uint16[Kt+25]=St,this.uint16[Kt+26]=Gt,this.uint16[Kt+27]=Pt,this.uint32[Qt+14]=Jt,this.float32[Qt+15]=or,this.float32[Qt+16]=lr,this.float32[Qt+17]=gr,this.float32[Qt+18]=yr,this.uint8[pr+76]=hr,this.uint16[Kt+39]=fr,l}}p3.prototype.bytesPerElement=80,Xr(p3,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class m3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N){const E=this.length;return this.resize(E+1),this.emplace(E,l,u,g,y,j,N)}emplace(l,u,g,y,j,N,E){const R=6*l;return this.float32[R+0]=u,this.float32[R+1]=g,this.float32[R+2]=y,this.float32[R+3]=j,this.float32[R+4]=N,this.float32[R+5]=E,l}}m3.prototype.bytesPerElement=24,Xr(m3,"StructArrayLayout6f24");class Xg extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j){const N=this.length;return this.resize(N+1),this.emplace(N,l,u,g,y,j)}emplace(l,u,g,y,j,N){const E=5*l;return this.float32[E+0]=u,this.float32[E+1]=g,this.float32[E+2]=y,this.float32[E+3]=j,this.float32[E+4]=N,l}}Xg.prototype.bytesPerElement=20,Xr(Xg,"StructArrayLayout5f20");class g3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,y,j,N,E)}emplace(l,u,g,y,j,N,E,R){const B=7*l;return this.float32[B+0]=u,this.float32[B+1]=g,this.float32[B+2]=y,this.float32[B+3]=j,this.float32[B+4]=N,this.float32[B+5]=E,this.float32[B+6]=R,l}}g3.prototype.bytesPerElement=28,Xr(g3,"StructArrayLayout7f28");class x3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E,R,B,H,G){const X=this.length;return this.resize(X+1),this.emplace(X,l,u,g,y,j,N,E,R,B,H,G)}emplace(l,u,g,y,j,N,E,R,B,H,G,X){const J=11*l;return this.float32[J+0]=u,this.float32[J+1]=g,this.float32[J+2]=y,this.float32[J+3]=j,this.float32[J+4]=N,this.float32[J+5]=E,this.float32[J+6]=R,this.float32[J+7]=B,this.float32[J+8]=H,this.float32[J+9]=G,this.float32[J+10]=X,l}}x3.prototype.bytesPerElement=44,Xr(x3,"StructArrayLayout11f44");class Iy extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E,R,B){const H=this.length;return this.resize(H+1),this.emplace(H,l,u,g,y,j,N,E,R,B)}emplace(l,u,g,y,j,N,E,R,B,H){const G=9*l;return this.float32[G+0]=u,this.float32[G+1]=g,this.float32[G+2]=y,this.float32[G+3]=j,this.float32[G+4]=N,this.float32[G+5]=E,this.float32[G+6]=R,this.float32[G+7]=B,this.float32[G+8]=H,l}}Iy.prototype.bytesPerElement=36,Xr(Iy,"StructArrayLayout9f36");class pf extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u){const g=this.length;return this.resize(g+1),this.emplace(g,l,u)}emplace(l,u,g){const y=2*l;return this.float32[y+0]=u,this.float32[y+1]=g,l}}pf.prototype.bytesPerElement=8,Xr(pf,"StructArrayLayout2f8");class yd extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,g,y){const j=this.length;return this.resize(j+1),this.emplace(j,l,u,g,y)}emplace(l,u,g,y,j){const N=6*l;return this.uint32[3*l+0]=u,this.uint16[N+2]=g,this.uint16[N+3]=y,this.uint16[N+4]=j,l}}yd.prototype.bytesPerElement=12,Xr(yd,"StructArrayLayout1ul3ui12");class Rm extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint16[1*l+0]=u,l}}Rm.prototype.bytesPerElement=2,Xr(Rm,"StructArrayLayout1ui2");class y3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke){const we=this.length;return this.resize(we+1),this.emplace(we,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke)}emplace(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we){const Oe=16*l;return this.float32[Oe+0]=u,this.float32[Oe+1]=g,this.float32[Oe+2]=y,this.float32[Oe+3]=j,this.float32[Oe+4]=N,this.float32[Oe+5]=E,this.float32[Oe+6]=R,this.float32[Oe+7]=B,this.float32[Oe+8]=H,this.float32[Oe+9]=G,this.float32[Oe+10]=X,this.float32[Oe+11]=J,this.float32[Oe+12]=se,this.float32[Oe+13]=pe,this.float32[Oe+14]=ke,this.float32[Oe+15]=we,l}}y3.prototype.bytesPerElement=64,Xr(y3,"StructArrayLayout16f64");class nN extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,g,y,j,N,E){const R=this.length;return this.resize(R+1),this.emplace(R,l,u,g,y,j,N,E)}emplace(l,u,g,y,j,N,E,R){const B=10*l,H=5*l;return this.uint16[B+0]=u,this.uint16[B+1]=g,this.uint16[B+2]=y,this.uint16[B+3]=j,this.float32[H+2]=N,this.float32[H+3]=E,this.float32[H+4]=R,l}}nN.prototype.bytesPerElement=20,Xr(nN,"StructArrayLayout4ui3f20");class v3 extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.int16[1*l+0]=u,l}}v3.prototype.bytesPerElement=2,Xr(v3,"StructArrayLayout1i2");class sN extends fa{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(l){const u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint8[1*l+0]=u,l}}sN.prototype.bytesPerElement=1,Xr(sN,"StructArrayLayout1ub1");class iN extends wv{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]}}iN.prototype.size=40;class MP extends eN{get(l){return new iN(this,l)}}Xr(MP,"CollisionBoxArray");class aN extends wv{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(l){this._structArray.uint8[this._pos1+49]=l}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(l){this._structArray.uint8[this._pos1+50]=l}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(l){this._structArray.uint32[this._pos4+13]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(l){this._structArray.uint8[this._pos1+58]=l}}aN.prototype.size=60;class TP extends Ey{get(l){return new aN(this,l)}}Xr(TP,"PlacedSymbolArray");class AP extends wv{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(l){this._structArray.uint32[this._pos4+14]=l}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(l){this._structArray.float32[this._pos4+18]=l}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}AP.prototype.size=80;class _3 extends p3{get(l){return new AP(this,l)}}Xr(_3,"SymbolInstanceArray");class oN extends xp{getoffsetX(l){return this.float32[1*l+0]}}Xr(oN,"GlyphOffsetArray");class EP extends Om{getx(l){return this.int16[2*l+0]}gety(l){return this.int16[2*l+1]}}Xr(EP,"SymbolLineVertexArray");class b3 extends wv{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]}}b3.prototype.size=12;class w3 extends yd{get(l){return new b3(this,l)}}Xr(w3,"FeatureIndexArray");class IP extends ou{geta_centroid_pos0(l){return this.uint16[2*l+0]}geta_centroid_pos1(l){return this.uint16[2*l+1]}}Xr(IP,"FillExtrusionCentroidArray");class lN extends wv{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]}}lN.prototype.size=6;class jv extends Ty{get(l){return new lN(this,l)}}Xr(jv,"FillExtrusionWallArray");const PP=Ss([{name:"a_pos",components:2,type:"Int16"}],4),nae=Ss([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),LP=Ss([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class ka{constructor(l=[]){this.segments=l}_prepareSegment(l,u,g,y){let j=this.segments[this.segments.length-1];return l>ka.MAX_VERTEX_ARRAY_LENGTH&&$r(`Max vertices per segment is ${ka.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}`),(!j||j.vertexLength+l>ka.MAX_VERTEX_ARRAY_LENGTH||j.sortKey!==y)&&(j={vertexOffset:u,primitiveOffset:g,vertexLength:0,primitiveLength:0},y!==void 0&&(j.sortKey=y),this.segments.push(j)),j}prepareSegment(l,u,g,y){return this._prepareSegment(l,u.length,g.length,y)}get(){return this.segments}destroy(){for(const l of this.segments)for(const u in l.vaos)l.vaos[u].destroy()}static simpleSegment(l,u,g,y){return new ka([{vertexOffset:l,primitiveOffset:u,vertexLength:g,primitiveLength:y,vaos:{},sortKey:0}])}}function cN(f,l){return 256*(f=_e(Math.floor(f),0,255))+_e(Math.floor(l),0,255)}ka.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Xr(ka,"SegmentVector");const sae=Ss([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),iae=Ss([{name:"a_pattern_b",components:4,type:"Uint16"}]),aae=Ss([{name:"a_dash",components:4,type:"Uint16"}]);class kv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(l,u,g,y){this.ids.push(j3(l)),this.positions.push(u,g,y)}eachPosition(l,u){const g=j3(l);let y=0,j=this.ids.length-1;for(;y>1;this.ids[N]>=g?j=N:y=N+1}for(;this.ids[y]===g;)u(this.positions[3*y],this.positions[3*y+1],this.positions[3*y+2]),y++}static serialize(l,u){const g=new Float64Array(l.ids),y=new Uint32Array(l.positions);return k3(g,y,0,g.length-1),u&&(u.add(g.buffer),u.add(y.buffer)),{ids:g,positions:y}}static deserialize(l){const u=new kv;let g;u.ids=l.ids,u.positions=l.positions;for(const y of u.ids)y!==g&&u.uniqueIds.push(y),g=y;return u.indexed=!0,u}}function j3(f){const l=+f;return Number.isSafeInteger(l)?l:ik(String(f))}function k3(f,l,u,g){for(;u>1];let j=u-1,N=g+1;for(;;){do j++;while(f[j]y);if(j>=N)break;dN(f,j,N),dN(l,3*j,3*N),dN(l,3*j+1,3*N+1),dN(l,3*j+2,3*N+2)}N-u`u_${j}`),this.type=g,this.context=y}setUniform(l,u,g,y,j){const N=y.constantOr(this.value);u.set(l,j,N instanceof vi?N.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):N)}getBinding(l,u){return this.type==="color"?new Sv(l):new Fo(l)}}class Py{constructor(l,u){this.uniformNames=u.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(l,u){this.pixelRatio=l.pixelRatio||1,this.pattern=l.tl.concat(l.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(l,u,g,y,j){let N=null;j!=="u_pattern"&&j!=="u_dash"||(N=this.pattern),j==="u_pattern_b"&&(N=this.patternTransition),j==="u_pixel_ratio"&&(N=this.pixelRatio),N&&u.set(l,j,N)}getBinding(l,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new hN(l):new Fo(l)}}class vp{constructor(l,u,g,y){this.expression=l,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map(j=>({name:`a_${j}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(l,u,g,y,j,N,E,R){const B=this.paintVertexArray.length,H=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ji(0,{brightness:N,worldview:R}),u,{},j,y,E):this.expression.kind==="constant"&&this.expression.value,G=Mv(this.lutExpression,u,{},y,j,N,E,R);this.paintVertexArray.resize(l),this._setPaintValue(B,l,H,G?null:this.context.lut)}updatePaintArray(l,u,g,y,j,N,E,R){const B=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:E,worldview:R},g,y,void 0,j):this.expression.kind==="constant"&&this.expression.value,H=Mv(this.lutExpression,g,y,j,void 0,E,void 0,R);this._setPaintValue(l,u,B,H?null:this.context.lut)}_setPaintValue(l,u,g,y){if(this.type==="color"){const j=N3(g.toPremultipliedRenderColor(y));for(let N=l;N`u_${E}_t`),this.type=g,this.useIntegerZoom=y,this.context=j,this.maxValue=0,this.paintVertexAttributes=u.map(E=>({name:`a_${E}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new N}populatePaintArray(l,u,g,y,j,N,E,R){const B=this.expression.evaluate(new Ji(this.context.zoom,{brightness:N,worldview:R}),u,{},j,y,E),H=this.expression.evaluate(new Ji(this.context.zoom+1,{brightness:N,worldview:R}),u,{},j,y,E),G=Mv(this.lutExpression,u,{},y,j,N,E,R),X=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(X,l,B,H,G?null:this.context.lut)}updatePaintArray(l,u,g,y,j,N,E,R){const B=this.expression.evaluate({zoom:this.context.zoom,brightness:E,worldview:R},g,y,void 0,j),H=this.expression.evaluate({zoom:this.context.zoom+1,brightness:E,worldview:R},g,y,void 0,j),G=Mv(this.lutExpression,g,y,j,void 0,E,void 0,R);this._setPaintValue(l,u,B,H,G?null:this.context.lut)}_setPaintValue(l,u,g,y,j){if(this.type==="color"){const N=N3(g.toPremultipliedRenderColor(j)),E=N3(g.toPremultipliedRenderColor(j));for(let R=l;R!0){this.binders={},this._buffers=[],this.context=u;const y=[];for(const j in l.paint._values){const N=l.paint.get(j);if(j.endsWith("-use-theme")||!g(j)||!(N instanceof Hg&&mv(N.property.specification)))continue;const E=dae(j,l.type),R=N.value,B=N.property.specification.type,H=!!N.property.useIntegerZoom,G=j==="line-dasharray"||j.endsWith("pattern"),X=l.paint.get(`${j}-use-theme`),J=j==="line-dasharray"&&l.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(R.kind!=="constant"||J)if(R.kind==="source"||J||G){const se=S3(j,B,"source");this.binders[j]=G?new bp(R,E,B,se,l.id):new vp(R,E,B,se),y.push(`/a_${j}`)}else{const se=S3(j,B,"composite");this.binders[j]=new _p(R,E,B,H,u,se),y.push(`/z_${j}`)}else this.binders[j]=G?new Py(R.value,E):new Tv(R.value,E,B,u),y.push(`/u_${j}`);X&&(this.binders[j].lutExpression=X.value)}this.cacheKey=y.sort().join("")}getMaxValue(l){const u=this.binders[l];return u instanceof vp||u instanceof _p?u.maxValue:0}populatePaintArrays(l,u,g,y,j,N,E,R){for(const B in this.binders){const H=this.binders[B];H.context=this.context,(H instanceof vp||H instanceof _p||H instanceof bp)&&H.populatePaintArray(l,u,g,y,j,N,E,R)}}setConstantPatternPositions(l,u){for(const g in this.binders){const y=this.binders[g];y instanceof Py&&y.setConstantPatternPositions(l,u)}}getPatternTransitionVertexBuffer(l){const u=this.binders[l];return u instanceof bp?u.paintTransitionVertexBuffer:null}updatePaintArrays(l,u,g,y,j,N,E,R,B,H){let G=!1;const X=Object.keys(l),J=X.length!==0&&!R,se=J?X:u.uniqueIds;this.context.lut=j.lut;for(const pe in this.binders){const ke=this.binders[pe];if(ke.context=this.context,(ke instanceof vp||ke instanceof _p||ke instanceof bp)&&ke.expression&&ke.expression.kind&&ke.expression.kind!=="constant"&&(ke.expression.isStateDependent===!0||ke.expression.isLightConstant===!1)){const we=j.paint.get(pe);ke.expression=we.value;for(const Oe of se){const ze=l[Oe.toString()];u.eachPosition(Oe,(qe,dt,it)=>{const pt=y.feature(qe);ke.updatePaintArray(dt,it,pt,ze,N,E,B,H)})}if(!J)for(const Oe of g.uniqueIds){const ze=l[Oe.toString()];g.eachPosition(Oe,(qe,dt,it)=>{const pt=y.feature(qe);ke.updatePaintArray(dt,it,pt,ze,N,E,B,H)})}G=!0}}return G}defines(){const l=[];for(const u in this.binders){const g=this.binders[u];(g instanceof Tv||g instanceof Py)&&l.push(...g.uniformNames.map(y=>`#define HAS_UNIFORM_${y}`))}return l}getPaintVertexBuffers(){return this._buffers}getUniforms(l){const u=[];for(const g in this.binders){const y=this.binders[g];if(y instanceof Tv||y instanceof Py||y instanceof _p)for(const j of y.uniformNames)u.push({name:j,property:g,binding:y.getBinding(l,j)})}return u}setUniforms(l,u,g,y,j){for(const{name:N,property:E,binding:R}of g)this.binders[E].setUniform(l,R,j,y.get(E),N)}updatePaintBuffers(){this._buffers=[];for(const l in this.binders){const u=this.binders[l];(u instanceof vp||u instanceof _p||u instanceof bp)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer),u instanceof bp&&u.paintTransitionVertexBuffer&&this._buffers.push(u.paintTransitionVertexBuffer)}}upload(l){for(const u in this.binders){const g=this.binders[u];(g instanceof vp||g instanceof _p||g instanceof bp)&&g.upload(l)}this.updatePaintBuffers()}destroy(){for(const l in this.binders){const u=this.binders[l];(u instanceof vp||u instanceof _p||u instanceof bp)&&u.destroy()}}}class kh{constructor(l,u,g=()=>!0){this.programConfigurations={};for(const y of l)this.programConfigurations[y.id]=new Fm(y,u,g);this.needsUpload=!1,this._featureMap=new kv,this._featureMapWithoutIds=new kv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(l,u,g,y,j,N,E,R,B){for(const H in this.programConfigurations)this.programConfigurations[H].populatePaintArrays(l,u,y,j,N,E,R,B);u.id!==void 0?this._featureMap.add(u.id,g,this._bufferOffset,l):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,l),this._idlessCounter+=1),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,u,g,y,j,N,E,R){for(const B of g)this.needsUpload=this.programConfigurations[B.id].updatePaintArrays(l,this._featureMap,this._featureMapWithoutIds,u,B,y,j,N,E||0,R)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(l);this.needsUpload=!1}}destroy(){for(const l in this.programConfigurations)this.programConfigurations[l].destroy()}}const cae={"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 dae(f,l){return cae[f]||[f.replace(`${l}-`,"").replace(/-/g,"_")]}const uae={"line-pattern":{source:xd,composite:xd},"fill-pattern":{source:xd,composite:xd},"fill-extrusion-pattern":{source:xd,composite:xd},"line-dasharray":{source:Yg,composite:Yg}},hae={color:{source:pf,composite:Dm},number:{source:xp,composite:pf}};function S3(f,l,u){const g=uae[f];return g&&g[u]||hae[l][u]}Xr(Tv,"ConstantBinder"),Xr(Py,"PatternConstantBinder"),Xr(vp,"SourceExpressionBinder"),Xr(bp,"PatternCompositeBinder"),Xr(_p,"CompositeExpressionBinder"),Xr(Fm,"ProgramConfiguration",{omit:["_buffers"]}),Xr(kh,"ProgramConfigurationSet");const dc=Mr/Math.PI/2,Gu=5,mN=6,fae=16383,Ly=64,C3=[Ly,32,16],Ku=-dc,Zu=dc;function Qg(f,l,u,g=dc){return u=rs(u),[f*Math.sin(u)*g,-l*g,f*Math.cos(u)*g]}function Oy(f,l,u){return Qg(Math.cos(rs(f)),Math.sin(rs(f)),l,u)}const _=63710088e-1,d=2*Math.PI*_;class p{constructor(l,u){if(isNaN(l)||isNaN(u))throw new Error(`Invalid LngLat object: (${l}, ${u})`);if(this.lng=+l,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new p(We(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){const u=Math.PI/180,g=this.lat*u,y=l.lat*u,j=Math.sin(g)*Math.sin(y)+Math.cos(g)*Math.cos(y)*Math.cos((l.lng-this.lng)*u);return _*Math.acos(Math.min(j,1))}toBounds(l=0){const u=360*l/40075017,g=u/Math.cos(Math.PI/180*this.lat);return new b({lng:this.lng-g,lat:this.lat-u},{lng:this.lng+g,lat:this.lat+u})}toEcef(l){return Oy(this.lat,this.lng,dc+l*dc/_)}static convert(l){if(l instanceof p)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new p(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new p(Number("lng"in l?l.lng:l.lon),Number(l.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 b{constructor(l,u){l&&(u?this.setSouthWest(l).setNorthEast(u):Array.isArray(l)&&l.length===4?this.setSouthWest([l[0],l[1]]).setNorthEast([l[2],l[3]]):this.setSouthWest(l[0]).setNorthEast(l[1]))}setNorthEast(l){return this._ne=l instanceof p?new p(l.lng,l.lat):p.convert(l),this}setSouthWest(l){return this._sw=l instanceof p?new p(l.lng,l.lat):p.convert(l),this}extend(l){const u=this._sw,g=this._ne;let y,j;if(l instanceof p)y=l,j=l;else{if(!(l instanceof b))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(b.convert(l)):this.extend(p.convert(l)):typeof l=="object"&&l!==null&&l.hasOwnProperty("lat")&&(l.hasOwnProperty("lon")||l.hasOwnProperty("lng"))?this.extend(p.convert(l)):this;if(y=l._sw,j=l._ne,!y||!j)return this}return u||g?(u.lng=Math.min(y.lng,u.lng),u.lat=Math.min(y.lat,u.lat),g.lng=Math.max(j.lng,g.lng),g.lat=Math.max(j.lat,g.lat)):(this._sw=new p(y.lng,y.lat),this._ne=new p(j.lng,j.lat)),this}getCenter(){return new p((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 p(this.getWest(),this.getNorth())}getSouthEast(){return new p(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(l){const{lng:u,lat:g}=p.convert(l);let y=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(y=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&y}static convert(l){if(l)return l instanceof b?l:new b(l)}}const M=0,L=25.5;function O(f){return d*Math.cos(f*Math.PI/180)}function z(f){return(180+f)/360}function V(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function Y(f,l){return f/O(l)}function Q(f){return 360*f-180}function ce(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function le(f,l){return f*O(ce(l))}const de=85.051129;function be(f){return Math.cos(rs(_e(f,-de,de)))}function xe(f,l){const u=_e(l,M,L),g=Math.pow(2,u);return be(f)*d/(512*g)}function Pe(f){return 1/Math.cos(f*Math.PI/180)}function Ee(f,l=0){const u=Math.exp(Math.PI*(1-(f.y+l/Mr)/(1<=R?(Ke(f,l,u,B,H,j,G,E,R),Ke(f,B,H,g,y,G,N,E,R)):f.push(N)}function Ue(f,l,u){let g=f[0],y=g.x,j=g.y;l(g);const N=[g];for(let E=1;Ef.x+1||gf.y+1)&&$r("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function _t(f,l,u){const g=f.loadGeometry(),y=f.extent,j=Mr/y;if(l&&u&&u.projection.isReprojectedInTileSpace){const N=1<{const J=Q((l.x+X.x/y)/N),se=ce((l.y+X.y/y)/N),pe=H.project(J,se);X.x=(pe.x*E-R)*y,X.y=(pe.y*E-B)*y};for(let X=0;X=y||se.y<0||se.y>=y||(G(se),J.push(se));g[X]=J}}for(const N of g)for(const E of N)st(E,j);return g}function It(f,l){return{type:f.type,id:f.id,properties:f.properties,geometry:l?_t(f):[]}}class Tt{constructor(l,u,g,y,j){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=l,this._geometry=-1,this._keys=y,this._values=j,l.readFields(Vt,this,u)}loadGeometry(){const l=this._pbf;l.pos=this._geometry;const u=l.readVarint()+l.pos,g=[];let y,j=1,N=0,E=0,R=0;for(;l.pos>3}if(N--,j===1||j===2)E+=l.readSVarint(),R+=l.readSVarint(),j===1&&(y&&g.push(y),y=[]),y&&y.push(new ir(E,R));else{if(j!==7)throw new Error(`unknown command ${j}`);y&&y.push(y[0].clone())}}return y&&g.push(y),g}bbox(){const l=this._pbf;l.pos=this._geometry;const u=l.readVarint()+l.pos;let g=1,y=0,j=0,N=0,E=1/0,R=-1/0,B=1/0,H=-1/0;for(;l.pos>3}if(y--,g===1||g===2)j+=l.readSVarint(),N+=l.readSVarint(),jR&&(R=j),NH&&(H=N);else if(g!==7)throw new Error(`unknown command ${g}`)}return[E,B,R,H]}toGeoJSON(l,u,g){const y=this.extent*Math.pow(2,g),j=this.extent*l,N=this.extent*u,E=this.loadGeometry();function R(X){return[360*(X.x+j)/y-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+N)/y)*Math.PI))-90]}function B(X){return X.map(R)}let H;if(this.type===1){const X=[];for(const se of E)X.push(se[0]);const J=B(X);H=X.length===1?{type:"Point",coordinates:J[0]}:{type:"MultiPoint",coordinates:J}}else if(this.type===2){const X=E.map(B);H=X.length===1?{type:"LineString",coordinates:X[0]}:{type:"MultiLineString",coordinates:X}}else{if(this.type!==3)throw new Error("unknown feature type");{const X=function(se){const pe=se.length;if(pe<=1)return[se];const ke=[];let we,Oe;for(let ze=0;ze=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];const u=this._pbf.readVarint()+this._pbf.pos;return new Tt(this._pbf,u,this.extent,this._keys,this._values)}}function br(f,l,u){f===15?l.version=u.readVarint():f===1?l.name=u.readString():f===5?l.extent=u.readVarint():f===2?l._features.push(u.pos):f===3?l._keys.push(u.readString()):f===4&&l._values.push(function(g){let y=null;const j=g.readVarint()+g.pos;for(;g.pos>3;y=N===1?g.readString():N===2?g.readFloat():N===3?g.readDouble():N===4?g.readVarint64():N===5?g.readVarint():N===6?g.readSVarint():N===7?g.readBoolean():null}if(y==null)throw new Error("unknown feature value");return y}(u))}class zt{constructor(l,u){this.layers=l.readFields(Nt,{},u)}}function Nt(f,l,u){if(f===3){const g=new nr(u,u.readVarint()+u.pos);g.length&&(l[g.name]=g)}}const Zt="3d_elevation_id",qt="level";class ur{constructor(){this._valid=!1}reset(l){return this.feature=l,this._valid=!0,this._geometry=l.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(l,u){return this._valid&&l(u(this._geometry)),this}require(l,u,g){return this.get(l,!0,u,g)}optional(l,u,g){return this.get(l,!1,u,g)}success(){return this._valid}get(l,u,g,y){const j=this.feature.properties.hasOwnProperty(l)?+this.feature.properties[l]:void 0;return this._valid&&j!==void 0&&!Number.isNaN(j)?g(y?y(j):j):u&&(this._valid=!1),this}}class Ar{constructor(l,u){this.featureFunc=l,this.vertexFunc=u}parseFeature(l,u,g){return this.featureFunc(l,u,g)}parseVertex(l,u,g){return this.vertexFunc(l,u,g)}}const qr=new Ar((f,l,u)=>f.reset(l).require(Zt,g=>{u.id=g}).optional("fixed_height_relative",g=>{u.constantHeight=g},wr.decodeRelativeHeight).geometry(g=>{u.bounds=g},up).success(),(f,l,u)=>f.reset(l).require(Zt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height_relative",g=>{u.height=g},wr.decodeRelativeHeight).geometry(g=>{u.position=g},wr.getPoint).success()),Sr=new Ar((f,l,u)=>f.reset(l).require(Zt,g=>{u.id=g}).optional("fixed_height",g=>{u.constantHeight=g},wr.decodeMetricHeight).geometry(g=>{u.bounds=g},up).success(),(f,l,u)=>f.reset(l).require(Zt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height",g=>{u.height=g},wr.decodeMetricHeight).geometry(g=>{u.position=g},wr.getPoint).success());class wr{static getPoint(l){return _r(l[0][0].x,l[0][0].y)}static decodeRelativeHeight(l){return 1e-4*l*5}static decodeMetricHeight(l){return 1e-4*l}static getVersionSchema(l){return l?l==="1.0.1"?Sr:void 0:qr}static parse(l){const u=[],g=[],y=l.length,j=new ur;for(let N=0;N=0);if(j===0)return 0;j!==l.length&&(u=!1)}return u?2:1}function Kn(f,l){for(const u of f.projections){const g=Vr(l,f.points[0],u.axis);if(u.projection[1]g[1])return 0}return 1}function Is(f,l){let u=0;const g=[0,0,0,0];for(let N=0;N=0&&u++;var y,j;return u}class ci{constructor(l,u){this.points=l||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=on.fromPoints(this.points),this.projections=[],this.frustumEdges=[Me([],this.points[2],this.points[3]),Me([],this.points[0],this.points[3]),Me([],this.points[4],this.points[0]),Me([],this.points[5],this.points[1]),Me([],this.points[6],this.points[2]),Me([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const y=[0,-g[2],g[1]],j=[g[2],0,-g[0]];this.projections.push({axis:y,projection:Vr(this.points,this.points[0],y)}),this.projections.push({axis:j,projection:Vr(this.points,this.points[0],j)})}}static fromInvProjectionMatrix(l,u,g,y){const j=Math.pow(2,g),N=[[-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(B=>{const H=Lt([],B,l),G=1/H[3]/u*j;return(X=H)[0]=(J=H)[0]*(se=[G,G,y?1/H[3]:G,G])[0],X[1]=J[1]*se[1],X[2]=J[2]*se[2],X[3]=J[3]*se[3],X;var X,J,se}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(B=>{const H=Fe([],Je([],Me([],N[B[0]],N[B[1]]),Me([],N[B[2]],N[B[1]]))),G=-Ce(H,N[B[1]]);return H.concat(G)}),R=[];for(let B=0;BB[1]||B[0]>R[1])return 0}return 1}containsPoint(l){for(const u of this.planes){const g=u[3];if(Ce([u[0],u[1],u[2]],l)+g<0)return!1}return!0}}class on{static fromPoints(l){const u=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const y of l)Se(u,u,y),oe(g,g,y);return new on(u,g)}static fromTileIdAndHeight(l,u,g){const y=1<l.max[u]||l.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(l){return!(this.min[0]>l.max[0]||l.min[0]>this.max[0]||this.min[1]>l.max[1]||l.min[1]>this.max[1])}encapsulate(l){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],l.min[u]),this.max[u]=Math.max(this.max[u],l.max[u])}encapsulatePoint(l){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],l[u]),this.max[u]=Math.max(this.max[u],l[u])}closestPoint(l){return[Math.max(Math.min(this.max[0],l[0]),this.min[0]),Math.max(Math.min(this.max[1],l[1]),this.min[1]),Math.max(Math.min(this.max[2],l[2]),this.min[2])]}}Xr(on,"Aabb");class ri{constructor(l,u){this.feature=l,this.metersToTile=u,this.index=0}get(){const l=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,g=u[1],y=-u[0],j=(l.extent+1)*this.metersToTile;return[new ir(Math.trunc(l.position[0]+g*j),Math.trunc(l.position[1]+y*j)),new ir(Math.trunc(l.position[0]-g*j),Math.trunc(l.position[1]-y*j))]}next(){this.index++}valid(){return this.index{return E.a0?ae(R,R,1/B):me(R,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(l){if(this.edges.length===0)return;let u=0,g=Number.POSITIVE_INFINITY,y=0;const[j,N,E,R,B,H,G]=this._tmpVec2;js(G,l.x,l.y);const X=new nn(G,null);for(let J=0;J0?Xo(R,E)/qe:0,it=_e(dt,0,1),pt=Math.abs((dt-it)*this.edgeProps[J].len);fi(B,G,ke),js(H,pe[1],-pe[0]);const wt=pt+Math.abs(Xo(B,H));wt=0;--N){const E=this.edges[N].a,R=this.edges[N].b,{position:B,height:H,extent:G}=this.vertices[E],{position:X,height:J,extent:se}=this.vertices[R],pe=this.vertexProps[E].dir,ke=this.vertexProps[R].dir;if(me(u,B[0]/l,B[1]/l,H),me(g,X[0]/l,X[1]/l,J),me(y,pe[1],-pe[0],0),ae(y,y,G),me(j,ke[1],-ke[0],0),ae(j,j,se),this.distSqLines(ie(u[0]+.5*y[0],u[1]+.5*y[1],u[2]+.5*y[2]),ie(g[0]-.5*j[0],g[1]-.5*j[1],g[2]-.5*j[2]),ie(u[0]-.5*y[0],u[1]-.5*y[1],u[2]-.5*y[2]),ie(g[0]+.5*j[0],g[1]+.5*j[1],g[2]+.5*j[2]))<=.0025000000000000005)continue;const we=this.vertices.length,Oe=Ii(Fs(),B,X);this.vertices.push({position:Aa(Oe,Oe,.5),height:.5*(H+J),extent:.5*(G+se)});const ze=Ii(Fs(),pe,ke);this.vertexProps.push({dir:Yo(ze,ze)}),this.edges.splice(N,1),this.edgeProps.splice(N,1),this.edges.push({a:E,b:we}),this.edges.push({a:we,b:R});const qe=fi(Fs(),this.vertices[we].position,B),dt=ca(qe),it={vec:qe,dir:Aa(Fs(),qe,1/dt),len:dt};this.edgeProps.push(it),this.edgeProps.push(it)}}distSqLines(l,u,g,y){const j=ve(je(),u,l),N=ve(je(),y,g),E=ve(je(),l,g),R=Ce(j,j),B=Ce(j,N),H=Ce(j,E),G=Ce(N,N),X=Ce(N,E),J=R*G-B*B;if(J===0)return Be(Ae(j,g,y,Ce(E,N)/Ce(N,N)),l);const se=(R*X-B*H)/J;return Be(Ae(j,l,u,(B*X-H*G)/J),Ae(N,g,y,se))}}class pi{static parseFrom(l,u){const g=wr.parse(l);if(!g)return[];let{vertices:y,features:j}=g;const N=1/Ee(u);j.sort((H,G)=>H.id-G.id),y.sort((H,G)=>H.id-G.id||H.idx-G.idx),y=y.filter((H,G,X)=>G===X.findIndex(J=>J.id===H.id&&J.idx===H.idx));const E=new Array;let R=0;const B=y.length;for(const H of j){if(H.constantHeight){E.push(new Hn(H.id,H.bounds,H.constantHeight));continue}for(;R!==B&&y[R].idy.id===g)}}class Ai{constructor(l,u){this.zScale=1,this.xOffset=0,this.yOffset=0,l.equals(u)||(this.zScale=Math.pow(2,u.z-l.z),this.xOffset=(l.x*this.zScale-u.x)*Mr,this.yOffset=(l.y*this.zScale-u.y)*Mr)}constantElevation(l,u){if(l.constantHeight!=null)return this.computeBiasedHeight(l.constantHeight,u)}pointElevation(l,u,g){const y=this.constantElevation(u,g);return y??(l.x=l.x*this.zScale+this.xOffset,l.y=l.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(l),g))}computeBiasedHeight(l,u){return u<=0?l:l+u*De(0,u,l>=0?l:Math.abs(.5*l))}}Xr(Hn,"ElevationFeature");class _i{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.projection=l.projection,this.layoutVertexArray=new Om,this.indexArray=new Ro,this.segments=new ka,this.programConfigurations=new kh(l.layers,{zoom:l.zoom,lut:l.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new xp),this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,y){}populate(l,u,g,y){const j=this.layers[0],N=[];let E=null;j.type==="circle"&&(E=j.layout.get("circle-sort-key"));for(const{feature:B,id:H,index:G,sourceLayerIndex:X}of l){const J=this.layers[0]._featureFilter.needGeometry,se=It(B,J);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),se,g))continue;const pe=E?E.evaluate(se,{},g):void 0,ke={id:H,properties:B.properties,type:B.type,sourceLayerIndex:X,index:G,geometry:J?se.geometry:_t(B,g,y),patterns:{},sortKey:pe};N.push(ke)}E&&N.sort((B,H)=>B.sortKey-H.sortKey);let R=null;y.projection.name==="globe"&&(this.globeExtVertexArray=new Qk,R=y.projection);for(const B of N){const{geometry:H,index:G,sourceLayerIndex:X}=B,J=l[G].feature;this.addFeature(B,H,G,u.availableImages,g,R,u.brightness,u.elevationFeatures),u.featureIndex.insert(J,H,G,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(l,u,g,y,j,N,E){this.programConfigurations.updatePaintArrays(l,u,j,g,y,N,E,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,PP.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=l.createVertexBuffer(this.globeExtVertexArray,LP.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=l.createVertexBuffer(this.elevatedLayoutVertexArray,nae.members))),this.programConfigurations.upload(l),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(l,u,g,y,j,N,E,R){let B;this.elevationMode!=="none"&&(B=pi.getElevationFeature(l,R));for(const H of u)for(const G of H){const X=G.x,J=G.y;if(X<0||X>=Mr||J<0||J>=Mr)continue;if(N){const ke=N.projectTilePoint(X,J,j),we=N.upVector(j,X,J);this.addGlobeExtVertex(ke,we),this.addGlobeExtVertex(ke,we),this.addGlobeExtVertex(ke,we),this.addGlobeExtVertex(ke,we)}const se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,l.sortKey),pe=se.vertexLength;if(this.addCircleVertex(X,J,-1,-1),this.addCircleVertex(X,J,1,-1),this.addCircleVertex(X,J,1,1),this.addCircleVertex(X,J,-1,1),this.elevationMode!=="none"){const ke=B?B.pointElevation(new ir(X,J)):0;this.hasElevation=this.hasElevation||ke!==0;for(let we=0;we<4;we++)this.elevatedLayoutVertexArray.emplaceBack(ke)}this.indexArray.emplaceBack(pe,pe+1,pe+2),this.indexArray.emplaceBack(pe,pe+2,pe+3),se.vertexLength+=4,se.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,g,{},y,j,E,void 0,this.worldview)}addCircleVertex(l,u,g,y){this.layoutVertexArray.emplaceBack(2*l+(g+1)/2,2*u+(y+1)/2)}addGlobeExtVertex(l,u){this.globeExtVertexArray.emplaceBack(l.x,l.y,l.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function ei(f,l){for(let u=0;u1){if(pa(f,l))return!0;for(let g=0;g1?u:u.sub(l)._mult(y)._add(l))}function Na(f,l){let u,g,y,j=!1;for(let N=0;Nl.y!=y.y>l.y&&l.x<(y.x-g.x)*(l.y-g.y)/(y.y-g.y)+g.x&&(j=!j)}return j}function $i(f,l){let u=!1;for(let g=0,y=f.length-1;gl.y!=N.y>l.y&&l.x<(N.x-j.x)*(l.y-j.y)/(N.y-j.y)+j.x&&(u=!u)}return u}function Yc(f,l,u,g,y){for(const N of f)if(l<=N.x&&u<=N.y&&g>=N.x&&y>=N.y)return!0;const j=[new ir(l,u),new ir(l,y),new ir(g,y),new ir(g,u)];if(f.length>2){for(const N of j)if($i(f,N))return!0}for(let N=0;Ny.x&&l.x>y.x||f.yy.y&&l.y>y.y)return!1;const j=Qn(f,l,u[0]);return j!==Qn(f,l,u[1])||j!==Qn(f,l,u[2])||j!==Qn(f,l,u[3])}function zo(f,l,u,g,y,j){let N=l.y-f.y,E=f.x-l.x;if(j=j||0){const R=N*N+E*E;if(R===0)return!0;const B=Math.sqrt(R);N/=B,E/=B}return!((u.x-f.x)*N+(u.y-f.y)*E-j<0||(g.x-f.x)*N+(g.y-f.y)*E-j<0||(y.x-f.x)*N+(y.y-f.y)*E-j<0)}function uc(f,l,u,g,y,j,N){return!(zo(f,l,g,y,j,N)||zo(l,u,g,y,j,N)||zo(u,f,g,y,j,N)||zo(g,y,f,l,u,N)||zo(y,j,f,l,u,N)||zo(j,g,f,l,u,N))}function hc(f,l,u){const g=l.paint.get(f).value;return g.kind==="constant"?g.value:u.programConfigurations.get(l.id).getMaxValue(f)}function Ll(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function lu(f,l,u,g,y){if(!l[0]&&!l[1])return f;const j=ir.convert(l)._mult(y);u==="viewport"&&j._rotate(-g);const N=[];for(let E=0;E>u&&l.y===this.y>>u}url(l,u){const g=function(j,N,E){var R=ro(256*j,256*(N=Math.pow(2,E)-N-1),E),B=ro(256*(j+1),256*(N+1),E);return R[0]+","+R[1]+","+B[0]+","+B[1]}(this.x,this.y,this.z),y=function(j,N,E){let R,B="";for(let H=j;H>0;H--)R=1<this.canonical.z?new Pa(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Pa(l,this.wrap,l,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(l,u=!0){if(this.overscaledZ===l&&u)return this.key;if(l>this.canonical.z)return Sa(this.wrap*+u,l,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-l;return Sa(this.wrap*+u,l,l,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(l){if(l.wrap!==this.wrap)return!1;const u=this.canonical.z-l.canonical.z;return l.overscaledZ===0||l.overscaledZ>u&&l.canonical.y===this.canonical.y>>u}children(l){if(this.overscaledZ>=l)return[new Pa(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const u=this.canonical.z+1,g=2*this.canonical.x,y=2*this.canonical.y;return[new Pa(u,this.wrap,u,g,y),new Pa(u,this.wrap,u,g+1,y),new Pa(u,this.wrap,u,g,y+1),new Pa(u,this.wrap,u,g+1,y+1)]}isLessThan(l){return this.wrapl.wrap)&&(this.overscaledZl.overscaledZ)&&(this.canonical.xl.canonical.x)&&this.canonical.y{let l=f.canonical.x-1,u=f.wrap;return l<0&&(l=(1<{let l=f.canonical.x+1,u=f.wrap;return l===1<new Pa(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Pa(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,y,j,N){const E=Math.sin(j);return g*(Math.sin((1-N)*j)/E)+y*(Math.sin(N*j)/E)}(f.a[l],f.b[l],f.angle,_e(u,0,1))+f.center[l]}function Sh(f){if(f.z<=1)return wp[f.z+2*f.y+f.x];const l=pae(OP(f));return on.fromPoints(l)}function kp(f,l,u){return ae(f,f,1-u),Ne(f,f,l,u)}function j0e(f,l,u){for(const g of f)Ye(g,g,l),ae(g,g,u)}function k0e(f,l,u,g){const y=l/f.worldSize,j=f.globeMatrix;if(u.z<=1){const St=Sh(u).getCorners();return j0e(St,j,y),on.fromPoints(St)}const N=OP(u,g),E=pae(N,dc+gf(f._tileCoverLift));j0e(E,j,y);const R=Number.MAX_VALUE,B=[-R,-R,-R],H=[R,R,R];if(N.contains(f.center)){for(const Pt of E)Se(H,H,Pt),oe(B,B,Pt);B[2]=0;const St=f.point,Gt=[St.x*y,St.y*y,0];return Se(H,H,Gt),oe(B,B,Gt),new on(H,B)}if(f._tileCoverLift>0){for(const St of E)Se(H,H,St),oe(B,B,St);return new on(H,B)}const G=[j[12]*y,j[13]*y,j[14]*y],X=N.getCenter(),J=_e(f.center.lat,-de,de),se=_e(X.lat,-de,de),pe=z(f.center.lng),ke=V(J);let we=pe-z(X.lng);const Oe=ke-V(se);we>.5?we-=1:we<-.5&&(we+=1);let ze=0;Math.abs(we)>Math.abs(Oe)?ze=we>=0?1:3:(ze=Oe>=0?0:2,Ne(G,G,[j[4]*y,j[5]*y,j[6]*y],-Math.sin(rs(Oe>=0?N.getSouth():N.getNorth()))*dc));const qe=E[ze],dt=E[(ze+1)%4],it=new zm(qe,dt,G),pt=[jp(it,0)||qe[0],jp(it,1)||qe[1],jp(it,2)||qe[2]],wt=Fy(f.zoom);if(wt>0){const St=function({x:Pt,y:Jt,z:or},lr,gr,yr,hr){const fr=1/(1<.5?jr=-1:dn<-.5&&(jr=1),Qt=((Qt+jr)*lr-(yr*=lr))*gr+yr,Kt=((Kt+jr)*lr-yr)*gr+yr,pr=(pr*lr-(hr*=lr))*gr+hr,Tr=(Tr*lr-hr)*gr+hr,[[Qt,Tr,0],[Kt,Tr,0],[Kt,pr,0],[Qt,pr,0]]}(u,l,f._pixelsPerMercatorPixel,pe,ke);for(let Pt=0;PtMath.PI/2*1.01}const T0e=rs(85),D$e=Math.cos(T0e),R$e=Math.sin(T0e),F$e=C(),A0e=f=>{const l=[];return f.paint.get("circle-pitch-alignment")==="map"&&l.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&l.push("SCALE_WITH_MAP"),l};function E0e(f,l,u,g,y,j,N,E,R){if(j&&f.queryGeometry.isAboveHorizon)return!1;j&&(R*=f.pixelToTileUnitsFactor);const B=f.tileID.canonical,H=u.projection.upVectorScale(B,u.center.lat,u.worldSize).metersToTile;for(const G of l)for(const X of G){const J=X.add(E),se=y&&u.elevation?u.elevation.exaggeration()*y.getElevationAt(J.x,J.y,!0):0,pe=u.projection.projectTilePoint(J.x,J.y,B);if(se>0){const ze=u.projection.upVector(B,J.x,J.y);pe.x+=ze[0]*H*se,pe.y+=ze[1]*H*se,pe.z+=ze[2]*H*se}const ke=j?J:z$e(pe.x,pe.y,pe.z,g),we=j?f.tilespaceRays.map(ze=>$$e(ze,se)):f.queryGeometry.screenGeometry,Oe=Lt([],[pe.x,pe.y,pe.z,1],g);if(!N&&j?R*=Oe[3]/u.cameraToCenterDistance:N&&!j&&(R*=u.cameraToCenterDistance/Oe[3]),j){const ze=ce((X.y/Mr+B.y)/(1<f.width||y.height>f.height||u.x>f.width-y.width||u.y>f.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>l.width||y.height>l.height||g.x>l.width-y.width||g.y>l.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const R=f.data,B=l.data,H=j===4&&E;for(let G=0;G{l[f.evaluationKey]=R;const B=f.expression.evaluate(l),H=B?B.toNonPremultipliedRenderColor(null):null;H&&(y.data[N+E+0]=Math.floor(255*H.r),y.data[N+E+1]=Math.floor(255*H.g),y.data[N+E+2]=Math.floor(255*H.b),y.data[N+E+3]=Math.floor(255*H.a))};if(f.clips)for(let N=0,E=0;N80*u){E=f[0],R=f[1];let H=E,G=R;for(let X=u;XH&&(H=J),se>G&&(G=se)}B=Math.max(H-E,G-R),B=B!==0?32767/B:0}return A3(j,N,u,E,R,B,0),N}function $0e(f,l,u,g,y){let j;if(y===function(N,E,R,B){let H=0;for(let G=E,X=R-B;G0)for(let N=l;N=l;N-=g)j=H0e(N/g|0,f[N],f[N+1],j);return j&&xN(j,j.next)&&(P3(j),j=j.next),j}function Iv(f,l){if(!f)return f;l||(l=f);let u,g=f;do if(u=!1,g.steiner||!xN(g,g.next)&&jl(g.prev,g,g.next)!==0)g=g.next;else{if(P3(g),g=l=g.prev,g===g.next)break;u=!0}while(u||g!==l);return l}function A3(f,l,u,g,y,j,N){if(!f)return;!N&&j&&function(R,B,H,G){let X=R;do X.z===0&&(X.z=vae(X.x,X.y,B,H,G)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==R);X.prevZ.nextZ=null,X.prevZ=null,function(J){let se,pe=1;do{let ke,we=J;J=null;let Oe=null;for(se=0;we;){se++;let ze=we,qe=0;for(let it=0;it0||dt>0&&ze;)qe!==0&&(dt===0||!ze||we.z<=ze.z)?(ke=we,we=we.nextZ,qe--):(ke=ze,ze=ze.nextZ,dt--),Oe?Oe.nextZ=ke:J=ke,ke.prevZ=Oe,Oe=ke;we=ze}Oe.nextZ=null,pe*=2}while(se>1)}(X)}(f,g,y,j);let E=f;for(;f.prev!==f.next;){const R=f.prev,B=f.next;if(j?G$e(f,g,y,j):W$e(f))l.push(R.i,f.i,B.i),P3(f),f=B.next,E=B.next;else if((f=B)===E){N?N===1?A3(f=K$e(Iv(f),l),l,u,g,y,j,2):N===2&&Z$e(f,l,u,g,y,j):A3(Iv(f),l,u,g,y,j,1);break}}}function W$e(f){const l=f.prev,u=f,g=f.next;if(jl(l,u,g)>=0)return!1;const y=l.x,j=u.x,N=g.x,E=l.y,R=u.y,B=g.y,H=Math.min(y,j,N),G=Math.min(E,R,B),X=Math.max(y,j,N),J=Math.max(E,R,B);let se=g.next;for(;se!==l;){if(se.x>=H&&se.x<=X&&se.y>=G&&se.y<=J&&E3(y,E,j,R,N,B,se.x,se.y)&&jl(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function G$e(f,l,u,g){const y=f.prev,j=f,N=f.next;if(jl(y,j,N)>=0)return!1;const E=y.x,R=j.x,B=N.x,H=y.y,G=j.y,X=N.y,J=Math.min(E,R,B),se=Math.min(H,G,X),pe=Math.max(E,R,B),ke=Math.max(H,G,X),we=vae(J,se,l,u,g),Oe=vae(pe,ke,l,u,g);let ze=f.prevZ,qe=f.nextZ;for(;ze&&ze.z>=we&&qe&&qe.z<=Oe;){if(ze.x>=J&&ze.x<=pe&&ze.y>=se&&ze.y<=ke&&ze!==y&&ze!==N&&E3(E,H,R,G,B,X,ze.x,ze.y)&&jl(ze.prev,ze,ze.next)>=0||(ze=ze.prevZ,qe.x>=J&&qe.x<=pe&&qe.y>=se&&qe.y<=ke&&qe!==y&&qe!==N&&E3(E,H,R,G,B,X,qe.x,qe.y)&&jl(qe.prev,qe,qe.next)>=0))return!1;qe=qe.nextZ}for(;ze&&ze.z>=we;){if(ze.x>=J&&ze.x<=pe&&ze.y>=se&&ze.y<=ke&&ze!==y&&ze!==N&&E3(E,H,R,G,B,X,ze.x,ze.y)&&jl(ze.prev,ze,ze.next)>=0)return!1;ze=ze.prevZ}for(;qe&&qe.z<=Oe;){if(qe.x>=J&&qe.x<=pe&&qe.y>=se&&qe.y<=ke&&qe!==y&&qe!==N&&E3(E,H,R,G,B,X,qe.x,qe.y)&&jl(qe.prev,qe,qe.next)>=0)return!1;qe=qe.nextZ}return!0}function K$e(f,l){let u=f;do{const g=u.prev,y=u.next.next;!xN(g,y)&&q0e(g,u,u.next,y)&&I3(g,y)&&I3(y,g)&&(l.push(g.i,u.i,y.i),P3(u),P3(u.next),u=f=y),u=u.next}while(u!==f);return Iv(u)}function Z$e(f,l,u,g,y,j){let N=f;do{let E=N.next.next;for(;E!==N.prev;){if(N.i!==E.i&&eUe(N,E)){let R=V0e(N,E);return N=Iv(N,N.next),R=Iv(R,R.next),A3(N,l,u,g,y,j,0),void A3(R,l,u,g,y,j,0)}E=E.next}N=N.next}while(N!==f)}function Y$e(f,l){let u=f.x-l.x;return u===0&&(u=f.y-l.y,u===0)&&(u=(f.next.y-f.y)/(f.next.x-f.x)-(l.next.y-l.y)/(l.next.x-l.x)),u}function X$e(f,l){const u=function(y,j){let N=j;const E=y.x,R=y.y;let B,H=-1/0;if(xN(y,N))return N;do{if(xN(y,N.next))return N.next;if(R<=N.y&&R>=N.next.y&&N.next.y!==N.y){const pe=N.x+(R-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(pe<=E&&pe>H&&(H=pe,B=N.x=N.x&&N.x>=X&&E!==N.x&&U0e(RB.x||N.x===B.x&&Q$e(B,N)))&&(B=N,se=pe)}N=N.next}while(N!==G);return B}(f,l);if(!u)return l;const g=V0e(u,f);return Iv(g,g.next),Iv(u,u.next)}function Q$e(f,l){return jl(f.prev,f,l.prev)<0&&jl(l.next,f,f.next)<0}function vae(f,l,u,g,y){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-u)*y|0)|f<<8))|f<<4))|f<<2))|f<<1))|(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-g)*y|0)|l<<8))|l<<4))|l<<2))|l<<1))<<1}function J$e(f){let l=f,u=f;do(l.x=(f-N)*(j-E)&&(f-N)*(g-E)>=(u-N)*(l-E)&&(u-N)*(j-E)>=(y-N)*(g-E)}function E3(f,l,u,g,y,j,N,E){return!(f===N&&l===E)&&U0e(f,l,u,g,y,j,N,E)}function eUe(f,l){return f.next.i!==l.i&&f.prev.i!==l.i&&!function(u,g){let y=u;do{if(y.i!==u.i&&y.next.i!==u.i&&y.i!==g.i&&y.next.i!==g.i&&q0e(y,y.next,u,g))return!0;y=y.next}while(y!==u);return!1}(f,l)&&(I3(f,l)&&I3(l,f)&&function(u,g){let y=u,j=!1;const N=(u.x+g.x)/2,E=(u.y+g.y)/2;do y.y>E!=y.next.y>E&&y.next.y!==y.y&&N<(y.next.x-y.x)*(E-y.y)/(y.next.y-y.y)+y.x&&(j=!j),y=y.next;while(y!==u);return j}(f,l)&&(jl(f.prev,f,l.prev)||jl(f,l.prev,l))||xN(f,l)&&jl(f.prev,f,f.next)>0&&jl(l.prev,l,l.next)>0)}function jl(f,l,u){return(l.y-f.y)*(u.x-l.x)-(l.x-f.x)*(u.y-l.y)}function xN(f,l){return f.x===l.x&&f.y===l.y}function q0e(f,l,u,g){const y=zP(jl(f,l,u)),j=zP(jl(f,l,g)),N=zP(jl(u,g,f)),E=zP(jl(u,g,l));return y!==j&&N!==E||!(y!==0||!FP(f,u,l))||!(j!==0||!FP(f,g,l))||!(N!==0||!FP(u,f,g))||!(E!==0||!FP(u,l,g))}function FP(f,l,u){return l.x<=Math.max(f.x,u.x)&&l.x>=Math.min(f.x,u.x)&&l.y<=Math.max(f.y,u.y)&&l.y>=Math.min(f.y,u.y)}function zP(f){return f>0?1:f<0?-1:0}function I3(f,l){return jl(f.prev,f,f.next)<0?jl(f,l,f.next)>=0&&jl(f,f.prev,l)>=0:jl(f,l,f.prev)<0||jl(f,f.next,l)<0}function V0e(f,l){const u=_ae(f.i,f.x,f.y),g=_ae(l.i,l.x,l.y),y=f.next,j=l.prev;return f.next=l,l.prev=f,u.next=y,y.prev=u,g.next=u,u.prev=g,j.next=g,g.prev=j,g}function H0e(f,l,u,g){const y=_ae(f,l,u);return g?(y.next=g.next,y.prev=g,g.next.prev=y,g.next=y):(y.prev=y,y.next=y),y}function P3(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function _ae(f,l,u){return{i:f,x:l,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function L3(f,l){const u=f.length;if(u<=1)return[f];const g=[];let y,j;for(let N=0;N1)for(let N=0;N=Mr&&u>=Mr}static evaluate(l){if(l.length===0)return new Jg;let u=[];for(const R of l)u.push(...R.portals);if(u.length===0)return new Jg;for(const R of u){const B=R.va,H=R.vb;(Jg.isOnBorder(B.x,H.x)||Jg.isOnBorder(B.y,H.y))&&(R.type="border")}const g=u.filter(R=>R.type!=="unevaluated"),y=u.filter(R=>R.type==="unevaluated");if(y.length===0)return new Jg;y.sort((R,B)=>R.hash===B.hash?R.isTunnel===B.isTunnel?0:R.isTunnel?-1:1:R.hashR.hashj!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new kh(u,{zoom:g,lut:y},j=>j!=="fill-bridge-guard-rail-color")}addVertices(l,u){const g=this.unevalVertices.length;for(let y=0;y=j.min.x&&G.x<=j.max.x&&G.y>=j.min.y&&G.y<=j.max.y||X.x>=j.min.x&&X.x<=j.max.x&&X.y>=j.min.y&&X.y<=j.max.y||Xl(G,X,E))||this.isOnBorder(G.x,X.x)||this.isOnBorder(G.y,X.y))continue;const J=cu.computeEdgeHash(this.unevalVertices[B],this.unevalVertices[H]);let se,pe=this.vertexHashLookup.get(cu.computePosHash(G));pe!=null?se=pe.next:(pe=this.vertexHashLookup.get(cu.computePosHash(X)),se=pe!=null?pe.prev:J),this.unevalEdges.push({polygonIdx:l,a:B,b:H,hash:J,portalHash:se,isTunnel:y,type:"unevaluated",featureInfo:N})}}addPortalCandidates(l,u,g,y,j){if(u.length===0)return;this.portalPolygons.add(l,{geometry:u,zLevel:j});const N=u[0];this.vertexHashLookup.clear();let E=cu.computeEdgeHash(N[N.length-2],N[N.length-1]);for(let R=0;R({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},y=new rUe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(l.portals,this.unevalEdges);const j=u(),N=u(),E=u(),R=(X,J)=>{X.sort((pe,ke)=>pe.type===J&&ke.type!==J?-1:pe.type!==J&&ke.type===J?1:0);const se=X.findIndex(pe=>pe.type!==J);return se>=0?se:X.length};let B=0;this.unevalEdges.length>0&&(B=R(this.unevalEdges,"none"),this.constructBridgeStructures(y,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:B},this.tileToMeters)),g(E);const H=u(),G=u();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice(B),J=R(X,"tunnel")+B;this.unevalEdges.push(...X),this.constructTunnelStructures(y,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:B},{min:B,max:J})}g(H),y.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(G),y.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(N),y.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(j),this.maskSegments=ka.simpleSegment(0,G.primitiveOffset,0,G.primitiveLength),this.depthSegments=ka.simpleSegment(0,N.primitiveOffset,0,N.primitiveLength),this.renderableBridgeSegments=ka.simpleSegment(0,E.primitiveOffset,0,E.primitiveLength),this.renderableTunnelSegments=ka.simpleSegment(0,H.primitiveOffset,0,H.primitiveLength),this.shadowCasterSegments=ka.simpleSegment(0,j.primitiveOffset,0,j.primitiveLength)}update(l,u,g,y,j,N,E,R){this.bridgeProgramConfigurations.updatePaintArrays(l,u,j,g,y,N,E,R),this.tunnelProgramConfigurations.updatePaintArrays(l,u,j,g,y,N,E,R)}upload(l){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=l.createVertexBuffer(this.vertexPositions,V$e.members),this.vertexBufferNormal=l.createVertexBuffer(this.vertexNormals,H$e.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(l),this.tunnelProgramConfigurations.upload(l))}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(l,u,g,y,j){const N=(E,R)=>{for(let B=0;Bme(gr,u[yr].x,u[yr].y,g[yr]*R),G=je(),X=je(),J=je(),se=je(),pe=je(),ke=(gr,yr)=>{const hr=E.get(cu.computePosHash(u[yr])),fr=hr.from,Qt=hr.to;if(!fr||!Qt)return;H(G,fr),H(X,yr),H(J,Qt),nt(se),Ve(G,X)||(Me(pe,X,G),Fe(se,pe)),Ve(J,X)||(Me(pe,J,X),fe(se,se,Fe(pe,pe)));const Kt=Re(se);return Kt>0?ae(gr,se,1/Kt):void 0};let we=Number.POSITIVE_INFINITY;this.sortSubarray(y,j.min,j.max,(gr,yr)=>gr.featureInfo.featureIndex-yr.featureInfo.featureIndex);const Oe=je(),ze=je(),qe=je(),dt=je(),it=je(),pt=je(),wt=je(),St=je(),Gt=je(),Pt=[je(),je(),je(),je()],Jt=[je(),je(),je(),je()],or=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],lr=(gr,yr)=>gr>yr;for(let gr=j.min;grwe.featureInfo.featureIndex-Oe.featureInfo.featureIndex;this.sortSubarray(y,j.min,j.max,R),this.sortSubarray(y,N.min,N.max,R);const B=we=>Fe(we,we),H=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],G=(we,Oe)=>weE.hash===R.hash?R.polygonIdx-E.polygonIdx:R.hash>E.hash?1:-1);let g=0,y=0,j=0,N=u[g].polygonIdx;do y++,(y===u.length||u[g].hash!==u[y].hash)&&((y-g==1||u[y-1].polygonIdx!==N)&&(jB.portalHashH.hash?E++:H.hash>B.portalHash?R++:(B.type=H.type,E++)}}}isOnBorder(l,u){return l<=0&&u<=0||l>=Mr&&u>=Mr}addFeatureSection(l,u,g,y){return l!==u&&(u=l,g.push({featureIndex:l,vertexStart:y.getVertexCount()}),y.clearVertexLookup()),u}sortSubarray(l,u,g,y){const j=l.slice(u,g);j.sort(y),l.splice(u,j.length,...j)}static computeEdgeHash(l,u){return(l.y===u.y&&l.x>u.x||l.y>u.y)&&([l,u]=[u,l]),BigInt(cu.computePosHash(l))<<32n|BigInt(cu.computePosHash(u))}static computePosHash(l){return((65535&l.x)<<16|65535&l.y)>>>0}}var K0e,Z0e={exports:{}},Y0e=(K0e||(K0e=1,function(f){function l(at,ut){return at>ut?1:at0){var hn=xr+Math.floor(Or/2),mn={key:ut[hn],data:er[hn],parent:at};return mn.left=y(mn,ut,er,xr,hn),mn.right=y(mn,ut,er,hn+1,Lr),mn}return null}function j(at,ut,er,xr,Lr){if(!(er>=xr)){for(var Or=at[er+xr>>1],hn=er-1,mn=xr+1;;){do hn++;while(Lr(at[hn],Or)<0);do mn--;while(Lr(at[mn],Or)>0);if(hn>=mn)break;var Xn=at[hn];at[hn]=at[mn],at[mn]=Xn,Xn=ut[hn],ut[hn]=ut[mn],ut[mn]=Xn}j(at,ut,er,mn,Lr),j(at,ut,mn+1,xr,Lr)}}u.prototype.rotateLeft=function(at){var ut=at.right;ut&&(at.right=ut.left,ut.left&&(ut.left.parent=at),ut.parent=at.parent),at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.left=at),at.parent=ut},u.prototype.rotateRight=function(at){var ut=at.left;ut&&(at.left=ut.right,ut.right&&(ut.right.parent=at),ut.parent=at.parent),at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.right=at),at.parent=ut},u.prototype._splay=function(at){for(;at.parent;){var ut=at.parent;ut.parent?ut.left===at&&ut.parent.left===ut?(this.rotateRight(ut.parent),this.rotateRight(ut)):ut.right===at&&ut.parent.right===ut?(this.rotateLeft(ut.parent),this.rotateLeft(ut)):ut.left===at&&ut.parent.right===ut?(this.rotateRight(ut),this.rotateLeft(ut)):(this.rotateLeft(ut),this.rotateRight(ut)):ut.left===at?this.rotateRight(ut):this.rotateLeft(ut)}},u.prototype.splay=function(at){for(var ut,er,xr,Lr,Or;at.parent;)(er=(ut=at.parent).parent)&&er.parent?((xr=er.parent).left===er?xr.left=at:xr.right=at,at.parent=xr):(at.parent=null,this._root=at),Lr=at.left,Or=at.right,at===ut.left?(er&&(er.left===ut?(ut.right?(er.left=ut.right,er.left.parent=er):er.left=null,ut.right=er,er.parent=ut):(Lr?(er.right=Lr,Lr.parent=er):er.right=null,at.left=er,er.parent=at)),Or?(ut.left=Or,Or.parent=ut):ut.left=null,at.right=ut,ut.parent=at):(er&&(er.right===ut?(ut.left?(er.right=ut.left,er.right.parent=er):er.right=null,ut.left=er,er.parent=ut):(Or?(er.left=Or,Or.parent=er):er.left=null,at.right=er,er.parent=at)),Lr?(ut.right=Lr,Lr.parent=ut):ut.right=null,at.left=ut,ut.parent=at)},u.prototype.replace=function(at,ut){at.parent?at===at.parent.left?at.parent.left=ut:at.parent.right=ut:this._root=ut,ut&&(ut.parent=at.parent)},u.prototype.minNode=function(at){if(at===void 0&&(at=this._root),at)for(;at.left;)at=at.left;return at},u.prototype.maxNode=function(at){if(at===void 0&&(at=this._root),at)for(;at.right;)at=at.right;return at},u.prototype.insert=function(at,ut){var er=this._root,xr=null,Lr=this._compare;if(this._noDuplicates)for(;er;){if(xr=er,Lr(er.key,at)===0)return;er=Lr(er.key,at)<0?er.right:er.left}else for(;er;)xr=er,er=Lr(er.key,at)<0?er.right:er.left;return er={key:at,data:ut,left:null,right:null,parent:xr},xr?Lr(xr.key,er.key)<0?xr.right=er:xr.left=er:this._root=er,this.splay(er),this._size++,er},u.prototype.find=function(at){for(var ut=this._root,er=this._compare;ut;){var xr=er(ut.key,at);if(xr<0)ut=ut.right;else{if(!(xr>0))return ut;ut=ut.left}}return null},u.prototype.contains=function(at){for(var ut=this._root,er=this._compare;ut;){var xr=er(at,ut.key);if(xr===0)return!0;ut=xr<0?ut.left:ut.right}return!1},u.prototype.remove=function(at){var ut=this.find(at);if(!ut)return!1;if(this.splay(ut),ut.left)if(ut.right){var er=this.minNode(ut.right);er.parent!==ut&&(this.replace(er,er.right),er.right=ut.right,er.right.parent=er),this.replace(ut,er),er.left=ut.left,er.left.parent=er}else this.replace(ut,ut.left);else this.replace(ut,ut.right);return this._size--,!0},u.prototype.removeNode=function(at){if(!at)return!1;if(this.splay(at),at.left)if(at.right){var ut=this.minNode(at.right);ut.parent!==at&&(this.replace(ut,ut.right),ut.right=at.right,ut.right.parent=ut),this.replace(at,ut),ut.left=at.left,ut.left.parent=ut}else this.replace(at,at.left);else this.replace(at,at.right);return this._size--,!0},u.prototype.erase=function(at){var ut=this.find(at);if(ut){this.splay(ut);var er=ut.left,xr=ut.right,Lr=null;er&&(er.parent=null,Lr=this.maxNode(er),this.splay(Lr),this._root=Lr),xr&&(er?Lr.right=xr:this._root=xr,xr.parent=Lr),this._size--}},u.prototype.pop=function(){var at=this._root,ut=null;if(at){for(;at.left;)at=at.left;ut={key:at.key,data:at.data},this.remove(at.key)}return ut},u.prototype.next=function(at){var ut=at;if(ut)if(ut.right)for(ut=ut.right;ut&&ut.left;)ut=ut.left;else for(ut=at.parent;ut&&ut.right===at;)at=ut,ut=ut.parent;return ut},u.prototype.prev=function(at){var ut=at;if(ut)if(ut.left)for(ut=ut.left;ut&&ut.right;)ut=ut.right;else for(ut=at.parent;ut&&ut.left===at;)at=ut,ut=ut.parent;return ut},u.prototype.forEach=function(at){for(var ut=this._root,er=[],xr=!1,Lr=0;!xr;)ut?(er.push(ut),ut=ut.left):er.length>0?(at(ut=er.pop(),Lr++),ut=ut.right):xr=!0;return this},u.prototype.range=function(at,ut,er,xr){for(var Lr=[],Or=this._compare,hn=this._root;Lr.length!==0||hn;)if(hn)Lr.push(hn),hn=hn.left;else{if(Or((hn=Lr.pop()).key,ut)>0)break;if(Or(hn.key,at)>=0&&er.call(xr,hn))return this;hn=hn.right}return this},u.prototype.keys=function(){for(var at=this._root,ut=[],er=[],xr=!1;!xr;)at?(ut.push(at),at=at.left):ut.length>0?(at=ut.pop(),er.push(at.key),at=at.right):xr=!0;return er},u.prototype.values=function(){for(var at=this._root,ut=[],er=[],xr=!1;!xr;)at?(ut.push(at),at=at.left):ut.length>0?(at=ut.pop(),er.push(at.data),at=at.right):xr=!0;return er},u.prototype.at=function(at){for(var ut=this._root,er=[],xr=!1,Lr=0;!xr;)if(ut)er.push(ut),ut=ut.left;else if(er.length>0){if(ut=er.pop(),Lr===at)return ut;Lr++,ut=ut.right}else xr=!0;return null},u.prototype.load=function(at,ut,er){if(at===void 0&&(at=[]),ut===void 0&&(ut=[]),er===void 0&&(er=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var xr=at.length;return er&&j(at,ut,0,xr-1,this._compare),this._root=y(null,at,ut,0,xr),this._size=xr,this},u.prototype.min=function(){var at=this.minNode(this._root);return at?at.key:null},u.prototype.max=function(){var at=this.maxNode(this._root);return at?at.key:null},u.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},u.createTree=function(at,ut,er,xr,Lr){return new u(er,Lr).load(at,ut,xr)},Object.defineProperties(u.prototype,g);var N=0,E=1,R=2,B=3,H=0,G=1,X=2,J=3;function se(at,ut,er){ut===null?(at.inOut=!1,at.otherInOut=!0):(at.isSubject===ut.isSubject?(at.inOut=!ut.inOut,at.otherInOut=ut.otherInOut):(at.inOut=!ut.otherInOut,at.otherInOut=ut.isVertical()?!ut.inOut:ut.inOut),ut&&(at.prevInResult=!pe(ut,er)||ut.isVertical()?ut.prevInResult:ut));var xr=pe(at,er);at.resultTransition=xr?function(Lr,Or){var hn,mn=!Lr.inOut,Xn=!Lr.otherInOut;switch(Or){case H:hn=mn&&Xn;break;case G:hn=mn||Xn;break;case J:hn=mn^Xn;break;case X:hn=Lr.isSubject?mn&&!Xn:Xn&&!mn}return hn?1:-1}(at,er):0}function pe(at,ut){switch(at.type){case N:switch(ut){case H:return!at.otherInOut;case G:return at.otherInOut;case X:return at.isSubject&&at.otherInOut||!at.isSubject&&!at.otherInOut;case J:return!0}break;case R:return ut===H||ut===G;case B:return ut===X;case E:return!1}return!1}var ke=function(at,ut,er,xr,Lr){this.left=ut,this.point=at,this.otherEvent=er,this.isSubject=xr,this.type=Lr||N,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},we={inResult:{configurable:!0}};function Oe(at,ut){return at[0]===ut[0]&&at[1]===ut[1]}ke.prototype.isBelow=function(at){var ut=this.point,er=this.otherEvent.point;return this.left?(ut[0]-at[0])*(er[1]-at[1])-(er[0]-at[0])*(ut[1]-at[1])>0:(er[0]-at[0])*(ut[1]-at[1])-(ut[0]-at[0])*(er[1]-at[1])>0},ke.prototype.isAbove=function(at){return!this.isBelow(at)},ke.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},we.inResult.get=function(){return this.resultTransition!==0},ke.prototype.clone=function(){var at=new ke(this.point,this.left,this.otherEvent,this.isSubject,this.type);return at.contourId=this.contourId,at.resultTransition=this.resultTransition,at.prevInResult=this.prevInResult,at.isExteriorRing=this.isExteriorRing,at.inOut=this.inOut,at.otherInOut=this.otherInOut,at},Object.defineProperties(ke.prototype,we);var ze=11102230246251565e-32,qe=134217729,dt=(3+8*ze)*ze;function it(at,ut,er,xr,Lr){var Or,hn,mn,Xn,as=ut[0],ps=xr[0],Cs=0,Pn=0;ps>as==ps>-as?(Or=as,as=ut[++Cs]):(Or=ps,ps=xr[++Pn]);var Bn=0;if(Csas==ps>-as?(mn=Or-((hn=as+Or)-as),as=ut[++Cs]):(mn=Or-((hn=ps+Or)-ps),ps=xr[++Pn]),Or=hn,mn!==0&&(Lr[Bn++]=mn);Csas==ps>-as?(mn=Or-((hn=Or+as)-(Xn=hn-Or))+(as-Xn),as=ut[++Cs]):(mn=Or-((hn=Or+ps)-(Xn=hn-Or))+(ps-Xn),ps=xr[++Pn]),Or=hn,mn!==0&&(Lr[Bn++]=mn);for(;Cs0!=Cs>0)return Pn;var Bn=Math.abs(ps+Cs);return Math.abs(Pn)>=wt*Bn?Pn:-function(Qs,ni,si,bi,qi,Li,di){var gi,ls,Rs,ba,An,Ms,zi,Zi,ea,no,Xi,En,Ca,wi,ma,Bo,hl,No,So=Qs-qi,rl=si-qi,_d=ni-Li,Qi=bi-Li;Pt[0]=(ma=(Zi=So-(zi=(Ms=qe*So)-(Ms-So)))*(no=Qi-(ea=(Ms=qe*Qi)-(Ms-Qi)))-((wi=So*Qi)-zi*ea-Zi*ea-zi*no))-((Xi=ma-(hl=(Zi=_d-(zi=(Ms=qe*_d)-(Ms-_d)))*(no=rl-(ea=(Ms=qe*rl)-(Ms-rl)))-((Bo=_d*rl)-zi*ea-Zi*ea-zi*no)))+(An=ma-Xi))+(An-hl),Pt[1]=(Ca=wi-((En=wi+Xi)-(An=En-wi))+(Xi-An))-((Xi=Ca-Bo)+(An=Ca-Xi))+(An-Bo),Pt[2]=En-((No=En+Xi)-(An=No-En))+(Xi-An),Pt[3]=No;var Xa=function(Um,Ql){for(var Xc=Ql[0],uu=1;uu<4;uu++)Xc+=Ql[uu];return Xc}(0,Pt),so=St*di;if(Xa>=so||-Xa>=so||(gi=Qs-(So+(An=Qs-So))+(An-qi),Rs=si-(rl+(An=si-rl))+(An-qi),ls=ni-(_d+(An=ni-_d))+(An-Li),ba=bi-(Qi+(An=bi-Qi))+(An-Li),gi===0&&ls===0&&Rs===0&&ba===0)||(so=Gt*di+dt*Math.abs(Xa),(Xa+=So*ba+Qi*gi-(_d*Rs+rl*ls))>=so||-Xa>=so))return Xa;gr[0]=(ma=(Zi=gi-(zi=(Ms=qe*gi)-(Ms-gi)))*(no=Qi-(ea=(Ms=qe*Qi)-(Ms-Qi)))-((wi=gi*Qi)-zi*ea-Zi*ea-zi*no))-((Xi=ma-(hl=(Zi=ls-(zi=(Ms=qe*ls)-(Ms-ls)))*(no=rl-(ea=(Ms=qe*rl)-(Ms-rl)))-((Bo=ls*rl)-zi*ea-Zi*ea-zi*no)))+(An=ma-Xi))+(An-hl),gr[1]=(Ca=wi-((En=wi+Xi)-(An=En-wi))+(Xi-An))-((Xi=Ca-Bo)+(An=Ca-Xi))+(An-Bo),gr[2]=En-((No=En+Xi)-(An=No-En))+(Xi-An),gr[3]=No;var Fd=it(4,Pt,4,gr,Jt);gr[0]=(ma=(Zi=So-(zi=(Ms=qe*So)-(Ms-So)))*(no=ba-(ea=(Ms=qe*ba)-(Ms-ba)))-((wi=So*ba)-zi*ea-Zi*ea-zi*no))-((Xi=ma-(hl=(Zi=_d-(zi=(Ms=qe*_d)-(Ms-_d)))*(no=Rs-(ea=(Ms=qe*Rs)-(Ms-Rs)))-((Bo=_d*Rs)-zi*ea-Zi*ea-zi*no)))+(An=ma-Xi))+(An-hl),gr[1]=(Ca=wi-((En=wi+Xi)-(An=En-wi))+(Xi-An))-((Xi=Ca-Bo)+(An=Ca-Xi))+(An-Bo),gr[2]=En-((No=En+Xi)-(An=No-En))+(Xi-An),gr[3]=No;var $o=it(Fd,Jt,4,gr,or);gr[0]=(ma=(Zi=gi-(zi=(Ms=qe*gi)-(Ms-gi)))*(no=ba-(ea=(Ms=qe*ba)-(Ms-ba)))-((wi=gi*ba)-zi*ea-Zi*ea-zi*no))-((Xi=ma-(hl=(Zi=ls-(zi=(Ms=qe*ls)-(Ms-ls)))*(no=Rs-(ea=(Ms=qe*Rs)-(Ms-Rs)))-((Bo=ls*Rs)-zi*ea-Zi*ea-zi*no)))+(An=ma-Xi))+(An-hl),gr[1]=(Ca=wi-((En=wi+Xi)-(An=En-wi))+(Xi-An))-((Xi=Ca-Bo)+(An=Ca-Xi))+(An-Bo),gr[2]=En-((No=En+Xi)-(An=No-En))+(Xi-An),gr[3]=No;var yf=it($o,or,4,gr,lr);return lr[yf-1]}(Lr,Or,hn,mn,Xn,as,Bn)}(at[0],at[1],ut[0],ut[1],er[0],er[1]);return xr>0?-1:xr<0?1:0}function hr(at,ut){var er=at.point,xr=ut.point;return er[0]>xr[0]?1:er[0]xr[1]?1:-1:function(Lr,Or,hn,mn){return Lr.left!==Or.left?Lr.left?1:-1:yr(hn,Lr.otherEvent.point,Or.otherEvent.point)!==0?Lr.isBelow(Or.otherEvent.point)?-1:1:!Lr.isSubject&&Or.isSubject?1:-1}(at,ut,er)}function fr(at,ut,er){var xr=new ke(ut,!1,at,at.isSubject),Lr=new ke(ut,!0,at.otherEvent,at.isSubject);return Oe(at.point,at.otherEvent.point)&&console.warn("what is that, a collapsed segment?",at),xr.contourId=Lr.contourId=at.contourId,hr(Lr,at.otherEvent)>0&&(at.otherEvent.left=!0,Lr.left=!1),at.otherEvent.otherEvent=Lr,at.otherEvent=xr,er.push(Lr),er.push(xr),er}function Qt(at,ut){return at[0]*ut[1]-at[1]*ut[0]}function Kt(at,ut){return at[0]*ut[0]+at[1]*ut[1]}function pr(at,ut,er){var xr=function(Xn,as,ps,Cs,Pn){var Bn=[as[0]-Xn[0],as[1]-Xn[1]],Qs=[Cs[0]-ps[0],Cs[1]-ps[1]];function ni(Ms,zi,Zi){return[Ms[0]+zi*Zi[0],Ms[1]+zi*Zi[1]]}var si=[ps[0]-Xn[0],ps[1]-Xn[1]],bi=Qt(Bn,Qs),qi=bi*bi,Li=Kt(Bn,Bn);if(qi>0){var di=Qt(si,Qs)/bi;if(di<0||di>1)return null;var gi=Qt(si,Bn)/bi;return gi<0||gi>1?null:di===0||di===1?[ni(Xn,di,Bn)]:gi===0||gi===1?[ni(ps,gi,Qs)]:[ni(Xn,di,Bn)]}if((qi=(bi=Qt(si,Bn))*bi)>0)return null;var ls=Kt(Bn,si)/Li,Rs=ls+Kt(Bn,Qs)/Li,ba=Math.min(ls,Rs),An=Math.max(ls,Rs);return ba<=1&&An>=0?ba===1?[ni(Xn,ba>0?ba:0,Bn)]:An===0?[ni(Xn,An<1?An:1,Bn)]:[ni(Xn,ba>0?ba:0,Bn),ni(Xn,An<1?An:1,Bn)]:null}(at.point,at.otherEvent.point,ut.point,ut.otherEvent.point),Lr=xr?xr.length:0;if(Lr===0||Lr===1&&(Oe(at.point,ut.point)||Oe(at.otherEvent.point,ut.otherEvent.point))||Lr===2&&at.isSubject===ut.isSubject)return 0;if(Lr===1)return Oe(at.point,xr[0])||Oe(at.otherEvent.point,xr[0])||fr(at,xr[0],er),Oe(ut.point,xr[0])||Oe(ut.otherEvent.point,xr[0])||fr(ut,xr[0],er),1;var Or=[],hn=!1,mn=!1;return Oe(at.point,ut.point)?hn=!0:hr(at,ut)===1?Or.push(ut,at):Or.push(at,ut),Oe(at.otherEvent.point,ut.otherEvent.point)?mn=!0:hr(at.otherEvent,ut.otherEvent)===1?Or.push(ut.otherEvent,at.otherEvent):Or.push(at.otherEvent,ut.otherEvent),hn&&mn||hn?(ut.type=E,at.type=ut.inOut===at.inOut?R:B,hn&&!mn&&fr(Or[1].otherEvent,Or[0].point,er),2):mn?(fr(Or[0],Or[1].point,er),3):Or[0]!==Or[3].otherEvent?(fr(Or[0],Or[1].point,er),fr(Or[1],Or[2].point,er),3):(fr(Or[0],Or[1].point,er),fr(Or[3].otherEvent,Or[2].point,er),3)}function Tr(at,ut){if(at===ut)return 0;if(yr(at.point,at.otherEvent.point,ut.point)!==0||yr(at.point,at.otherEvent.point,ut.otherEvent.point)!==0)return Oe(at.point,ut.point)?at.isBelow(ut.otherEvent.point)?-1:1:at.point[0]===ut.point[0]?at.point[1]ut.contourId?1:-1:hr(at,ut)===1?1:-1}var jr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function dn(at,ut,er,xr){var Lr,Or=at+1,hn=ut[at].point,mn=ut.length;for(Orxr;)Or--;return Or}jr.prototype.isExterior=function(){return this.holeOf==null};var Fr=tn,Hr=tn;function tn(at,ut){if(!(this instanceof tn))return new tn(at,ut);if(this.data=at||[],this.length=this.data.length,this.compare=ut||ms,this.length>0)for(var er=(this.length>>1)-1;er>=0;er--)this._down(er)}function ms(at,ut){return atut?1:0}tn.prototype={push:function(at){this.data.push(at),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var at=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),at}},peek:function(){return this.data[0]},_up:function(at){for(var ut=this.data,er=this.compare,xr=ut[at];at>0;){var Lr=at-1>>1,Or=ut[Lr];if(er(xr,Or)>=0)break;ut[at]=Or,at=Lr}ut[at]=xr},_down:function(at){for(var ut=this.data,er=this.compare,xr=this.length>>1,Lr=ut[at];at=0)break;ut[at]=mn,at=Or}ut[at]=Lr}},Fr.default=Hr;var kr=Math.max,rn=Math.min,$n=0;function Ps(at,ut,er,xr,Lr,Or){var hn,mn,Xn,as,ps,Cs;for(hn=0,mn=at.length-1;hn0?Cs.left=!0:ps.left=!0;var Pn=Xn[0],Bn=Xn[1];Lr[0]=rn(Lr[0],Pn),Lr[1]=rn(Lr[1],Bn),Lr[2]=kr(Lr[2],Pn),Lr[3]=kr(Lr[3],Bn),xr.push(ps),xr.push(Cs)}}var zs=[];function Jn(at,ut,er){typeof at[0][0][0]=="number"&&(at=[at]),typeof ut[0][0][0]=="number"&&(ut=[ut]);var xr=function(Bn,Qs,ni){var si=null;return Bn.length*Qs.length==0&&(ni===H?si=zs:ni===X?si=Bn:ni!==G&&ni!==J||(si=Bn.length===0?Qs:Bn)),si}(at,ut,er);if(xr)return xr===zs?null:xr;var Lr=[1/0,1/0,-1/0,-1/0],Or=[1/0,1/0,-1/0,-1/0],hn=function(Bn,Qs,ni,si,bi){var qi,Li,di,gi,ls,Rs,ba=new Fr(null,hr);for(di=0,gi=Bn.length;disi[2]||si[0]>ni[2]||ni[1]>si[3]||si[1]>ni[3])&&(bi===H?qi=zs:bi===X?qi=Bn:bi!==G&&bi!==J||(qi=Bn.concat(Qs))),qi}(at,ut,Lr,Or,er))return xr===zs?null:xr;for(var mn=function(Bn){var Qs,ni,si=function(di){var gi,ls,Rs,ba,An=[];for(ls=0,Rs=di.length;ls0){var Xi=Ms[no];if(Xi.holeOf!=null){var En=Xi.holeOf;Ms[En].holeIds.push(zi),Zi.holeOf=En,Zi.depth=Ms[no].depth}else Ms[no].holeIds.push(zi),Zi.holeOf=no,Zi.depth=Ms[no].depth+1}else Zi.holeOf=null,Zi.depth=Ms[no].depth}else Zi.holeOf=null,Zi.depth=0;return Zi}(si[Qs],qi,di),ls=function(An){bi[An]=!0,An=si.length)&&si[Rs];);qi.push(gi)}};for(Qs=0,ni=si.length;Qsba||qi===X&&An.point[0]>si[2])break;if(An.left){di=Li=ls.insert(An),Li=Li!==(gi=ls.minNode())?ls.prev(Li):null,di=ls.next(di);var Ms=Li?Li.key:null;if(se(An,Ms,qi),di&&pr(An,di.key,Bn)===2&&(se(An,Ms,qi),se(di.key,An,qi)),Li&&pr(Li.key,An,Bn)===2){var zi=Li;se(Ms,(zi=zi!==gi?ls.prev(zi):null)?zi.key:null,qi),se(An,Ms,qi)}}else di=Li=ls.find(An=An.otherEvent),Li&&di&&(Li=Li!==gi?ls.prev(Li):null,di=ls.next(di),ls.remove(An),di&&Li&&pr(Li.key,di.key,Bn))}return Rs}(hn,0,0,Lr,Or,er)),Xn=[],as=0;as * @license MIT * @preserve */function BP(f,l,u,g){const y=[],j=g===0?(N,E,R,B,H,G)=>{N.push(new ir(G,R+(G-E)/(B-E)*(H-R)))}:(N,E,R,B,H,G)=>{N.push(new ir(E+(G-R)/(H-R)*(B-E),G))};for(const N of f){const E=[];for(const R of N){if(R.length<=2)continue;const B=[];for(let X=0;Xl&&j(B,J,se,pe,ke,l):we>u?Oe=l&&j(B,J,se,pe,ke,l),Oe>u&&we<=u&&j(B,J,se,pe,ke,u)}let H=R[R.length-1];const G=g===0?H.x:H.y;G>=l&&G<=u&&B.push(H),B.length&&(H=B[B.length-1],B[0].x===H.x&&B[0].y===H.y||B.push(B[0]),E.push(B))}E.length&&y.push(E)}return y}function nUe(f,l){const u=jae(f),g=jae([l]),y=Y0e.intersection(u,g);return y==null?[]:X0e(y)}function sUe(f,l){let g=jae(f,65536);const y=[];for(;l.valid();l.next()){const[j,N]=l.get(),E=j.x*65536,R=j.y*65536,B=N.x*65536,H=N.y*65536,G=B-E,X=H-R,J=Math.hypot(G,X);if(J===0)continue;const se=Math.trunc(X/J*3),pe=-Math.trunc(G/J*3);y.push([[[E,R],[B,H],[B+se,H+pe],[E+se,R+pe],[E,R]]])}return y.length>0&&(g=Y0e.diff(g,y)),X0e(g,1/65536)}function jae(f,l=1){return[f.map(u=>u.map(g=>[g.x*l,g.y*l]))]}function X0e(f,l=1){return f.map(u=>u.map((g,y)=>{const j=g.map(N=>new ir(N[0]*l,N[1]*l).round());return y>0&&j.reverse(),j}))}class kae{constructor(l,u){this.layoutVertexArray=new Om,this.indexArray=new Ro,this.lineIndexArray=new ou,this.triangleSegments=new ka,this.lineSegments=new ka,this.programConfigurations=new kh(l.layers,{zoom:l.zoom,lut:l.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new xp)}update(l,u,g,y,j,N,E,R){this.programConfigurations.updatePaintArrays(l,u,j,g,y,N,E,R)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,U$e.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.lineIndexBuffer=l.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=l.createVertexBuffer(this.elevatedLayoutVertexArray,q$e.members))),this.programConfigurations.upload(l),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(l,u,g,y,j,N,E){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,u,g,y,j,N,void 0,E)}}class Nae{constructor(l){this.zoom=l.zoom,this.pixelRatio=l.pixelRatio,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=l.lut,this.bufferData=new kae(l,!1),this.elevationBufferData=new kae(l,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=l.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=l.sourceLayerIndex,this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,y){}populate(l,u,g,y){this.hasPattern=bae("fill",this.layers,this.pixelRatio,u);const j=this.layers[0].layout.get("fill-sort-key"),N=[];for(const{feature:E,id:R,index:B,sourceLayerIndex:H}of l){const G=this.layers[0]._featureFilter.needGeometry,X=It(E,G);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),X,g))continue;const J=j?j.evaluate(X,{},g,u.availableImages):void 0,se={id:R,properties:E.properties,type:E.type,sourceLayerIndex:H,index:B,geometry:G?X.geometry:_t(E,g,y),patterns:{},sortKey:J};N.push(se)}j&&N.sort((E,R)=>E.sortKey-R.sortKey);for(const E of N){const{geometry:R,index:B,sourceLayerIndex:H}=E;if(this.hasPattern){const G=wae("fill",this.layers,E,this.zoom,this.pixelRatio,u);this.patternFeatures.push(G)}else this.addFeature(E,R,B,g,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(l[B].feature,R,B,H,this.index)}}update(l,u,g,y,j,N,E){this.bufferData.update(l,u,g,y,j,N,E,this.worldview),this.elevationBufferData.update(l,u,g,y,j,N,E,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(l,u,g,y,j,N,E,this.worldview)}addFeatures(l,u,g,y,j,N){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,u,g,y,N,l.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(l){this.bufferData.upload(l),this.elevationBufferData.upload(l),this.elevatedStructures&&this.elevatedStructures.upload(l)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(l,u,g,y,j,N=[],E,R){const B=L3(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(l,B,y,g,R):this.addGeometry(B,this.bufferData),this.bufferData.populatePaintArrays(l,g,j,N,y,E,this.worldview),this.elevationBufferData.populatePaintArrays(l,g,j,N,y,E,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(l,u,g,y,j){this.elevatedStructures&&(this.elevatedStructures.construct(l),this.elevatedStructures.populatePaintArrays(u,g,y,j,this.worldview))}addElevatedRoadFeature(l,u,g,y,j){const N=new Array,E=pi.getElevationFeature(l,j);if(!E)return void this.addGeometry(u,this.bufferData);{const B=this.clipPolygonsToTile(u,1);B.length>0&&N.push({polygons:B,elevationFeature:E,elevationTileID:g})}const R={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(l,{},g),featureIndex:y};for(const B of N)if(B.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new cu(B.elevationTileID,this.layers,this.zoom,this.lut));const G=B.elevationFeature.isTunnel();let X=0;l.properties.hasOwnProperty(qt)&&(X=+l.properties[qt]);for(const J of B.polygons)this.elevatedStructures.addPortalCandidates(B.elevationFeature.id,J,G,B.elevationFeature,X)}B.elevationFeature.constantHeight==null&&(B.polygons=this.prepareElevatedPolygons(B.polygons,B.elevationFeature,B.elevationTileID));const H=new Ai(g,B.elevationTileID);this.addElevatedGeometry(B.polygons,H,B.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,y,R)}}addElevatedGeometry(l,u,g,y,j,N){const E={elevation:g,elevationSampler:u,bias:y,index:j,featureInfo:N},[R,B]=this.addGeometry(l,this.elevationBufferData,E);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:R,max:B}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,R),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,B))}addGeometry(l,u,g){let y=Number.POSITIVE_INFINITY,j=Number.NEGATIVE_INFINITY,N=null;g&&(N=g.elevationSampler.constantElevation(g.elevation,g.bias),N!=null&&(y=N,j=N));const E=(R,B,H)=>{if(g!=null)if(B.push(R),N!=null)u.elevatedLayoutVertexArray.emplaceBack(N),H.push(N);else{const G=g.elevationSampler.pointElevation(R,g.elevation,g.bias);u.elevatedLayoutVertexArray.emplaceBack(G),H.push(G),y=Math.min(y,G),j=Math.max(j,G)}};for(const R of l){let B=0;for(const ze of R)B+=ze.length;const H=u.triangleSegments.prepareSegment(B,u.layoutVertexArray,u.indexArray),G=H.vertexLength,X=[],J=[],se=[],pe=[],ke=[],we=u.layoutVertexArray.length;for(const ze of R){if(ze.length===0)continue;ze!==R[0]&&J.push(X.length/2);const qe=u.lineSegments.prepareSegment(ze.length,u.layoutVertexArray,u.lineIndexArray),dt=qe.vertexLength;g&&ke.push(u.layoutVertexArray.length-we),E(ze[0],se,pe),u.layoutVertexArray.emplaceBack(ze[0].x,ze[0].y),u.lineIndexArray.emplaceBack(dt+ze.length-1,dt),X.push(ze[0].x),X.push(ze[0].y);for(let it=1;it0&&g&&this.elevationMode==="hd-road-base"){const ze=g.elevation.isTunnel(),qe=g.elevation.safeArea,dt=this.elevatedStructures.addVertices(se,pe);this.elevatedStructures.addTriangles(Oe,dt,ze);const it=ke.length;if(it>0){for(let pt=0;pt=g&&J.max.x<=j&&J.min.y>=y&&J.max.y<=N?R:B).push(X)}if(R.length===l.length)return l;const H=[new ir(g,y),new ir(j,y),new ir(j,N),new ir(g,N),new ir(g,y)],G=R;for(const X of B)G.push(...nUe(X,H));return G}}let Q0e,J0e,e1e,t1e;Xr(Nae,"FillBucket",{omit:["layers","patternFeatures"]}),Xr(kae,"FillBufferData"),Xr(cu,"ElevatedStructures");class $P{constructor(l,u,g,y){if(this.triangleCount=u.length/3,this.min=new ir(0,0),this.max=new ir(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||l.length===0)return;const[j,N]=[l[0].clone(),l[0].clone()];for(let G=1;GG.cellIdx-X.cellIdx||G.triIdx-X.triIdx);let H=0;for(;Hthis.max.x||this.min.x>l.x||l.y>this.max.y||this.min.y>l.y)return;const g=Bm(l.x-this.min.x,this.xScale,this.cellsX),y=Bm(l.y-this.min.y,this.yScale,this.cellsY),j=this.cells[y*this.cellsX+g];if(j){this._lazyInitLookup();for(let N=0;Nthis.max.x||this.min.x>u.x||l.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();const y=Bm(l.x-this.min.x,this.xScale,this.cellsX),j=Bm(u.x-this.min.x,this.xScale,this.cellsX),N=Bm(l.y-this.min.y,this.yScale,this.cellsY),E=Bm(u.y-this.min.y,this.yScale,this.cellsY);for(let R=N;R<=E;R++)for(let B=y;B<=j;B++){const H=this.cells[R*this.cellsX+B];if(H)for(let G=0;Gu.fqid),this.index=l.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){for(const g of this.footprints)u.push({footprint:g,id:l})}updateAppearances(l,u,g,y){}populate(l,u,g,y){const j=[];for(const{feature:N,id:E,index:R,sourceLayerIndex:B}of l){const H=this.layers[0]._featureFilter.needGeometry,G=It(N,H);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:E,properties:N.properties,type:N.type,sourceLayerIndex:B,index:R,geometry:H?G.geometry:_t(N,g,y),patterns:{}};j.push(X)}for(const N of j){const{geometry:E,index:R,sourceLayerIndex:B}=N;this.addFeature(N,E,R,g,{},u.availableImages,u.brightness),u.featureIndex.insert(l[R].feature,E,R,B,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(l){}update(l,u,g,y,j,N,E){}destroy(){}addFeature(l,u,g,y,j,N=[],E){for(const R of L3(u,2)){const B=[],H=[],G=[],X=new ir(1/0,1/0),J=new ir(-1/0,-1/0);for(const ke of R)if(ke.length!==0){ke!==R[0]&&G.push(H.length/2);for(let we=0;weN===y)===void 0}(g,f.clipScope)}function UP(f,l){return f.x-l.x||f.y-l.y}function i1e(f,l){return UP(f.min,l.min)===0&&UP(f.max,l.max)===0}function Sae(f,l){return!(f.min.x>l.max.x||f.max.xl.max.y||f.max.ynew ir((R.x+j.x*Mr)*E-N.x*Mr,(R.y+j.y*Mr)*E-N.y*Mr))}return Cae(u,y,f.indices,0,f.indices.length,0,0)}function l1e(f,l,u,g){const y=Math.pow(2,g.z-u.z);return new ir((f+u.x*Mr)*y-g.x*Mr,(l+u.y*Mr)*y-g.y*Mr)}function c1e(f,l){const u=[];l.grid.queryPoint(f,u);const g=l.indices,y=l.vertices;for(let j=0;j0&&(g.length>1&&u.push(g),g=[])}return g.length>1&&u.push(g),u}const Tae=Tt.types,pUe=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],mUe=["fill-extrusion-flood-light-ground-radius"],gUe=Math.pow(2,13),xUe=Math.pow(2,15)-1,u1e=new ir(0,1),ex=2147483648,h1e=7,f1e=450;function D3(f,l,u,g,y,j,N,E){f.emplaceBack((l<<1)+N,(u<<1)+j,(Math.floor(g*gUe)<<1)+y,Math.round(E))}function R3(f,l,u){f.emplaceBack(l.x*Mr,l.y*Mr,u?1:0)}function VP(f,l,u,g,y,j){f.emplaceBack(l.x,l.y,(u.x<<1)+g,(u.y<<1)+y,j)}function F3(f,l,u){f.emplaceBack(l.x,l.y,l.z,u[0]*16384,u[1]*16384,u[2]*16384)}class p1e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class m1e{constructor(){this.centroidXY=new ir(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new ir(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ir(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new ir(this.max.x-this.min.x,this.max.y-this.min.y)}}class g1e{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(l,u){l.min.x===Number.MAX_VALUE&&(l.min.x=l.max.x=u.x,l.min.y=l.max.y=u.y)}appendEdge(l,u,g){this.accCount++,this.acc._add(u);let y=!!this.borders;u.xl.max.x&&(l.max.x=u.x,y=!0),u.yl.max.y&&(l.max.y=u.y,y=!0),((u.x===0||u.x===Mr)&&u.x===g.x)!=((u.y===0||u.y===Mr)&&u.y===g.y)&&this.processBorderOverlap(u,g),y&&this.checkBorderIntersection(u,g)}checkBorderIntersection(l,u){u.x<0!=l.x<0&&this.addBorderIntersection(0,Rn(u.y,l.y,(0-u.x)/(l.x-u.x))),u.x>Mr!=l.x>Mr&&this.addBorderIntersection(1,Rn(u.y,l.y,(Mr-u.x)/(l.x-u.x))),u.y<0!=l.y<0&&this.addBorderIntersection(2,Rn(u.x,l.x,(0-u.y)/(l.y-u.y))),u.y>Mr!=l.y>Mr&&this.addBorderIntersection(3,Rn(u.x,l.x,(Mr-u.y)/(l.y-u.y)))}addBorderIntersection(l,u){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const g=this.borders[l];ug[1]&&(g[1]=u)}processBorderOverlap(l,u){if(l.x===u.x){if(l.y===u.y)return;const g=l.x===0?0:1;this.addBorderIntersection(g,u.y),this.addBorderIntersection(g,l.y)}else{const g=l.y===0?2:3;this.addBorderIntersection(g,u.x),this.addBorderIntersection(g,l.x)}}centroid(){return this.accCount===0?new ir(0,0):new ir(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((l,u)=>l+ +(u[0]!==Number.MAX_VALUE),0):0}}function x1e(f,l){const u=f.add(l)._unit(),g=_e(f.x*u.x+f.y*u.y,-1,1);var y,j,N;return y=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(y)))/4*xUe*((j=f).x*(N=l).y-j.y*N.x<0?-1:1)}const yUe=[f=>f.x<0,f=>f.x>Mr,f=>f.y<0,f=>f.y>Mr];function vUe(f,l,u,g){const y=[4];if(g===0)return y;u._mult(g);const j=f.sub(u),N=l.sub(u),E=[f,l,j,N];for(let R=0;R<4;R++)for(const B of E)if(yUe[R](B)){y.push(R);break}return y}class Aae{constructor(l){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new d3,this.indexArray=new Ro,this.programConfigurations=new kh(l.layers,{zoom:l.zoom,lut:l.lut},u=>mUe.includes(u)),this._segments=new ka,this.hiddenByLandmarkVertexArray=new sN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new ka}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(l,u,g,y=!1){const j=l.length;if(j>2){let N=Math.max(0,this._segments.get().length-1);const E=this._segments._prepareSegment(4*j,this.vertexArray.length,2*this._segmentToGroundQuads[N].length);let R;N!==this._segments.get().length-1&&(N++,this._segmentToGroundQuads[N]=[],this._segmentToRegionTriCounts[N]=[0,0,0,0,0]);{const B=l[0],H=l[1];R=x1e(B.sub(l[j-1])._perp()._unit(),H.sub(B)._perp()._unit())}for(let B=0;By.region-j.region);for(let g=0;gR+B,0);let E=0;for(let R=0;R<=4;R++){const B=N[R];if(B!==0){let H=this.regionSegments[R];H||(H=this.regionSegments[R]=new ka);const G={vertexOffset:j.vertexOffset,primitiveOffset:j.primitiveOffset+E,vertexLength:j.vertexLength,primitiveLength:B};H.get().push(G)}E+=B}for(let R=0;R0?this.hiddenByLandmarkVertexBuffer=l.createVertexBuffer(this.hiddenByLandmarkVertexArray,dUe.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 l=0;l<=4;l++){const u=this.regionSegments[l];u&&u.destroy()}}}}class HP{constructor(l){this.zoom=l.zoom,this.canonical=l.canonical,this.overscaling=l.overscaling,this.layers=l.layers,this.pixelRatio=l.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=l.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ro,this.footprintVertices=new Om,this.footprintSegments=[],this.layoutVertexArray=new Ay,this.centroidVertexArray=new IP,this.wallVertexArray=new jv,this.indexArray=new Ro,this.programConfigurations=new kh(l.layers,{zoom:l.zoom,lut:l.lut},u=>pUe.includes(u)),this.segments=new ka,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new Aae(l),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,y){}populate(l,u,g,y){this.features=[],this.hasPattern=bae("fill-extrusion",this.layers,this.pixelRatio,u),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Ee(g),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:j,id:N,index:E,sourceLayerIndex:R}of l){const B=this.layers[0]._featureFilter.needGeometry,H=It(j,B);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),H,g))continue;const G={id:N,sourceLayerIndex:R,index:E,geometry:B?H.geometry:_t(j,g,y),properties:j.properties,type:j.type,patterns:{}},X=this.layoutVertexArray.length,J=Tae[G.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:j.id,feature:wae("fill-extrusion",this.layers,G,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(const se of G.geometry)for(const pe of d1e(se,J))this.addFeature(j.id,G,[pe],E,g,{},u.availableImages,y,u.brightness);else this.addFeature(j.id,G,G.geometry,E,g,{},u.availableImages,y,u.brightness);u.featureIndex.insert(j,G.geometry,E,R,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(l,u,g,y,j,N){for(const{featureId:E,feature:R}of this.features){const B=Tae[R.type]==="Polygon",{geometry:H}=R;if(this.wallMode)for(const G of H)for(const X of d1e(G,B))this.addFeature(E,R,[X],R.index,u,g,y,j,N);else this.addFeature(E,R,H,R.index,u,g,y,j,N)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(l,u,g,y,j,N,E){this.programConfigurations.updatePaintArrays(l,u,j,g,y,N,E,this.worldview),this.groundEffect.update(l,u,j,g,y,N,E,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,hUe),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.wallVertexBuffer=l.createVertexBuffer(this.wallVertexArray,cUe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=l.createVertexBuffer(this.layoutVertexExtArray,uUe.members,!0)),this.groundEffect.upload(l)),this.groundEffect.uploadPaintProperties(l),this.programConfigurations.upload(l),this.uploaded=!0}uploadCentroid(l){this.groundEffect.uploadHiddenByLandmark(l),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,lUe.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(l,u,g,y,j,N,E,R,B){const H=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,G=[new ir(0,0),new ir(Mr,Mr)],X=R.projection,J=X.name==="globe",se=this.wallMode||Tae[u.type]==="Polygon",pe=new g1e;pe.centroidDataIndex=this.centroidData.length;const ke=new m1e;ke.buildingId=l,u.properties&&u.properties.hasOwnProperty("building_id")&&(ke.buildingId=u.properties.building_id);const we=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},j)<=0,Oe=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},j);let ze;if(ke.height=Oe,ke.vertexArrayOffset=this.layoutVertexArray.length,ke.groundVertexArrayOffset=this.groundEffect.vertexArray.length,J&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Qk),this.wallMode){if(J)return void $r("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;ze=function(Pt){const Jt=Pt[0].x===Pt[Pt.length-1].x&&Pt[0].y===Pt[Pt.length-1].y;(function(Hr){let tn=0;const ms=Hr.length;for(let kr=0;kr=0})(Pt)||(Pt=Pt.reverse());const lr={geometry:[],joinNormals:[],indices:[]},gr=[],yr=[],hr=[];let fr=Pt.length;for(;fr>=2&&Pt[fr-1].equals(Pt[fr-2]);)fr--;if(fr<(Jt?3:2))return lr;let Qt,Kt,pr,Tr,jr,dn=0;for(;dn0;let $n="miter";const Ps=2;$n==="miter"&&kr>Ps&&($n="bevel"),$n==="bevel"&&(kr>100&&($n="flipbevel"),kr{const er=new ir(Jn.x,Jn.y),xr=new ir(Jn.x,Jn.y);er.x+=Pi.x*ut,er.y+=Pi.y*ut,xr.x-=Pi.x*Math.max(at,1),xr.y-=Pi.y*Math.max(at,1),hr.push(Pi),gr.push(er),yr.push(xr)};if($n==="miter")tn._mult(kr),zs(Qt,tn,0,0);else if($n==="flipbevel")tn=jr.mult(-1),zs(Qt,tn,0,0),zs(Qt,tn.mult(-1),0,0);else{const Jn=-Math.sqrt(kr*kr-1),Pi=rn?Jn:0,at=rn?0:Jn;Kt&&zs(Qt,Tr,Pi,at),pr&&zs(Qt,jr,Pi,at)}}lr.geometry=[...gr,...yr.reverse(),gr[0]],lr.joinNormals=[...hr,...hr.reverse(),hr[hr.length-1]];const Fr=lr.geometry.length-1;for(let Hr=0;HrPt<(Jt.length-1)/2||Pt===Jt.length-1,dt=this.wallMode?[g]:L3(g,500);for(let Pt=dt.length-1;Pt>=0;Pt--){const Jt=dt[Pt];(Jt.length===0||(it=Jt[0]).every(or=>or.x<=0)||it.every(or=>or.x>=Mr)||it.every(or=>or.y<=0)||it.every(or=>or.y>=Mr))&&dt.splice(Pt,1)}var it;let pt;if(J)pt=k1e(dt,G,j);else{pt=[];for(const Pt of dt)pt.push({polygon:Pt,bounds:G})}const wt=se?this.edgeRadius:0,St=wt>0&&this.zoom<17,Gt=(Pt,Jt)=>{if(Pt.length===0)return!1;const or=Pt[Pt.length-1];return Jt.x===or.x&&Jt.y===or.y};for(const{polygon:Pt,bounds:Jt}of pt){let or=0,lr=0;for(const fr of Pt)se&&!fr[0].equals(fr[fr.length-1])&&fr.push(fr[0]),lr+=se?fr.length-1:fr.length;const gr=this.segments.prepareSegment((se?5:4)*lr,this.layoutVertexArray,this.indexArray);ke.footprintSegIdx<0&&(ke.footprintSegIdx=this.footprintSegments.length),ke.polygonSegIdx<0&&(ke.polygonSegIdx=this.polygonSegments.length);const yr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},hr=new p1e;if(hr.vertexOffset=this.footprintVertices.length,hr.indexOffset=3*this.footprintIndices.length,hr.ringIndices=[],se){const fr=[],Qt=[];or=gr.vertexLength;for(let pr=0;pr4&&b1e(Qt[Qt.length-2],Qt[0],Qt[1]),pr=wt?_Ue(Qt[Qt.length-2],Qt[0],Qt[1],wt):0;const Tr=[];let jr,dn,Fr;dn=Qt[1].sub(Qt[0])._perp()._unit();let Hr=!0;for(let tn=1,ms=0;tn0?1:0,Pi=kr.dist(rn);if(ms+Pi>32768&&(ms=0),wt){Fr=$n.sub(rn)._perp()._unit();let xr=v1e(kr,rn,$n,y1e(dn,Fr),wt);isNaN(xr)&&(xr=0);const Lr=rn.sub(kr)._unit();kr=kr.add(Lr.mult(pr))._round(),rn=rn.add(Lr.mult(-xr))._round(),pr=xr,dn=Fr,we&&this.zoom>=17&&(Gt(Tr,kr)||Tr.push(kr),Gt(Tr,rn)||Tr.push(rn))}const at=gr.vertexLength,ut=Qt.length>4&&b1e(kr,rn,$n);let er=w1e(ms,Kt,Hr);if(D3(this.layoutVertexArray,kr.x,kr.y,zs,Jn,0,0,er),D3(this.layoutVertexArray,kr.x,kr.y,zs,Jn,0,1,er),this.wallMode){const xr=qe(tn-1,Qt),Lr=ze.joinNormals[tn-1];R3(this.wallVertexArray,Lr,xr),R3(this.wallVertexArray,Lr,xr)}if(ms+=Pi,er=w1e(ms,ut,!Hr),Kt=ut,D3(this.layoutVertexArray,rn.x,rn.y,zs,Jn,0,0,er),D3(this.layoutVertexArray,rn.x,rn.y,zs,Jn,0,1,er),this.wallMode){const xr=qe(tn,Qt),Lr=ze.joinNormals[tn];R3(this.wallVertexArray,Lr,xr),R3(this.wallVertexArray,Lr,xr)}if(gr.vertexLength+=4,this.indexArray.emplaceBack(at+0,at+1,at+2),this.indexArray.emplaceBack(at+1,at+3,at+2),gr.primitiveLength+=2,wt){const xr=or+(tn===1?Qt.length-2:tn-2),Lr=tn===1?or:xr+1;if(this.indexArray.emplaceBack(at+1,xr,at+3),this.indexArray.emplaceBack(xr,Lr,at+3),gr.primitiveLength+=2,jr===void 0&&(jr=at),!Eae($n,Qt[tn],Jt)){const Or=tn===Qt.length-1?jr:gr.vertexLength;this.indexArray.emplaceBack(at+2,at+3,Or),this.indexArray.emplaceBack(at+3,Or+1,Or),this.indexArray.emplaceBack(at+3,Lr,Or+1),gr.primitiveLength+=3}Hr=!Hr}if(J){const xr=this.layoutVertexExtArray,Lr=X.projectTilePoint(kr.x,kr.y,j),Or=X.projectTilePoint(rn.x,rn.y,j),hn=X.upVector(j,kr.x,kr.y),mn=X.upVector(j,rn.x,rn.y);F3(xr,Lr,hn),F3(xr,Lr,hn),F3(xr,Or,mn),F3(xr,Or,mn)}}se&&(or+=Qt.length-1),we&&wt&&this.zoom>=17&&(Tr.length!==0&&Gt(Tr,Tr[0])&&Tr.pop(),this.groundEffect.addData(Tr,Jt,H,wt>0))}this.footprintSegments.push(hr),yr.triangleCount=this.indexArray.length-yr.triangleArrayOffset,this.polygonSegments.push(yr),++ke.footprintSegLen,++ke.polygonSegLen}if(ke.vertexCount=this.layoutVertexArray.length-ke.vertexArrayOffset,ke.groundVertexCount=this.groundEffect.vertexArray.length-ke.groundVertexArrayOffset,ke.vertexCount!==0){if(ke.centroidXY=pe.borders?u1e:this.encodeCentroid(pe,ke),this.centroidData.push(ke),pe.borders){this.featuresOnBorder.push(pe);const Pt=this.featuresOnBorder.length-1;for(let Jt=0;Jtthis.featuresOnBorder[u].borders[l][0]-this.featuresOnBorder[g].borders[l][0])}splitToSubtiles(){const l=[];for(let E=0;EMr),H=2*B+(+(R.min.x+R.max.x>Mr)^B);for(let G=0;GE.triangleSegmentIdx===R.triangleSegmentIdx?E.subtile-R.subtile:E.triangleSegmentIdx-R.triangleSegmentIdx);let g=0,y=0,j=0;for(const E of l){if(E.triangleSegmentIdx!==g)break;j++}const N=l.length;for(;y!==l.length;){g=l[y].triangleSegmentIdx;let E=0,R=y,B=y;for(let H=R;H0&&this.triangleSubSegments.push({segment:J,min:G,max:X}),R=B;for(let se=R;se[pe[0]*(1-we[0])+ke[0]*we[0],pe[1]*(1-we[1])+ke[1]*we[1]],J=[],se=[];for(const pe of this.triangleSubSegments){J[0]=pe.min.x/Mr,J[1]=pe.min.y/Mr,se[0]=pe.max.x/Mr,se[1]=pe.max.y/Mr;const ke=X(H,G,J),we=X(H,G,se);if(new on([ke[0],ke[1],j],[we[0],we[1],N]).intersectsPrecise(g)===0){B&&(y.segments.push(B),B=void 0);continue}const Oe=pe.segment;B&&B.vertexOffset!==Oe.vertexOffset&&(y.segments.push(B),B=void 0),B?(B.vertexLength+=Oe.vertexLength,B.primitiveLength+=Oe.primitiveLength):B={vertexOffset:Oe.vertexOffset,primitiveLength:Oe.primitiveLength,vertexLength:Oe.vertexLength,primitiveOffset:Oe.primitiveOffset,sortKey:void 0,vaos:{}}}return B&&y.segments.push(B),y}encodeCentroid(l,u){const g=l.centroid(),y=u.span(),j=Math.min(7,Math.round(y.x*this.tileToMeter/10)),N=Math.min(7,Math.round(y.y*this.tileToMeter/10));return new ir(_e(g.x,1,Mr-1)<<3|j,_e(g.y,1,Mr-1)<<3|N)}encodeBorderCentroid(l){if(!l.borders)return new ir(0,0);const u=l.borders,g=Number.MAX_VALUE;if(u[0][0]!==g||u[1][0]!==g){const y=u[0][0]!==g?0:1;return new ir(6|(u[0][0]!==g?0:65528),(u[y][0]+u[y][1])/2<<3|6)}{const y=u[2][0]!==g?2:3;return new ir((u[y][0]+u[y][1])/2<<3|6,6|(u[2][0]!==g?0:65528))}}showCentroid(l){const u=this.centroidData[l.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(l){this.groundEffect.updateHiddenByLandmark(l);const u=l.vertexArrayOffset,g=l.vertexCount+l.vertexArrayOffset,y=l.flags&ex?u1e:l.centroidXY,j=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==y.y||j!==y.x){for(let N=u;NR.max.x||R.min.x>N.max.x||N.min.y>R.max.y||R.min.y>N.max.y||N.footprint.buildingIds.has(R.buildingId)&&(R.flags|=ex);else for(const R of this.centroidData)if(!(R.flags&ex||N.min.x>R.max.x||R.min.x>N.max.x||N.min.y>R.max.y||R.min.y>N.max.y))for(let B=0;Bu!=J>u&&l<(this.footprintVertices.int16[2*(H+N.vertexOffset)+0]-G)*(u-X)/(J-X)+G&&(y=!y)}E=R}}return y}getHeightAtTileCoord(l,u){let g=Number.NEGATIVE_INFINITY,y=!0;const j=4*(l+Mr)*Mr+(u+Mr);if(this.partLookup.hasOwnProperty(j)){const N=this.partLookup[j];return N?{height:N.height,hidden:!!(N.flags&ex)}:void 0}for(const N of this.centroidData)l>N.max.x||N.min.x>l||u>N.max.y||N.min.y>u||N.height<=g||this.footprintContainsPoint(l,u,N)&&(g=N.height,this.partLookup[j]=N,y=!!(N.flags&ex));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:y};this.partLookup[j]=void 0}}function y1e(f,l){const u=f.add(l)._unit();return f.x*u.x+f.y*u.y}function _Ue(f,l,u,g){const y=l.sub(f)._perp()._unit(),j=u.sub(l)._perp()._unit();return v1e(f,l,u,y1e(y,j),g)}function v1e(f,l,u,g,y){const j=Math.sqrt(1-g*g);return Math.min(f.dist(l)/3,l.dist(u)/3,y*j/g)}function Eae(f,l,u){return f.xu[1].x&&l.x>u[1].x||f.yu[1].y&&l.y>u[1].y}function _1e(f,l){return f.xl[1].x||f.yl[1].y}function b1e(f,l,u){if(f.x<0||f.x>=Mr||l.x<0||l.x>=Mr||u.x<0||u.x>=Mr)return!1;const g=u.sub(l),y=g.perp(),j=f.sub(l);return(g.x*j.x+g.y*j.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(j.x*j.x+j.y*j.y))>-.866&&y.x*j.x+y.y*j.y<0}function w1e(f,l,u){const g=l?2|f:-3&f;return u?1|g:-2&g}function j1e(){const f=Math.PI/32,l=Math.tan(f),u=_;return u*Math.sqrt(1+2*l*l)-u}function k1e(f,l,u){const g=1<{for(const wt of it)se.push({polygon:wt,bounds:pt})},ke=Math.ceil(Math.log2(H)),we=Math.ceil(Math.log2(G)),Oe=ke-we,ze=[];for(let it=0;it0?0:1);for(let it=0;itpt+1?dt.push({polygons:lr,bounds:yr,depth:pt+1}):pe(lr,yr)}if(gr.length){const yr=[new ir(wt===0?or:St.x,wt===1?or:St.y),Gt];ze.length>pt+1?dt.push({polygons:gr,bounds:yr,depth:pt+1}):pe(gr,yr)}}return se}(f,l,Math.ceil((j-y)/11.25),Math.ceil((N-E)/11.25),1,(R,B,H)=>{if(R===0)return .5*(B+H);{const G=ce((u.y+B/Mr)/g);return(V(.5*(ce((u.y+H/Mr)/g)+G))*g-u.y)*Mr}})}function bUe(f,l,u,g,y,j){const N=Math.pow(2,g.z-y.z);for(let E=0;E=R[N]&&(E=l,R=f),E[N]y&&M1e(E,R,N,y),E[N]j&&M1e(R,E,N,j)}}function WP(f,l,u,g,y,j){const N=[];for(let E=0;E=g&&se.x>=g||(J.x>=g?J=new ir(g,J.y+(g-J.x)/(se.x-J.x)*(se.y-J.y))._round():se.x>=g&&(se=new ir(g,J.y+(g-J.x)/(se.x-J.x)*(se.y-J.y))._round()),J.y>=y&&se.y>=y||(J.y>=y?J=new ir(J.x+(y-J.y)/(se.y-J.y)*(se.x-J.x),y)._round():se.y>=y&&(se=new ir(J.x+(y-J.y)/(se.y-J.y)*(se.x-J.x),y)._round()),B&&J.equals(B[B.length-1])||(B=[J],N.push(B),j&&j.push({progress:{min:ke+A1e(we,Oe,J)*pe,max:1},parentIndex:E,prevPoint:we,nextPoint:Oe})),B.push(se),j&&(j[j.length-1].progress.max=ke+A1e(we,Oe,se)*pe,j[j.length-1].nextPoint=Oe)))))}if(j&&G>0)for(let X=H;XB.t-H.t);let N=0,E=0,R=[];for(g.push(R);N!==f.length;){if(E===j.length){for(;N!==f.length;)R.length!==0&&R[R.length-1].equals(f[N])||R.push(f[N]),N++;break}j[E].t<=N?(R.length!==0&&R[R.length-1].equals(j[E].point)||R.push(j[E].point),Math.trunc(j[E].t),E++):(R.length!==0&&R[R.length-1].equals(f[N])||R.push(f[N]),N++)}}function A1e(f,l,u){return f.x!==l.x?(u.x-f.x)/(l.x-f.x):f.y!==l.y?(u.y-f.y)/(l.y-f.y):0}function z3(f,l){return f.x*l.x+f.y*l.y}function E1e(f,l){if(f.length===1){let u=0;const g=l[u++];let y;for(;!y||g.equals(y);)if(y=l[u++],!y)return 1/0;for(;u{or[0]=lr,or[1]=gr,or[2]=yr,or[3]=1},Jt=j1e();J>0&&(J+=Jt),se+=Jt;for(const or of X){const lr=[],gr=[];for(const yr of or){const hr=yr.x+pe.x,fr=yr.y+pe.y,Qt=G.projection.projectTilePoint(hr,fr,dt),Kt=G.projection.upVector(dt,yr.x,yr.y);let pr=J,Tr=se;if(we){const jr=L1e(hr,fr,J,se,we,Oe,ze,qe);pr+=jr.base,Tr+=jr.top}J!==0?Pt(St,Qt.x+Kt[0]*wt*pr,Qt.y+Kt[1]*wt*pr,Qt.z+Kt[2]*wt*pr):Pt(St,Qt.x,Qt.y,Qt.z),Pt(Gt,Qt.x+Kt[0]*wt*Tr,Qt.y+Kt[1]*wt*Tr,Qt.z+Kt[2]*wt*Tr),Ye(St,St,ke),Ye(Gt,Gt,ke),lr.push(new Pv(St[0],St[1],St[2])),gr.push(new Pv(Gt[0],Gt[1],Gt[2]))}it.push(lr),pt.push(gr)}return[it,pt]}(f,l,u,g,y,j,N,E,R,B,H):N?function(G,X,J,se,pe,ke,we,Oe,ze){const qe=[],dt=[],it=[0,0,0,1];for(const pt of G){const wt=[],St=[];for(const Gt of pt){const Pt=Gt.x+se.x,Jt=Gt.y+se.y,or=L1e(Pt,Jt,X,J,ke,we,Oe,ze);it[0]=Pt,it[1]=Jt,it[2]=or.base,it[3]=1,Lt(it,it,pe),it[3]=Math.max(it[3],1e-5);const lr=new Pv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);it[0]=Pt,it[1]=Jt,it[2]=or.top,it[3]=1,Lt(it,it,pe),it[3]=Math.max(it[3],1e-5);const gr=new Pv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);wt.push(lr),St.push(gr)}qe.push(wt),dt.push(St)}return[qe,dt]}(l,u,g,y,j,N,E,R,B):function(G,X,J,se,pe){const ke=[],we=[],Oe=pe[8]*X,ze=pe[9]*X,qe=pe[10]*X,dt=pe[11]*X,it=pe[8]*J,pt=pe[9]*J,wt=pe[10]*J,St=pe[11]*J;for(const Gt of G){const Pt=[],Jt=[];for(const or of Gt){const lr=or.x+se.x,gr=or.y+se.y,yr=pe[0]*lr+pe[4]*gr+pe[12],hr=pe[1]*lr+pe[5]*gr+pe[13],fr=pe[2]*lr+pe[6]*gr+pe[14],Qt=pe[3]*lr+pe[7]*gr+pe[15],Kt=yr+Oe,pr=hr+ze,Tr=fr+qe,jr=Math.max(Qt+dt,1e-5),dn=yr+it,Fr=hr+pt,Hr=fr+wt,tn=Math.max(Qt+St,1e-5);Pt.push(new Pv(Kt/jr,pr/jr,Tr/jr)),Jt.push(new Pv(dn/tn,Fr/tn,Hr/tn))}ke.push(Pt),we.push(Jt)}return[ke,we]}(l,u,g,y,j)}function L1e(f,l,u,g,y,j,N,E){const R=N*y.getElevationAt(f,l,!0,!0),B=j[0]!==0,H=B?j[1]===0?N*(j[0]/h1e-f1e):N*function(G,X,J){const se=Math.floor(X[0]/8),pe=Math.floor(X[1]/8),ke=10*(X[0]-8*se),we=10*(X[1]-8*pe),Oe=G.getElevationAt(se,pe,!0,!0),ze=G.getMeterToDEM(J),qe=Math.floor(.5*(ke*ze-1)),dt=Math.floor(.5*(we*ze-1)),it=G.tileCoordToPixel(se,pe),pt=2*qe+1,wt=2*dt+1,St=function(gr,yr,hr,fr,Qt){return[gr.getElevationAtPixel(yr,hr,!0),gr.getElevationAtPixel(yr+Qt,hr,!0),gr.getElevationAtPixel(yr,hr+Qt,!0),gr.getElevationAtPixel(yr+fr,hr+Qt,!0)]}(G,it.x-qe,it.y-dt,pt,wt),Gt=Math.abs(St[0]-St[1]),Pt=Math.abs(St[2]-St[3]),Jt=Math.abs(St[0]-St[2])+Math.abs(St[1]-St[3]),or=Math.min(.25,.5*ze*(Gt+Pt)/pt),lr=Math.min(.25,.5*ze*Jt/wt);return Oe+Math.max(or*ke,lr*we)}(y,j,E):R;return{base:R+(u===0?-1:u),top:B?Math.max(H+g,R+u+2):R+g}}class jUe{constructor(l){this._callback=l,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 kUe{constructor(){this.tasks={},this.taskQueue=[],At(["process"],this),this.invoker=new jUe(this.process),this.nextId=0}add(l,u){const g=this.nextId++,y=function({type:j,isSymbolTile:N,zoom:E}){return E=E||0,j==="message"?0:j!=="maybePrepare"||N?j!=="parseTile"||N?j==="parseTile"&&N?300-E:j==="maybePrepare"&&N?400-E:500:200-E:100-E}(u);if(y===0){try{l()}finally{}return null}return this.tasks[g]={fn:l,metadata:u,priority:y,id:g},this.taskQueue.push(g),this.invoker.trigger(),{cancel:()=>{delete this.tasks[g]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(g=>!!this.tasks[g]),!this.taskQueue.length)return;const l=this.pick();if(l===null)return;const u=this.tasks[l];if(delete this.tasks[l],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let l=null,u=1/0;for(let y=0;y{g&&delete this.callbacks[E],this.target.postMessage({id:E,type:"",targetMapId:y,sourceMapId:this.mapId})}}}receive(l){const u=l.data;if(!u)return;const g=u.id;if(g&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){const y=this.cancelCallbacks[g];delete this.cancelCallbacks[g],y&&y.cancel()}else if(u.mustQueue||Os(self)){const y=this.callbacks[g],j=this.scheduler.add(()=>this.processTask(g,u),y&&y.metadata||{type:"message"});j&&(this.cancelCallbacks[g]=j)}else this.processTask(g,u)}processTask(l,u){if(delete this.cancelCallbacks[l],u.type===""){const g=this.callbacks[l];delete this.callbacks[l],g&&(u.error?g(Lm(u.error)):g(null,Lm(u.data)))}else{const g=new Set,y=u.hasCallback?(N,E)=>{this.target.postMessage({id:l,type:"",sourceMapId:this.mapId,error:N?fp(N):null,data:fp(E,g)},g)}:()=>{},j=Lm(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,j,y);else if(this.parent.getWorkerSource){const N=u.type.split("."),{source:E,scope:R}=j;this.parent.getWorkerSource(u.sourceMapId,N[0],E,R)[N[1]](j,y)}else y(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var B3={workerUrl:"",workerClass:null,workerParams:void 0};const Iae="mapboxgl_preloaded_worker_pool";class Lv{constructor(l){this.active={},this.name=l}acquire(l,u=Lv.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Iae]}numActive(){return Object.keys(this.active).length}}Lv.workerCount=2;class yN{constructor(l,u,g="Worker",y=Lv.workerCount){this.workerPool=l,this.actors=[],this.currentActor=0,this.id=Ct();const j=this.workerPool.acquire(this.id,y);for(let N=0;N{this.ready=!0})}broadcast(l,u,g){vt(this.actors,(y,j)=>{y.send(l,u,j)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(l=>{l.remove()}),this.actors=[],this.workerPool.release(this.id)}}let $3,Pae;function GP(){return $3||($3=new Lv),$3}yN.Actor=O1e;const Lae=4096;class NUe{constructor(l){this.module=l,this.memoryStack=this.module.malloc(Lae),this.memoryStackNextFree=this.memoryStack}createIntArray(l){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=l.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Lae?-1:(new Int32Array(this.module.heap32.buffer,u,l.length).set(l),u)}createFloatArray(l){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=l.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Lae?-1:(new Float32Array(this.module.heapF32.buffer,u,l.length).set(l),u)}readStringBuffer(l){let u="";for(;this.module.heapU8[l]!==0;)u+=String.fromCharCode(this.module.heapU8[l]),++l;return u}setStyle(l){const u=l.normalScale;this.module.setStyle(u[0],u[1],u[2],l.tileToMeters)}setAOOptions(l,u){this.module.setAOOptions(l?1:0,u)}setMetricOptions(l,u){this.module.setMetricOptions(l?1:0,u)}setStructuralOptions(l){this.module.setStructuralOptions(l?1:0)}setFacadeOptions(l,u){this.module.setFacadeOptions(l,u?1:0)}setFauxFacadeOptions(l,u,g){this.module.setFauxFacadeOptions(l?1:0,u?1:0,g)}setFacadeClassifierOptions(l){this.module.setFacadeClassifierOptions(l)}generateMesh(l,u){this.memoryStackNextFree=this.memoryStack;for(const E of l){const R=this.createIntArray(E.ringIndices),B=this.createFloatArray(E.coordinates);if(R===-1||B===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(E.id,E.sourceId,E.minHeight,E.height,E.roofType,B,R,E.ringIndices.length-1)}for(const E of u){let R;R=E.entrances?JSON.parse(E.entrances):[];const B=this.createFloatArray(R),H=this.createFloatArray(E.coordinates);if(B===-1||H===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(E.sourceId,E.crossPerc,E.distanceToRoad,B,R.length,H,E.coordinates.length)}if(!this.module.generateMesh()){const E=this.module.getLastError();return this.readStringBuffer(E)}const g=this.module.getMeshCount(),y=new Array(g);for(let E=0;Ey.arrayBuffer()).then(y=>{l.buffers[u]=y})}function q1e(f,l){const u=f.json.bufferViews[l];return new Uint8Array(f.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function EUe(f,l,u,g){if(f.uri){const y=U1e(f.uri,g);return fetch(y).then(j=>j.blob()).then(j=>createImageBitmap(j)).then(j=>{l.images[u]=j})}if(f.bufferView!==void 0){const y=q1e(l,f.bufferView),j=new Blob([y],{type:f.mimeType});return createImageBitmap(j).then(N=>{l.images[u]=N})}}function V1e(f,l=0,u){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,l,1)[0]===B1e){const H=new Uint32Array(f,l);let G=2;const X=(H[G++]>>2)-3,J=H[G++]>>2;if(G++,g.json=JSON.parse($1e.decode(H.subarray(G,G+J))),G+=J,G{const H=[],G=E&&E.includes(Rae),X=E&&E.includes(YP);if(G&&H.push(function(){if(!Np)return U3??(U3=function(J){let se,pe=null;function ke(){se=new Uint8Array(pe.buffer)}function we(){throw new Error("Unexpected Draco error.")}const Oe={a:{a:we,d:function(ze,qe,dt){return se.copyWithin(ze,qe,qe+dt)},c:function(ze){const qe=se.length,dt=Math.max(ze>>>0,Math.ceil(1.2*qe)),it=Math.ceil((dt-qe)/65536);try{return pe.grow(it),ke(),!0}catch{return!1}},b:we}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(J,Oe):J.then(ze=>ze.arrayBuffer()).then(ze=>WebAssembly.instantiate(ze,Oe))).then(ze=>{const{Rb:qe,Qb:dt,P:it,T:pt,X:wt,Ja:St,La:Gt,Qa:Pt,Va:Jt,Wa:or,eb:lr,jb:gr,f:yr,e:hr,yb:fr,zb:Qt,Ab:Kt,Bb:pr,Db:Tr,Gb:jr}=ze.instance.exports;pe=hr;const dn=(()=>{let Fr=0,Hr=0,tn=0,ms=0;return kr=>{tn&&(qe(ms),qe(Fr),Hr+=tn,tn=Fr=0),Fr||(Hr+=128,Fr=dt(Hr));const rn=kr.length+7&-8;let $n=Fr;rn>=Hr&&(tn=rn,$n=ms=dt(rn));for(let Ps=0;Ps{Np=J,U3=void 0}))}()),X&&H.push(function(){if(Dae)return;const J=function(se){let pe;const ke=WebAssembly.instantiateStreaming(se,{}).then(ze=>{pe=ze.instance,pe.exports.__wasm_call_ctors()}),we={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Oe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:ke,supported:!0,decodeGltfBuffer(ze,qe,dt,it,pt,wt){(function(St,Gt,Pt,Jt,or,lr,gr){const yr=St.exports.sbrk,hr=Jt+3&-4,fr=yr(hr*or),Qt=yr(lr.length),Kt=new Uint8Array(St.exports.memory.buffer);Kt.set(lr,Qt);const pr=Gt(fr,Jt,or,Qt,lr.length);if(pr===0&&gr&&gr(fr,hr,or),Pt.set(Kt.subarray(fr,fr+Jt*or)),yr(fr-yr(0)),pr!==0)throw new Error(`Malformed buffer data: ${pr}`)})(pe,pe.exports[Oe[pt]],ze,qe,dt,it,pe.exports[we[wt]])}}}(fetch(F1e()));return J.ready.then(()=>{Dae=J})}()),j)for(let J=0;J{if(G&&N)for(const{primitives:J}of N)for(const se of J)MUe(se,g);if(X&&N&&R)for(const J of R)TUe(J,g);return g})})}function H1e(f){return fetch(f).then(l=>l.arrayBuffer()).then(l=>V1e(l,0,f))}function Fae(f){switch(f){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function zae(f){switch(f){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Bae{constructor(l,u,g,y){this.context=l,this.format=g,this.useMipmap=y&&y.useMipmap,this.texture=l.gl.createTexture(),this.update(u,{premultiply:y&&y.premultiply})}update(l,u){const g=l&&l instanceof HTMLVideoElement&&l.width===0?l.videoWidth:l.width,y=l&&l instanceof HTMLVideoElement&&l.height===0?l.videoHeight:l.height,{context:j}=this,{gl:N}=j,{x:E,y:R}=u&&u.position?u.position:{x:0,y:0},B=E+g,H=R+y;!this.size||this.size[0]===B&&this.size[1]===H||(N.bindTexture(N.TEXTURE_2D,null),N.deleteTexture(this.texture),this.texture=N.createTexture(),this.size=null),N.bindTexture(N.TEXTURE_2D,this.texture),j.pixelStoreUnpackFlipY.set(!1),j.pixelStoreUnpack.set(1),j.pixelStoreUnpackPremultiplyAlpha.set(this.format===N.RGBA8&&(!u||u.premultiply!==!1));const G=l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||ImageBitmap&&l instanceof ImageBitmap;if(!this.size&&B>0&&H>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max(B,H)))+1:1;N.texStorage2D(N.TEXTURE_2D,X,this.format,B,H),this.size=[B,H]}this.size&&(G?N.texSubImage2D(N.TEXTURE_2D,0,E,R,Fae(this.format),zae(this.format),l):"data"in l&&l.data&&N.texSubImage2D(N.TEXTURE_2D,0,E,R,g,y,Fae(this.format),zae(this.format),l.data)),this.useMipmap&&N.generateMipmap(N.TEXTURE_2D)}bind(l,u,g=!1){const{context:y}=this,{gl:j}=y;j.bindTexture(j.TEXTURE_2D,this.texture),l!==this.minFilter&&(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,l),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,this.useMipmap&&!g?l===j.NEAREST?j.NEAREST_MIPMAP_NEAREST:j.LINEAR_MIPMAP_LINEAR:l),this.minFilter=l),u!==this.wrapS&&(j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,u),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(l,u,g,y,j){const{context:N}=this,{gl:E}=N;E.bindTexture(E.TEXTURE_2D,this.texture),u!==this.magFilter&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,u),this.magFilter=u),l!==this.minFilter&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,this.useMipmap?l===E.NEAREST?E.NEAREST_MIPMAP_NEAREST:E.LINEAR_MIPMAP_LINEAR:l),this.minFilter=l),g!==this.wrapS&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,g),this.wrapS=g),y!==this.wrapT&&(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,y),this.wrapT=y),j!==this.compareMode&&(j?(E.texParameteri(E.TEXTURE_2D,E.TEXTURE_COMPARE_MODE,E.COMPARE_REF_TO_TEXTURE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_COMPARE_FUNC,j)):E.texParameteri(E.TEXTURE_2D,E.TEXTURE_COMPARE_MODE,E.NONE),this.compareMode=j)}destroy(){const{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null}}class V3{constructor(l,u){this.context=l,this.texture=u}bind(l,u){const{context:g}=this,{gl:y}=g;y.bindTexture(y.TEXTURE_2D,this.texture),l!==this.minFilter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,l),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,l),this.minFilter=l),u!==this.wrapS&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,u),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,u),this.wrapS=u)}}const IUe=Ss([{name:"a_pos_3f",components:3,type:"Float32"}]),PUe=Ss([{name:"a_color_3f",components:3,type:"Float32"}]),LUe=Ss([{name:"a_color_4f",components:4,type:"Float32"}]),OUe=Ss([{name:"a_uv_2f",components:2,type:"Float32"}]),DUe=Ss([{name:"a_normal_3f",components:3,type:"Float32"}]),RUe=Ss([{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"}]),FUe=Ss([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function W1e(f,l){const u=XP(f.projection,f.zoom,f.width,f.height),g=function(j,N,E,R,B){const H=new p(E.lng-180*By,E.lat),G=new p(E.lng+180*By,E.lat),X=j.project(H.lng,H.lat),J=j.project(G.lng,G.lat),se=-Math.atan2(J.y-X.y,J.x-X.x),pe=$e.fromLngLat(E);pe.y=_e(pe.y,-1+By,1-By);const ke=pe.toLngLat(),we=j.project(ke.lng,ke.lat),Oe=$e.fromLngLat(ke);Oe.x+=By;const ze=Oe.toLngLat(),qe=j.project(ze.lng,ze.lat),dt=K1e(qe.x-we.x,qe.y-we.y,se),it=$e.fromLngLat(ke);it.y+=By;const pt=it.toLngLat(),wt=j.project(pt.lng,pt.lat),St=K1e(wt.x-we.x,wt.y-we.y,se),Gt=Math.abs(dt.x)/Math.abs(St.y),Pt=T([]);W(Pt,Pt,-se*(1-(B?0:R)));const Jt=T([]);return $(Jt,Jt,[1,1-(1-Gt)*R,1]),Jt[4]=-St.x/St.y*R,W(Jt,Jt,se),A(Jt,Pt,Jt),Jt}(f.projection,0,f.center,u,l),y=G1e(f);return $(g,g,[y,y,1]),g}function G1e(f){const l=f.projection,u=XP(f.projection,f.zoom,f.width,f.height),g=$ae(l,f.center),y=$ae(l,p.convert(l.center));return Math.pow(2,g*u+(1-u)*y)}function XP(f,l,u,g,y=1/0){const j=f.range;if(!j)return 0;const N=Math.min(y,Math.max(u,g)),E=Math.log2(N/1024);return De(j[0]+E,j[1]+E,l)}const By=1/4e4;function $ae(f,l){const u=_e(l.lat,-de,de),g=new p(l.lng-180*By,u),y=new p(l.lng+180*By,u),j=f.project(g.lng,u),N=f.project(y.lng,u),E=$e.fromLngLat(g),R=$e.fromLngLat(y),B=N.x-j.x,H=N.y-j.y,G=R.x-E.x,X=R.y-E.y,J=Math.sqrt((G*G+X*X)/(B*B+H*H));return Math.log2(J)}function K1e(f,l,u){const g=Math.cos(u),y=Math.sin(u);return{x:f*g-l*y,y:f*y+l*g}}function Z1e(f,l,u){T(f),W(f,f,rs(l[2])),F(f,f,rs(l[0])),q(f,f,rs(l[1])),$(f,f,u),A(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function QP(f,l,u,g,y,j,N,E){const R=[u[0]-l[0],u[1]-l[1],0],B=[g[0]-l[0],g[1]-l[1],0];if(ye(R)<1e-12||ye(B)<1e-12)return Dt(f);const H=Je([],R,B);Fe(H,H),ve(B,g,l),R[2]=(j-y)*E,B[2]=(N-y)*E;const G=R;return Je(G,R,B),Fe(G,G),qn(f,H,G)}function JP(f,l,u=!1){const g=Fy(l.zoom),y=function(j,N,E){const R=N.worldSize,B=[j[12],j[13],j[14]],H=ce(B[1]/R),G=Q(B[0]/R),X=T([]),J=Y(1,H)*R,se=Y(1,0)*R*xe(H,N.zoom),pe=1/gae(R);let ke=se*pe;if(E){const qe=XP(N.projection,N.zoom,N.width,N.height,1024);ke=pe*N.projection.pixelSpaceConversion(N.center.lat,R,qe)}const we=Oy(H,G);fe(we,we,ae([],Fe([],we),J*ke*B[2]));const Oe=function(qe){const dt=[qe[0],qe[1],qe[2]];let it=[0,1,0];const pt=Je([],it,dt);return Je(it,dt,pt),Le(it)===0&&(it=[0,1,0],Je(pt,dt,it)),Fe(pt,pt),Fe(it,it),Fe(dt,dt),[pt[0],pt[1],pt[2],0,it[0],it[1],it[2],0,dt[0],dt[1],dt[2],0,qe[0],qe[1],qe[2],1]}(we);$(X,X,[ke,ke,ke*J]),D(X,X,[-B[0],-B[1],-B[2]]);const ze=A([],N.globeMatrix,Oe);return A(ze,ze,X),A(ze,ze,j),ze}(f,l,u);if(g>0){const j=function(N,E){const R=E.worldSize,B=Y(1,0)*R*xe(E.center.lat,E.zoom)/gae(R),H=Y(1,E.center.lat)*R,G=T([]);q(G,G,rs(E.center.lng)),F(G,G,rs(E.center.lat)),D(G,G,[0,0,dc]),$(G,G,[B,B,B*H]);const X=E.point;return D(G,G,[-X.x,-X.y,0]),A(G,G,N),A(G,E.globeMatrix,G)}(f,l);return function(N,E,R){const B=(se,pe,ke)=>{const we=ye(se),Oe=ye(pe),ze=kp(se,pe,ke);return ae(ze,ze,1/ye(ze)*Rn(we,Oe,ke))},H=B([N[0],N[1],N[2]],[E[0],E[1],E[2]],R),G=B([N[4],N[5],N[6]],[E[4],E[5],E[6]],R),X=B([N[8],N[9],N[10]],[E[8],E[9],E[10]],R),J=kp([N[12],N[13],N[14]],[E[12],E[13],E[14]],R);return[H[0],H[1],H[2],0,G[0],G[1],G[2],0,X[0],X[1],X[2],0,J[0],J[1],J[2],1]}(y,j,g)}return y}function Uae(f,l,u,g){const y=on.projectAabbCorners(g,u);let j=Number.MAX_VALUE;for(let E=0;E0||ke===0&&se[0]*pe[0]+se[1]*pe[1]>=0&&se[0]*se[0]+se[1]*se[1]>pe[0]*pe[0]+pe[1]*pe[1])&&(H=J)}G=H}while(G!==B);return R.length>0&&R.push(R[0]),R}(y);if(ei(f,N))return j}const Ov=64,wN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function e6(f,l,u,g,y,j,N,E,R,B=!1){const H=u.zoom,G=u.project(g),X=xe(g.lat,H),J=1/X;T(f),D(f,f,[G.x+N[0]*J,G.y+N[1]*J,N[2]]);let se=1,pe=1;const ke=u.worldSize;if(B){if(u.projection.name==="mercator"){let qe=0;u.elevation&&(qe=u.elevation.getAtPointOrZero(new $e(G.x/ke,G.y/ke),0));const dt=Lt([],[G.x,G.y,qe,1],u.projMatrix)[3]/u.cameraToCenterDistance;se=dt,pe=dt*xe(u.center.lat,H)}else if(u.projection.name==="globe"){const qe=JP(f,u),dt=[0,0,0,1];Lt(dt,dt,A([],u.projMatrix,qe));const it=dt[3]/u.cameraToCenterDistance,pt=Fy(H),wt=u.projection.pixelsPerMeter(g.lat,ke)*xe(g.lat,H),St=u.projection.pixelsPerMeter(u.center.lat,ke)*xe(u.center.lat,H);se=it/Rn(wt,be(u.center.lat),pt),pe=it*X/wt,se*=St,pe*=St}}else se=J;$(f,f,[se,se,pe]);const we=[...f],Oe=l.orientation,ze=[];if(Z1e(ze,[Oe[0]+(y?y[0]:0),Oe[1]+(y?y[1]:0),Oe[2]+(y?y[2]:0)],j),A(f,we,ze),E&&u.elevation){let qe=0;const dt=[];if(R&&u.elevation){qe=function(pt,wt,St,Gt,Pt){const Jt=wt.elevation;if(!Jt)return 0;const or=on.projectAabbCorners(St,Gt),lr=Y(1,Pt.lat)*wt.worldSize,gr=function(Hr,tn){const ms=[0,0,1],kr=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const rn of kr){const $n=Hr[rn.corners[0]],Ps=Hr[rn.corners[1]],zs=Hr[rn.corners[2]],Jn=[Ps[0]-$n[0],Ps[1]-$n[1],tn*(Ps[2]-$n[2])],Pi=Je(Jn,Jn,[zs[0]-$n[0],zs[1]-$n[1],tn*(zs[2]-$n[2])]);Fe(Pi,Pi),rn.dotProductWithUp=Ce(Pi,ms)}return kr.sort((rn,$n)=>rn.dotProductWithUp-$n.dotProductWithUp),kr[0].corners}(or,lr),yr=or[gr[0]],hr=or[gr[1]],fr=or[gr[2]],Qt=or[gr[3]],Kt=Jt.getAtPointOrZero(new $e(yr[0]/wt.worldSize,yr[1]/wt.worldSize),0),pr=Jt.getAtPointOrZero(new $e(hr[0]/wt.worldSize,hr[1]/wt.worldSize),0),Tr=Jt.getAtPointOrZero(new $e(fr[0]/wt.worldSize,fr[1]/wt.worldSize),0),jr=Jt.getAtPointOrZero(new $e(Qt[0]/wt.worldSize,Qt[1]/wt.worldSize),0),dn=(Kt+jr)/2,Fr=(pr+Tr)/2;return dn>Fr?pr=l.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function zUe(f,l,u){f.indexBuffer=l.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=l.createVertexBuffer(f.vertexArray,IUe.members,!1,!0),f.normalArray&&(f.normalBuffer=l.createVertexBuffer(f.normalArray,DUe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=l.createVertexBuffer(f.texcoordArray,OUe.members,!1,!0)),f.colorArray&&(f.colorBuffer=l.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?PUe:LUe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=l.createVertexBuffer(f.featureArray,FUe.members,!0)),f.segments=ka.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&H3(g.pbrMetallicRoughness.baseColorTexture,l),g.pbrMetallicRoughness.metallicRoughnessTexture&&H3(g.pbrMetallicRoughness.metallicRoughnessTexture,l),g.normalTexture&&H3(g.normalTexture,l),g.occlusionTexture&&H3(g.occlusionTexture,l,u),g.emissionTexture&&H3(g.emissionTexture,l)}function qae(f,l,u){if(f.meshes)for(const g of f.meshes)zUe(g,l,u);if(f.children)for(const g of f.children)qae(g,l,u)}function t6(f){if(f.meshes)for(const l of f.meshes)l.indexArray.destroy(),l.vertexArray.destroy(),l.colorArray&&l.colorArray.destroy(),l.normalArray&&l.normalArray.destroy(),l.texcoordArray&&l.texcoordArray.destroy(),l.featureArray&&l.featureArray.destroy();if(f.children)for(const l of f.children)t6(l)}function Vae(f){if(f.meshes)for(const u of f.meshes)u.vertexBuffer&&(u.vertexBuffer.destroy(),u.indexBuffer.destroy(),u.normalBuffer&&u.normalBuffer.destroy(),u.texcoordBuffer&&u.texcoordBuffer.destroy(),u.colorBuffer&&u.colorBuffer.destroy(),u.pbrBuffer&&u.pbrBuffer.destroy(),u.segments.destroy(),u.material&&((l=u.material).pbrMetallicRoughness.baseColorTexture&&l.pbrMetallicRoughness.baseColorTexture.gfxTexture&&l.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),l.pbrMetallicRoughness.metallicRoughnessTexture&&l.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&l.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),l.normalTexture&&l.normalTexture.gfxTexture&&l.normalTexture.gfxTexture.destroy(),l.emissionTexture&&l.emissionTexture.gfxTexture&&l.emissionTexture.gfxTexture.destroy(),l.occlusionTexture&&l.occlusionTexture.gfxTexture&&l.occlusionTexture.gfxTexture.destroy()));var l;if(f.children)for(const u of f.children)Vae(u)}function Dv(f,l){const u=f.json.bufferViews[l.bufferView],g=ZP[l.componentType];return new g(f.buffers[u.buffer],(l.byteOffset||0)+(u.byteOffset||0),l.count*(u.byteStride&&u.byteStride!==q3[l.type]*g.BYTES_PER_ELEMENT?u.byteStride/g.BYTES_PER_ELEMENT:q3[l.type]))}function Hae(f,l,u,g){const y=ZP[l.componentType],j=function(H){switch(H){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(y),N=f.json.bufferViews[l.bufferView],E=N.byteStride?N.byteStride/y.BYTES_PER_ELEMENT:q3[l.type],R=u.float32,B=R.length/u.capacity;for(let H=0,G=0;H0){for(let ke=0;ke0){j.texcoordArray=new pf;const X=l.json.accessors[y.TEXCOORD_0];j.texcoordArray.resize(X.count);const J=Dv(l,X);Hae(l,X,j.texcoordArray,J)}if(y._FEATURE_ID_RGBA4444!==void 0){const X=l.json.accessors[y._FEATURE_ID_RGBA4444];l.json.extensionsUsed&&l.json.extensionsUsed.includes("EXT_meshopt_compression")&&(j.featureData=Dv(l,X))}y._FEATURE_RGBA4444!==void 0&&(j.featureData=new Uint32Array(Dv(l,l.json.accessors[y._FEATURE_RGBA4444]).buffer));const G=f.material;return j.material=function(X,J){const{emissiveFactor:se=[0,0,0],alphaMode:pe="OPAQUE",alphaCutoff:ke=.5,normalTexture:we,occlusionTexture:Oe,emissiveTexture:ze,doubleSided:qe,name:dt}=X,{baseColorFactor:it=[1,1,1,1],metallicFactor:pt=1,roughnessFactor:wt=1,baseColorTexture:St,metallicRoughnessTexture:Gt}=X.pbrMetallicRoughness||{},Pt=Oe?J[Oe.index]:void 0;if(Oe&&Oe.extensions&&Oe.extensions.KHR_texture_transform&&Pt){const Jt=Oe.extensions.KHR_texture_transform;Pt.offsetScale=[Jt.offset[0],Jt.offset[1],Jt.scale[0],Jt.scale[1]]}return{name:dt,pbrMetallicRoughness:{baseColorFactor:new vi(...it),metallicFactor:pt,roughnessFactor:wt,baseColorTexture:St?J[St.index]:void 0,metallicRoughnessTexture:Gt?J[Gt.index]:void 0},doubleSided:qe,emissiveFactor:new vi(...se),alphaMode:pe,alphaCutoff:ke,normalTexture:we?J[we.index]:void 0,occlusionTexture:Pt,emissionTexture:ze?J[ze.index]:void 0,defined:X.defined===void 0}}(G!==void 0?l.json.materials[G]:{defined:!1},u),j}function X1e(f,l,u){const{matrix:g,rotation:y,translation:j,scale:N,mesh:E,extras:R,children:B,name:H}=f,G={};if(G.name=H,G.localMatrix=g||function(X,J,se,pe){var ke=J[0],we=J[1],Oe=J[2],ze=J[3],qe=ke+ke,dt=we+we,it=Oe+Oe,pt=ke*qe,wt=ke*dt,St=ke*it,Gt=we*dt,Pt=we*it,Jt=Oe*it,or=ze*qe,lr=ze*dt,gr=ze*it,yr=pe[0],hr=pe[1],fr=pe[2];return X[0]=(1-(Gt+Jt))*yr,X[1]=(wt+gr)*yr,X[2]=(St-lr)*yr,X[3]=0,X[4]=(wt-gr)*hr,X[5]=(1-(pt+Jt))*hr,X[6]=(Pt+or)*hr,X[7]=0,X[8]=(St+lr)*fr,X[9]=(Pt-or)*fr,X[10]=(1-(pt+Gt))*fr,X[11]=0,X[12]=se[0],X[13]=se[1],X[14]=se[2],X[15]=1,X}([],y||[0,0,0,1],j||[0,0,0],N||[1,1,1]),G.globalMatrix=S(G.localMatrix),E!==void 0){G.meshes=u[E];const X=G.anchor=[0,0];for(const J of G.meshes){const{min:se,max:pe}=J.aabb;X[0]+=se[0]+pe[0],X[1]+=se[1]+pe[1]}X[0]=Math.floor(X[0]/G.meshes.length/2),X[1]=Math.floor(X[1]/G.meshes.length/2)}if(R&&(R.id&&(G.id=R.id),R.lights&&(G.lights=function(X){if(!X.length)return[];const J=function(Oe){const ze=atob(Oe),qe=new Uint8Array(ze.length);for(let dt=0;dt1&&g[g.length-1].equals(g[0])&&g.pop();let y=0;for(let N=0;N0&&g.reverse();const j=gN(g.flatMap(N=>[N.x,N.y]),[]);return j.length===0?null:{vertices:g,indices:j}}function qUe(f,l){const u=[],g=[];let y=0;const j=[];for(const N of f){y=u.length;const E=N.vertexArray.float32,R=N.indexArray.uint16;for(let B=0;B0&&([g[N+1],g[N+2]]=[g[N+2],g[N+1]])}return{vertices:u,indices:g}}function Wae(f){const l=function(R,B){const H=[],G=WebGL2RenderingContext;if(R.json.textures)for(const X of R.json.textures){const J={magFilter:G.LINEAR,minFilter:G.NEAREST,wrapS:G.REPEAT,wrapT:G.REPEAT};X.sampler!==void 0&&Object.assign(J,R.json.samplers[X.sampler]),H.push({image:B[X.source],sampler:J,uploaded:!1})}return H}(f,f.images),u=function(R,B){const H=[];for(const G of R.json.meshes){const X=[];for(const J of G.primitives)X.push(BUe(J,R,B));H.push(X)}return H}(f,l),{scenes:g,scene:y,nodes:j}=f.json,N=g?g[y||0].nodes:[...j.keys()],E=[];for(const R of N)E.push(X1e(j[R],f,u));return function(R,B,H){const G={},X=new Set;for(let J=0;J0){const J=Array.from(X.values()).sort((se,pe)=>se-pe);for(let se=J.length-1;se>=0;se--)R.splice(J[se],1)}}(E,N,f.json.nodes),E}function VUe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const l=f.vertexArray.float32,u=f.aabb.min[0]-1,g=f.aabb.min[1]-1,y=Ov/(f.aabb.max[0]-u+2),j=Ov/(f.aabb.max[1]-g+2);for(let N=0;Nf.heightmap[B*Ov+R]&&(f.heightmap[B*Ov+R]=E)}}function Q1e(f,l,u,g,y){u.reserve(u.length+4*f.length),g.reserve(g.length+10*f.length),y.reserve(y.length+10*f.length);let j=g.length;for(const N of f){const E=Math.min(10,Math.max(4,1.3*N.height))*l,R=[-N.normal[1],N.normal[0],0],B=Math.min(.29,.1*N.width/N.depth),H=N.width-2*N.depth*l*(B+.01),G=Ne([],N.pos,R,H/2),X=Ne([],N.pos,R,-H/2),J=[G[0],G[1],G[2]+N.height],se=[X[0],X[1],X[2]+N.height],pe=Ne([],N.normal,R,B);ae(pe,pe,E);const ke=Ne([],N.normal,R,-B);ae(ke,ke,E),fe(pe,G,pe),fe(ke,X,ke),G[2]+=.1,X[2]+=.1,g.emplaceBack(pe[0],pe[1],pe[2]),g.emplaceBack(ke[0],ke[1],ke[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(J[0],J[1],J[2]),g.emplaceBack(se[0],se[1],se[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(pe[0],pe[1],pe[2]),g.emplaceBack(ke[0],ke[1],ke[2]);const we=H/E/2;y.emplaceBack(-we-B,-1,we,.8),y.emplaceBack(we+B,-1,we,.8),y.emplaceBack(-we,0,we,1.3),y.emplaceBack(we,0,we,1.3),y.emplaceBack(we+B,-.8,we,.7),y.emplaceBack(we+B,-.8,we,.7),y.emplaceBack(0,0,we,1.3),y.emplaceBack(0,0,we,1.3),y.emplaceBack(we+B,-1.2,we,.8),y.emplaceBack(we+B,-1.2,we,.8),u.emplaceBack(6+j,4+j,8+j),u.emplaceBack(7+j,9+j,5+j),u.emplaceBack(0+j,1+j,2+j),u.emplaceBack(1+j,3+j,2+j),j+=10}}function HUe(f,l){const u={};u.indexArray=new Ro,u.vertexArray=new au,u.colorArray=new Dm,Q1e(f,l,u.indexArray,u.vertexArray,u.colorArray);const g={defined:!0};g.emissiveFactor=vi.black;const y={};return y.baseColorFactor=vi.white,g.pbrMetallicRoughness=y,u.material=g,u.aabb=new on([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}const J1e=Ss([{name:"a_pos_3f",components:3,type:"Float32"}]),WUe=Ss([{name:"a_normal_3",components:3,type:"Int16"}]),GUe=Ss([{name:"a_centroid_3",components:3,type:"Int16"}]),eve=Ss([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),KUe=Ss([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),ZUe=Ss([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),YUe=Ss([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),XUe=Ss([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),QUe=Ss([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),tve=Tt.types,r6=32767;function JUe(f,l){const u=Mr+l;for(const g of f)for(const y of g)if(y.x<-l||y.x>u||y.y<-l||y.y>u)return!1;return!0}function eqe(f){switch(f){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${f}`)}}class Gae{constructor(){this.layoutVertexArray=new au,this.layoutAttenuationArray=new Dm,this.layoutColorArray=new ou,this.indexArray=new Ro,this.indexArrayForConflation=new Ro,this.segmentsBucket=new ka}}class Kae{constructor(l){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new ka,this.entranceBloom=new Gae;const u=66560;this.layoutVertexArray=new au,this.layoutVertexArray.reserve(u),this.layoutNormalArray=new Ty,this.layoutNormalArray.reserve(u),this.layoutCentroidArray=new Ty,this.layoutCentroidArray.reserve(u),this.layoutColorArray=new ou,this.layoutColorArray.reserve(u),this.layoutFloodLightDataArray=new Rm,this.layoutFloodLightDataArray.reserve(u),this.layoutAOArray=new sN,this.layoutAOArray.reserve(u),this.indexArray=new Ro,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ro,this.segmentsBucket=new ka,this.entranceBloom=new Gae,l&&(this.layoutFacadePaintArray=new ou,this.layoutFacadeDataArray=new Yg,this.layoutFacadeVerticalRangeArray=new ou)}reserve(l,u,g){this.layoutVertexArray.reserveForAdditional(l),this.layoutCentroidArray.reserveForAdditional(l),this.layoutFloodLightDataArray.reserveForAdditional(l),this.layoutNormalArray.reserveForAdditional(l),this.layoutAOArray.reserveForAdditional(l),this.layoutColorArray.reserveForAdditional(l),this.indexArray.reserveForAdditional(u),g&&(this.layoutFacadePaintArray.reserveForAdditional(l),this.layoutFacadeDataArray.reserveForAdditional(l),this.layoutFacadeVerticalRangeArray.reserveForAdditional(l))}}class rve{constructor(l){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new pf,this.footprintsIndices=new Rm,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Kae(!1),this.buildingWithFacade=new Kae(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=l.zoom,this.canonical=l.canonical,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.worldview=l.worldview,this.lut=l.lut,this.programConfigurations=new kh(l.layers,{zoom:l.zoom,lut:l.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=l.projection,this.groundEffect=new Aae(l),this.groundEffect.groundRadiusArray=new xp,this.hasAppearances=null}updateFootprints(l,u){const g=new $P([],[],1),y={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};u.push({footprint:y,id:l})}updateAppearances(l,u,g,y){}prepare(){return function(){if(KP!=null||D1e!=null)return null;if(bN!=null)return bN;const l=fetch(ks.BUILDING_GEN_URL);return bN=function(u){let g,y,j,N,E;function R(){g=new Uint8Array(E.buffer),y=new Int16Array(E.buffer),j=new Int32Array(E.buffer),N=new Float32Array(E.buffer)}function B(){throw new Error("Unexpected BuildingGen error.")}const H=()=>{},G={a:{a:B,f:function(X){const J=g.length,se=Math.max(X>>>0,Math.ceil(1.2*J)),pe=Math.ceil((se-J)/65536);try{return E.grow(pe),R(),!0}catch{return!1}},g:B,b:H,c:H,d:H,e:H}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,G):u.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,G))).then(X=>{const J=X.instance.exports;return(0,J.g)(),E=J.f,R(),new NUe({setStyle:J.h,setAOOptions:J.i,setMetricOptions:J.j,setStructuralOptions:J.k,setFacadeOptions:J.l,setFauxFacadeOptions:J.m,setFacadeClassifierOptions:J.n,addFeature:J.o,addFacade:J.p,generateMesh:J.q,getLastError:J.r,getOuterRingLength:J.s,getMeshCount:J.t,getPositionsPtr:J.u,getPositionsLength:J.v,getNormalsPtr:J.w,getNormalsLength:J.x,getAOPtr:J.y,getAOLength:J.z,getUVPtr:J.A,getUVLength:J.B,getFauxFacadePtr:J.C,getFauxFacadeLength:J.D,getIndicesPtr:J.E,getIndicesLength:J.F,getBuildingPart:J.G,getRingCount:J.H,getRingPtr:J.I,getRingLength:J.J,malloc:J.K,free:J.L,heapU8:g,heap16:y,heap32:j,heapF32:N})})}(l).then(u=>(bN=null,KP=u,KP)).catch(u=>{$r("Could not load building-gen"),bN=null,D1e=u}),bN}()}populate(l,u,g,y){const j=SUe();if(!j)return;const N=Ee(g);this.tileToMeter=N,this.brightness=u.brightness,j.setStyle({normalScale:[1,-1,N],tileToMeters:N}),j.setAOOptions(!1,.3),j.setMetricOptions(!1,16),j.setStructuralOptions(!0),j.setFacadeClassifierOptions(3);const E=new Map,R=new Map;let B=0;for(const{feature:we}of l){if(tve[we.type]!=="LineString"){E.set(we.id,we.properties.source_id);continue}const Oe=this.layers[0]._featureFilter.needGeometry;if(Oe&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),we,g))continue;const ze=It(we,Oe);if(!Oe&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),ze,g))continue;const qe=Oe?ze.geometry:_t(we,g,y),dt=[];for(const St of qe)for(const Gt of St)dt.push(Gt.x),dt.push(Gt.y);const it={coordinates:dt,crossPerc:we.properties.cross_perc,distanceToRoad:we.properties.distance_to_road,entrances:we.properties.entrances,sourceId:0},pt=we.properties.source_id;let wt=R.get(pt);wt||(wt=[],R.set(pt,wt)),wt.push(it),++B}this.maxHeight=0;const H=new Array,G=new Set,X=we=>{we!=null&&G.add(we)},J=(we,Oe)=>{we!=null&&H.push({buildingId:we,footprintIndex:Oe})},se=64*(l.length-B),pe=se/2;this.buildingWithFacade.reserve(se,pe,!0),this.buildingWithoutFacade.reserve(2*se,2*pe,!1),this.footprintsIndices.reserve(16*(l.length-B)),this.footprintsVertices.reserve(8*(l.length-B));for(const{feature:we,id:Oe,index:ze,sourceLayerIndex:qe}of l){if(tve[we.type]==="LineString")continue;const dt=this.layers[0]._featureFilter.needGeometry;if(dt&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),we,g))continue;let it=null;if(we.properties&&we.properties.hasOwnProperty("building_id")&&(it=we.properties.building_id,G.has(it)))continue;const pt=It(we,dt);if(!dt&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),pt,g))continue;const wt=dt?pt.geometry:_t(we,g,y),St=L3(wt,500);let Gt=!1;for(const En of St)if(En.length!==1){Gt=!0;break}if(Gt){X(it);continue}if(!JUe(wt,163)){X(it);continue}const Pt=this.layers[0],Jt=eqe(Pt.layout.get("building-roof-shape").evaluate(we,{},g)),or=Pt.layout.get("building-base").evaluate(we,{},g),lr=Pt.layout.get("building-height").evaluate(we,{},g),gr=Pt.layout.get("building-flood-light-ground-radius").evaluate(we,{},g),yr=Pt.paint.get("building-ambient-occlusion-intensity"),hr=gr/this.tileToMeter;we.properties["building-part"]="roof";const fr=Pt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),Qt=Pt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);we.properties["building-part"]="wall";const Kt=Pt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),pr=Pt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);we.properties["building-part"]="window";const Tr=Pt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),jr=Pt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);we.properties["building-part"]="door";const dn=Pt.paint.get("building-color").evaluate(we,{},this.canonical).toPremultipliedRenderColor(this.lut),Fr=Pt.paint.get("building-emissive-strength").evaluate(we,{},this.canonical);let Hr=Pt.layout.get("building-flood-light-wall-radius").evaluate(we,{},g);Hr=_e(Hr,0,2048);const tn=Hr/2048*r6,ms=E.get(Oe),kr=R.get(ms)||[],rn=kr.length!==0&&Pt.layout.get("building-facade").evaluate(we,{},g);j.setFacadeOptions(4,!0),j.setFauxFacadeOptions(rn,!1,1);let $n=0,Ps=0,zs=0,Jn=0,Pi=0,at=0,ut=0,er=0,xr=0,Lr=0,Or=0;if(rn){let En=Math.round(Pt.layout.get("building-facade-floors").evaluate(we,{},g));if(or===0){En=Math.max(1,En-(kr.length>0?1:0));let wi=4;if(lr>100){const ma=[10,13,15];wi=ma[we.id?we.id%ma.length:0]}else lr<=10&&(wi=3);j.setFacadeOptions(wi,!0),Pi=(lr<15?1.3:1.61803)*wi/N}else Pi=or/N;at=lr/N,Pi=Math.min(Pi,at),zs=Pt.layout.get("building-facade-unit-width").evaluate(we,{},g)/N,Jn=(at-Pi)/En,j.setFauxFacadeOptions(!0,!0,zs);const Ca=Pt.layout.get("building-facade-window").evaluate(we,{},g);$n=Ca[0],Ps=Ca[1],ut=Math.floor(65535*Math.min(1,Pi/Mr)),er=Math.floor(65535*Math.min(1,at/Mr)),xr=Math.floor(255*$n)<<8|Math.floor(255*Ps),Lr=Math.floor(65535*Math.min(1,zs/Mr)),Or=Math.floor(65535*Math.min(1,Jn/Mr))}const hn=Array(St.length),mn={x:1/0,y:1/0},Xn={x:-1/0,y:-1/0},as={x:0,y:0};let ps=0;for(let En=0;En0){const wi=[],ma=Array(Ca.length+1);ma[0]=0;for(let Bo=0;BoMr||mn.y<0||Xn.y>Mr)&&this.featuresOnBorder.push({featureId:we.id,footprintIndex:this.footprints.length});{const En=gN(zi,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+En.length),this.footprintsIndices.uint16.set(En,An),this.buildingIds.add(it??we.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Zi.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Zi.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ea.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ea.y);const Ca={footprintVertexOffset:Ms,footprintVertexLength:this.footprintsVertices.length-Ms,footprintIndexOffset:An,footprintIndexLength:this.footprintsIndices.length-An,min:Zi,max:ea,hiddenFlags:0,indicesOffset:gi,indicesLength:ba,bloomIndicesOffset:bi,bloomIndicesLength:qi,groundEffectVertexOffset:no,groundEffectVertexLength:Xi,hasFauxFacade:rn,height:ls,promoteId:Oe,feature:pt,parts:ni,buildingBloom:si},wi=this.footprints.length;we.id!==void 0&&this.featureFootprintLookup.set(we.id,wi),J(it,wi),this.footprints.push(Ca)}this.programConfigurations.populatePaintArrays(Pn.layoutVertexArray.length,we,ze,{},u.availableImages,g,u.brightness),this.groundEffect.addPaintPropertiesData(we,ze,{},u.availableImages,g,u.brightness),u.featureIndex.insert(we,wt,ze,qe,this.index,Li)}H.forEach(({buildingId:we,footprintIndex:Oe})=>{G.has(we)&&(this.footprints[Oe].hiddenFlags|=4)});const ke=new Set;this.buildingIds.forEach((we,Oe,ze)=>{G.has(we)||ke.add(we)}),this.buildingIds=ke,this.groundEffect.prepareBorderSegments()}update(l,u,g,y,j,N,E){this.programConfigurations.updatePaintArrays(l,u,j,g,y,N,E),this.groundEffect.update(l,u,j,g,y,N,E),this.evaluate(this.layers[0],l),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(l){const u=g=>{g.layoutVertexBuffer=l.createVertexBuffer(g.layoutVertexArray,J1e.members),g.layoutNormalBuffer=l.createVertexBuffer(g.layoutNormalArray,WUe.members),g.layoutCentroidBuffer=l.createVertexBuffer(g.layoutCentroidArray,GUe.members),g.layoutFloodLightDataBuffer=l.createVertexBuffer(g.layoutFloodLightDataArray,QUe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=l.createVertexBuffer(g.layoutFacadeDataArray,ZUe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=l.createVertexBuffer(g.layoutFacadeVerticalRangeArray,YUe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=l.createVertexBuffer(g.entranceBloom.layoutVertexArray,J1e.members),g.entranceBloom.layoutAttenuationBuffer=l.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,XUe.members)),this.uploadUpdatedColorBuffer(l),this.uploadUpdatedIndexBuffer(l)};this.uploaded||(u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.groundEffect.upload(l)),this.groundEffect.uploadPaintProperties(l),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){const l=u=>{u.layoutVertexBuffer&&(u.layoutVertexBuffer.destroy(),u.layoutNormalBuffer.destroy(),u.layoutColorBuffer.destroy(),u.segmentsBucket.destroy(),u.indexBuffer&&u.indexBuffer.destroy(),u.entranceBloom.layoutVertexBuffer&&(u.entranceBloom.layoutVertexBuffer.destroy(),u.entranceBloom.layoutColorBuffer.destroy(),u.entranceBloom.layoutAttenuationBuffer.destroy(),u.entranceBloom.indexBuffer.destroy(),u.entranceBloom.segmentsBucket.destroy()))};l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(l,u,g=!0){let y=!1;const j=g?u:0,N=0|(g?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const E of l){const R=this.footprints[E],B=R.hiddenFlags&N|j;R.hiddenFlags!==B&&(R.hiddenFlags=B,y=!0,this.groundEffect.updateHiddenByLandmarkRange(R.groundEffectVertexOffset,R.groundEffectVertexLength,R.hiddenFlags!==0))}return y&&(this.indexArrayForConflationUploaded=!1),y}uploadUpdatedIndexBuffer(l){if(this.groundEffect.uploadHiddenByLandmark(l),this.indexArrayForConflationUploaded)return;const u=y=>{y.indexArray.length!==0&&(y.indexArrayForConflation.resize(y.indexArray.length),y.indexArrayForConflation.uint16.set(y.indexArray.uint16),y.entranceBloom.indexArrayForConflation.resize(y.entranceBloom.indexArray.length),y.entranceBloom.indexArrayForConflation.uint16.set(y.entranceBloom.indexArray.uint16))};u(this.buildingWithoutFacade),u(this.buildingWithFacade);for(const y of this.footprints){const j=y.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,N=y.indicesOffset+y.indicesLength;if(y.hiddenFlags!==0){for(let R=y.indicesOffset;R{y.indexArray.length!==0&&(y.indexBuffer?y.indexBuffer.updateData(y.indexArrayForConflation):y.indexBuffer=l.createIndexBuffer(y.indexArrayForConflation,!0),y.entranceBloom.indexBuffer?y.entranceBloom.indexBuffer.updateData(y.entranceBloom.indexArrayForConflation):y.entranceBloom.indexBuffer=l.createIndexBuffer(y.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(l){const u=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=l.createVertexBuffer(g.layoutColorArray,eve.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=l.createVertexBuffer(g.layoutFacadePaintArray,KUe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=l.createVertexBuffer(g.entranceBloom.layoutColorArray,eve.members,!0)};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(l,u){const g=l.paint.get("building-ambient-occlusion-intensity");for(const y of this.footprints){if(4&y.hiddenFlags)continue;const j=u[y.promoteId],N=y.feature;N.properties["building-part"]="roof";const E=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),R=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical);N.properties["building-part"]="wall";const B=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),H=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical);N.properties["building-part"]="window";const G=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),X=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical);N.properties["building-part"]="door";const J=l.paint.get("building-color").evaluate(N,j,this.canonical).toPremultipliedRenderColor(this.lut),se=l.paint.get("building-emissive-strength").evaluate(N,j,this.canonical),pe=y.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const we of y.parts){let Oe,ze=E;we.part===1?(ze=E,Oe=R):we.part===0?(ze=B,Oe=H):we.part===2?(ze=G,Oe=X):we.part===3&&(ze=J,Oe=se),Oe=_e(Oe,0,1);for(let qe=0;qeN.max.x||R.max.xN.max.y||R.max.yE.max.x||E.min.x>l||u>E.max.y||E.min.y>u||E.height<=g||tqe(N,this.footprintsVertices.float32.subarray(2*E.footprintVertexOffset,2*(E.footprintVertexOffset+E.footprintVertexLength)),this.footprintsIndices.uint16.subarray(E.footprintIndexOffset,E.footprintIndexOffset+E.footprintIndexLength))&&(g=E.height,this.footprintLookup[j]=E,y=E.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:y};this.footprintLookup[j]=void 0}}function tqe(f,l,u){for(let g=0;g1&&(R=l[++E]);const H=Math.abs(B-R.left),G=Math.abs(B-R.right),X=Math.min(H,G);let J;const se=j/g*(y+1);if(R.isDash){const pe=y-Math.abs(se);J=Math.sqrt(X*X+pe*pe)}else J=y-Math.sqrt(X*X+se*se);this.image.data[N+B]=Math.max(0,Math.min(255,J+128))}}}addRegularDash(l,u){for(let R=l.length-1;R>=0;--R){const B=l[R],H=l[R+1];B.zeroLength?l.splice(R,1):H&&H.isDash===B.isDash&&(H.left=B.left,l.splice(R,1))}const g=l[0],y=l[l.length-1];g.isDash===y.isDash&&(g.left=y.left-this.width,y.right=g.right+this.width);const j=this.width*this.nextRow;let N=0,E=l[N];for(let R=0;R1&&(E=l[++N]);const B=Math.abs(R-E.left),H=Math.abs(R-E.right),G=Math.min(B,H);this.image.data[j+R]=Math.max(0,Math.min(255,(E.isDash?G:-G)+u+128))}}addDash(l,u){const g=this.getKey(l,u);if(this.positions[g])return this.positions[g];const y=u==="round",j=y?7:0,N=2*j+1;if(this.nextRow+N>this.height)return $r("LineAtlas out of space"),null;l.length===0&&l.push(1);let E=0;for(let H=0;Hu.fqid),this.index=l.index,this.projection=l.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new Xk,this.layoutVertexArray2=new au,this.patternVertexArray=new au,this.indexArray=new Ro,this.programConfigurations=new kh(l.layers,{zoom:l.zoom,lut:l.lut}),this.segments=new ka,this.maxLineLength=0,this.zOffsetVertexArray=new au,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=l.tessellationStep?l.tessellationStep:Mr/64,this.worldview=l.worldview,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,y){}populate(l,u,g,y){this.hasPattern=bae("line",this.layers,this.pixelRatio,u);const j=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Ee(g);const N=this.layers[0].layout.get("line-elevation-reference");if(N==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),J=X.isConstant()&&!X.constantOr(0);this.elevationType=N!=="sea"&&N!=="ground"&&J?"none":"offset",this.elevationType==="offset"&&N==="none"&&$r(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const E=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&E!==void 0;const R=[];for(const{feature:X,id:J,index:se,sourceLayerIndex:pe}of l){const ke=this.layers[0]._featureFilter.needGeometry,we=It(X,ke);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),we,g))continue;const Oe=j?j.evaluate(we,{},g):void 0,ze={id:J,properties:X.properties,type:X.type,sourceLayerIndex:pe,index:se,geometry:ke?we.geometry:_t(X,g,y),patterns:{},sortKey:Oe};R.push(ze)}j&&R.sort((X,J)=>X.sortKey-J.sortKey);const{lineAtlas:B,featureIndex:H}=u,G=this.addConstantDashes(B);for(const X of R){const{geometry:J,index:se,sourceLayerIndex:pe}=X;if(G&&this.addFeatureDashes(X,B),this.hasPattern){const ke=wae("line",this.layers,X,this.zoom,this.pixelRatio,u);this.patternFeatures.push(ke)}else this.addFeature(X,J,se,g,B.positions,u.availableImages,u.brightness,u.elevationFeatures);H.insert(l[se].feature,J,se,pe,this.index)}}addConstantDashes(l){let u=!1;for(const g of this.layers){const y=g.paint.get("line-dasharray").value,j=g.layout.get("line-cap").value;if(y.kind!=="constant"||j.kind!=="constant")u=!0;else{const N=j.value,E=y.value;if(!E)continue;l.addDash(E,N)}}return u}addFeatureDashes(l,u){const g=this.zoom;for(const y of this.layers){const j=y.paint.get("line-dasharray").value,N=y.layout.get("line-cap").value;if(j.kind==="constant"&&N.kind==="constant")continue;let E,R;if(j.kind==="constant"){if(E=j.value,!E)continue}else E=j.evaluate({zoom:g},l);R=N.kind==="constant"?N.value:N.evaluate({zoom:g},l),u.addDash(E,R),l.patterns[y.id]=[u.getKey(E,R)]}}update(l,u,g,y,j,N,E,R){this.programConfigurations.updatePaintArrays(l,u,j,g,y,N,E,R)}addFeatures(l,u,g,y,j,N){for(const E of this.patternFeatures)this.addFeature(E,E.geometry,E.index,u,g,y,N,l.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,oqe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=l.createVertexBuffer(this.patternVertexArray,cqe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=l.createVertexBuffer(this.zOffsetVertexArray,sqe.members,!0)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,iqe),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l,u){let g,y;if(u&&u>0?(g=`mapbox_clip_start_${u}`,y=`mapbox_clip_end_${u}`):(g="mapbox_clip_start",y="mapbox_clip_end"),l.properties&&l.properties.hasOwnProperty(g)&&l.properties.hasOwnProperty(y))return{start:+l.properties[g],end:+l.properties[y]}}addFeature(l,u,g,y,j,N,E,R){const B=this.layers[0].layout,H=B.get("line-join").evaluate(l,{}),G=B.get("line-cap").evaluate(l,{}),X=B.get("line-miter-limit"),J=B.get("line-round-limit");this.lineClips=this.lineFeatureClips(l),this.lineFeature=l;const se=!(!l.properties||!l.properties.hasOwnProperty("mapbox_line_metrics"))&&l.properties.mapbox_line_metrics;this.zOffsetValue=B.get("line-z-offset").value;const pe=this.layers[0].paint.get("line-width").value;if(pe.kind!=="constant"&&pe.isLineProgressConstant===!1&&(this.variableWidthValue=pe),this.elevationType==="road"){const ke=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(l,u,y,R,H,G,X,J)){const[we,Oe]=this.clipRuntimeLinesToTile(u,1);for(let ze=0;ze0?dt.parentIndex:null)}this.fillNonElevatedRoadSegment(ke)}}else for(let ke=0;ke0?ke:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,g,j,N,y,E,void 0,this.worldview)}computeSegNextDir(l,u){return l.nextPoint.sub(u.at(-2)).unit()}computeSegPrevDir(l,u){return u[1].sub(l.prevPoint).unit()}clipLinesToTile(l,u){return WP(l,-u,-u,Mr+u,Mr+u)}clipRuntimeLinesToTile(l,u){const g=[];return[WP(l,-u,-u,Mr+u,Mr+u,g),g]}addElevatedRoadFeature(l,u,g,y,j,N,E,R){const B=[],H=pi.getElevationFeature(l,y);if(H){const G=this.clipLinesToTile(u,1),X=this.prepareElevatedLines(G,H,g);for(const J of X)B.push({geometry:J,elevation:H,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(B.length===0)return!1;for(const G of B){const X=this.layoutVertexArray.length;this.addLine(G.geometry,l,g,j,N,E,R);const J=new Ai(g,G.elevationTileID);if(G.elevation)for(let se=X;se>1,this.layoutVertexArray.int16[6*se+1]>>1),ke=J.pointElevation(pe,G.elevation,.05);this.updateHeightRange(ke),this.zOffsetVertexArray.emplaceBack(ke,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(l,u,g){if(u.constantHeight!=null)return l;const y=[],j=1/Ee(g);for(const N of l)wUe(N,new ri(u,j),0,y);return y}fillNonElevatedRoadSegment(l){for(let u=l;u0,X=R&&R.progress.max<1;if(this.lineClips){let St={min:this.lineClips.start,max:this.lineClips.end},Gt=1;if(R){const or=this.lineClips.end-this.lineClips.start;St=function(lr,gr,yr){return{min:Fi(lr.min,gr,yr),max:Fi(lr.max,gr,yr)}}(R.progress,{min:0,max:1},St),or>0&&(Gt=(St.max-St.min)/or)}const Pt=+u.properties.mapbox_clip_feature_len,Jt=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(Pt)||Number.isNaN(Jt)){for(let lr=0;lr=2&&l[se-1].equals(l[se-2]);)se--;let pe=0;for(;pe0,Qt=this.overscaling<=16?15*Mr/(512*this.overscaling):0;if(Gt&&Pt==="round"){if(grN&&(Pt="bevel"),Pt==="bevel"&&(gr>2&&(Pt="flipbevel"),gr2*Qt){const Tr=we.sub(we.sub(Oe)._mult(Qt/Kt)._round());this.updateDistance(Oe,Tr),this.addCurrentVertex(Tr,qe,0,0,ke,wt),Oe=Tr}this.updateDistance(Oe,we),or._mult(gr),this.addCurrentVertex(we,or,0,0,ke,wt);const pr=we.dist(ze);if(pr>2*Qt){const Tr=we.add(ze.sub(we)._mult(Qt/pr)._round());this.updateDistance(we,Tr),this.addCurrentVertex(Tr,dt,0,0,ke,wt),we=Tr}}else or._mult(gr),this.addCurrentVertex(we,or,0,0,ke,wt);else if(Pt==="flipbevel"){if(gr>100)or=dt.mult(-1);else{const Kt=gr*qe.add(dt).mag()/qe.sub(dt).mag();or._perp()._mult(Kt*(fr?-1:1))}this.addCurrentVertex(we,or,0,0,ke,wt),this.addCurrentVertex(we,or.mult(-1),0,0,ke,wt)}else if(Pt==="bevel"||Pt==="fakeround"){wt!=null&&Oe&&this.addCurrentVertex(we,pt||qe,-1,-1,ke,wt);const Kt=we.dist(Oe)<=2*Qt&&Pt!=="bevel",pr=or.mult(fr?1:-1);pr._mult(gr);const Tr=dt.mult(fr?-1:1),jr=qe.mult(fr?-1:1),dn=this.evaluateLineProgressFeatures(this.distance);if(wt==null&&(this.addHalfVertex(we,pr.x,pr.y,!1,!fr,0,ke,dn),Kt||this.addHalfVertex(we,pr.x+2*jr.x,pr.y+2*jr.y,!1,fr,0,ke,dn)),Pt==="fakeround"){const Fr=Math.round(180*yr/Math.PI/20);this.addHalfVertex(we,jr.x,jr.y,!1,fr,0,ke,dn);for(let Hr=0;Hr1){this.lineSoFar=l.w;const pe=(u.x-l.x)/G,ke=(u.y-l.y)/G,we=(u.z-l.z)/G,Oe=(u.w-l.w)/G;for(let ze=1;ze=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,H),R.primitiveLength++),N?this.e2=H:this.e1=H,B!=null&&this.zOffsetVertexArray.emplaceBack(B.zOffset,B.variableWidth,B.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(l,u){this.prevDistance=this.distance,this.distance+=l.dist(u),this.updateScaledDistance()}}function Yae(f,l,u){return f.xu||f.yu}let ave,ove;function lve(f,l,u){return l*(Mr/(f.tileSize*Math.pow(2,u-f.tileID.overscaledZ)))}Xr(Zae,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const cve=(f,l,u)=>(1-u)*f+u*l;function dve(f,l){return 1/lve(f,1,l.tileZoom)}function uve(f,l,u,g){return f.translatePosMatrix(g||l.tileID.projMatrix,l,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const hve=f=>{const l=[];fve(f)&&l.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&l.push("RENDER_LINE_GRADIENT");const u=f.paint.get("line-trim-offset");u[0]===0&&u[1]===0||l.push("RENDER_LINE_TRIM_OFFSET"),f.paint.get("line-border-width").constantOr(1)!==0&&l.push("RENDER_LINE_BORDER");const g=f.layout.get("line-join").constantOr("miter")==="none",y=!!f.paint.get("line-pattern").constantOr(1);return g&&y&&l.push("LINE_JOIN_NONE"),l};function fve(f){const l=f.paint.get("line-dasharray").value;return l.kind!=="constant"||l.value}let Xae;const pve=()=>Xae||(Xae={layout:ave||(ave=new Fa({"line-cap":new Ir(Rt.layout_line["line-cap"]),"line-join":new Ir(Rt.layout_line["line-join"]),"line-miter-limit":new Nr(Rt.layout_line["line-miter-limit"]),"line-round-limit":new Nr(Rt.layout_line["line-round-limit"]),"line-sort-key":new Ir(Rt.layout_line["line-sort-key"]),"line-z-offset":new Ir(Rt.layout_line["line-z-offset"]),"line-elevation-reference":new Nr(Rt.layout_line["line-elevation-reference"]),"line-cross-slope":new Nr(Rt.layout_line["line-cross-slope"]),visibility:new Nr(Rt.layout_line.visibility),"line-width-unit":new Nr(Rt.layout_line["line-width-unit"])})),paint:ove||(ove=new Fa({"line-opacity":new Ir(Rt.paint_line["line-opacity"]),"line-color":new Ir(Rt.paint_line["line-color"]),"line-translate":new Nr(Rt.paint_line["line-translate"]),"line-translate-anchor":new Nr(Rt.paint_line["line-translate-anchor"]),"line-width":new Ir(Rt.paint_line["line-width"]),"line-gap-width":new Ir(Rt.paint_line["line-gap-width"]),"line-offset":new Ir(Rt.paint_line["line-offset"]),"line-blur":new Ir(Rt.paint_line["line-blur"]),"line-dasharray":new Ir(Rt.paint_line["line-dasharray"]),"line-pattern":new Ir(Rt.paint_line["line-pattern"]),"line-pattern-cross-fade":new Nr(Rt.paint_line["line-pattern-cross-fade"]),"line-gradient":new Gg(Rt.paint_line["line-gradient"]),"line-trim-offset":new Nr(Rt.paint_line["line-trim-offset"]),"line-trim-fade-range":new Nr(Rt.paint_line["line-trim-fade-range"]),"line-trim-color":new Nr(Rt.paint_line["line-trim-color"]),"line-emissive-strength":new Ir(Rt.paint_line["line-emissive-strength"]),"line-border-width":new Ir(Rt.paint_line["line-border-width"]),"line-border-color":new Ir(Rt.paint_line["line-border-color"]),"line-occlusion-opacity":new Nr(Rt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"})}))},Xae);class fqe extends Ir{possiblyEvaluate(l,u){return u=new Ji(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(l,u)}evaluate(l,u,g,y){return u=Object.assign({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(l,u,g,y)}}let W3;function mve(f,l){return l>0?l+2*f:f}const pqe=Ss([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),mqe=Ss([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),gqe=Ss([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ss([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const xqe=Ss([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),yqe=Ss([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),vqe=Ss([{name:"a_texb",components:2,type:"Uint16"}]),_qe=Ss([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),bqe=Ss([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Ss([{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 gve=Ss([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),wqe=Ss([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ss([{name:"triangle",components:3,type:"Uint16"}]),Ss([{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"}]),Ss([{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"}]),Ss([{type:"Float32",name:"offsetX"}]),Ss([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var ul=24;function jqe(f,l,u){return f.sections.forEach(g=>{g.text=function(y,j,N){const E=j.layout.get("text-transform").evaluate(N,{});return E==="uppercase"?y=y.toLocaleUpperCase():E==="lowercase"&&(y=y.toLocaleLowerCase()),gp.applyArabicShaping&&(y=gp.applyArabicShaping(y)),y}(g.text,l,u)}),f}const G3={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function kqe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function Nqe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const Qae=4294967296,xve=1/Qae,yve=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let n6=class{constructor(f=new Uint8Array(16)){this.buf=ArrayBuffer.isView(f)?f:new Uint8Array(f),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(f,l,u=this.length){for(;this.pos>3,j=this.pos;this.type=7&g,f(y,l,this),this.pos===j&&this.skip(g)}return l}readMessage(f,l){return this.readFields(f,l,this.readVarint()+this.pos)}readFixed32(){const f=this.dataView.getUint32(this.pos,!0);return this.pos+=4,f}readSFixed32(){const f=this.dataView.getInt32(this.pos,!0);return this.pos+=4,f}readFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Qae;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Qae;return this.pos+=8,f}readFloat(){const f=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,f}readDouble(){const f=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,f}readVarint(f){const l=this.buf;let u,g;return g=l[this.pos++],u=127&g,g<128?u:(g=l[this.pos++],u|=(127&g)<<7,g<128?u:(g=l[this.pos++],u|=(127&g)<<14,g<128?u:(g=l[this.pos++],u|=(127&g)<<21,g<128?u:(g=l[this.pos],u|=(15&g)<<28,function(y,j,N){const E=N.buf;let R,B;if(B=E[N.pos++],R=(112&B)>>4,B<128||(B=E[N.pos++],R|=(127&B)<<3,B<128)||(B=E[N.pos++],R|=(127&B)<<10,B<128)||(B=E[N.pos++],R|=(127&B)<<17,B<128)||(B=E[N.pos++],R|=(127&B)<<24,B<128)||(B=E[N.pos++],R|=(1&B)<<31,B<128))return jN(y,R,j);throw new Error("Expected varint not more than 10 bytes")}(u,f,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const f=this.readVarint();return f%2==1?(f+1)/-2:f/2}readBoolean(){return!!this.readVarint()}readString(){const f=this.readVarint()+this.pos,l=this.pos;return this.pos=f,f-l>=12&&yve?yve.decode(this.buf.subarray(l,f)):function(u,g,y){let j="",N=g;for(;N239?4:E>223?3:E>191?2:1;if(N+X>y)break;X===1?E<128&&(G=E):X===2?(R=u[N+1],(192&R)==128&&(G=(31&E)<<6|63&R,G<=127&&(G=null))):X===3?(R=u[N+1],B=u[N+2],(192&R)==128&&(192&B)==128&&(G=(15&E)<<12|(63&R)<<6|63&B,(G<=2047||G>=55296&&G<=57343)&&(G=null))):X===4&&(R=u[N+1],B=u[N+2],H=u[N+3],(192&R)==128&&(192&B)==128&&(192&H)==128&&(G=(15&E)<<18|(63&R)<<12|(63&B)<<6|63&H,(G<=65535||G>=1114112)&&(G=null))),G===null?(G=65533,X=1):G>65535&&(G-=65536,j+=String.fromCharCode(G>>>10&1023|55296),G=56320|1023&G),j+=String.fromCharCode(G),N+=X}return j}(this.buf,l,f)}readBytes(){const f=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,f);return this.pos=f,l}readPackedVarint(f=[],l){const u=this.readPackedEnd();for(;this.pos127;);else if(l===2)this.pos=this.readVarint()+this.pos;else if(l===5)this.pos+=4;else{if(l!==1)throw new Error(`Unimplemented type: ${l}`);this.pos+=8}}writeTag(f,l){this.writeVarint(f<<3|l)}realloc(f){let l=this.length||16;for(;l268435455||f<0?function(l,u){let g,y;if(l>=0?(g=l%4294967296|0,y=l/4294967296|0):(g=~(-l%4294967296),y=~(-l/4294967296),4294967295^g?g=g+1|0:(g=0,y=y+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),function(j,N,E){E.buf[E.pos++]=127&j|128,j>>>=7,E.buf[E.pos++]=127&j|128,j>>>=7,E.buf[E.pos++]=127&j|128,j>>>=7,E.buf[E.pos++]=127&j|128,E.buf[E.pos]=127&(j>>>=7)}(g,0,u),function(j,N){const E=(7&j)<<4;N.buf[N.pos++]|=E|((j>>>=3)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j|((j>>>=7)?128:0),j&&(N.buf[N.pos++]=127&j)))))}(y,u)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))}writeSVarint(f){this.writeVarint(f<0?2*-f-1:2*f)}writeBoolean(f){this.writeVarint(+f)}writeString(f){f=String(f),this.realloc(4*f.length),this.pos++;const l=this.pos;this.pos=function(g,y,j){for(let N,E,R=0;R55295&&N<57344){if(!E){N>56319||R+1===y.length?(g[j++]=239,g[j++]=191,g[j++]=189):E=N;continue}if(N<56320){g[j++]=239,g[j++]=191,g[j++]=189,E=N;continue}N=E-55296<<10|N-56320|65536,E=null}else E&&(g[j++]=239,g[j++]=191,g[j++]=189,E=null);N<128?g[j++]=N:(N<2048?g[j++]=N>>6|192:(N<65536?g[j++]=N>>12|224:(g[j++]=N>>18|240,g[j++]=N>>12&63|128),g[j++]=N>>6&63|128),g[j++]=63&N|128)}return j}(this.buf,f,this.pos);const u=this.pos-l;u>=128&&vve(l,u,this),this.pos=l-1,this.writeVarint(u),this.pos+=u}writeFloat(f){this.realloc(4),this.dataView.setFloat32(this.pos,f,!0),this.pos+=4}writeDouble(f){this.realloc(8),this.dataView.setFloat64(this.pos,f,!0),this.pos+=8}writeBytes(f){const l=f.length;this.writeVarint(l),this.realloc(l);for(let u=0;u=128&&vve(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g}writeMessage(f,l,u){this.writeTag(f,2),this.writeRawMessage(l,u)}writePackedVarint(f,l){l.length&&this.writeMessage(f,Sqe,l)}writePackedSVarint(f,l){l.length&&this.writeMessage(f,Cqe,l)}writePackedBoolean(f,l){l.length&&this.writeMessage(f,Aqe,l)}writePackedFloat(f,l){l.length&&this.writeMessage(f,Mqe,l)}writePackedDouble(f,l){l.length&&this.writeMessage(f,Tqe,l)}writePackedFixed32(f,l){l.length&&this.writeMessage(f,Eqe,l)}writePackedSFixed32(f,l){l.length&&this.writeMessage(f,Iqe,l)}writePackedFixed64(f,l){l.length&&this.writeMessage(f,Pqe,l)}writePackedSFixed64(f,l){l.length&&this.writeMessage(f,Lqe,l)}writeBytesField(f,l){this.writeTag(f,2),this.writeBytes(l)}writeFixed32Field(f,l){this.writeTag(f,5),this.writeFixed32(l)}writeSFixed32Field(f,l){this.writeTag(f,5),this.writeSFixed32(l)}writeFixed64Field(f,l){this.writeTag(f,1),this.writeFixed64(l)}writeSFixed64Field(f,l){this.writeTag(f,1),this.writeSFixed64(l)}writeVarintField(f,l){this.writeTag(f,0),this.writeVarint(l)}writeSVarintField(f,l){this.writeTag(f,0),this.writeSVarint(l)}writeStringField(f,l){this.writeTag(f,2),this.writeString(l)}writeFloatField(f,l){this.writeTag(f,5),this.writeFloat(l)}writeDoubleField(f,l){this.writeTag(f,1),this.writeDouble(l)}writeBooleanField(f,l){this.writeVarintField(f,+l)}};function jN(f,l,u){return u?4294967296*l+(f>>>0):4294967296*(l>>>0)+(f>>>0)}function vve(f,l,u){const g=l<=16383?1:l<=2097151?2:l<=268435455?3:Math.floor(Math.log(l)/(7*Math.LN2));u.realloc(g);for(let y=u.pos-1;y>=f;y--)u.buf[y+g]=u.buf[y]}function Sqe(f,l){for(let u=0;u=0&&g>=l&&s6[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(l,u),this.sectionIndex=this.sectionIndex.slice(l,u)}substring(l,u){const g=new kN;return g.text=this.text.substring(l,u),g.sectionIndex=this.sectionIndex.slice(l,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((l,u)=>Math.max(l,this.sections[u].scale),0)}addTextSection(l,u){this.text+=l.text,this.sections.push(K3.forText(l.scale,l.fontStack||u));const g=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function eoe(f,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe=1){const ke=kN.fromFeature(f,y,pe);G===du.vertical&&ke.verticalizePunctuation(X);let we=[];const Oe=function(pt,wt,St,Gt,Pt,Jt){if(!pt)return[];const or=[],lr=function(fr,Qt,Kt,pr,Tr,jr){let dn=0;for(let Fr=0;Fr=0;let yr=0;for(let fr=0;fr0&&si>Jn&&(Jn=si)}else{const Qs=St[xr.fontStack];if(!Qs)continue;Qs[Or]&&(Xn=Qs[Or]);const ni=wt[xr.fontStack];if(!ni)continue;const si=ni.glyphs[Or];if(!si)continue;if(mn=si.metrics,ps=Or!==8203?ul:0,jr){const bi=ni.ascender!==void 0?Math.abs(ni.ascender):0,qi=ni.descender!==void 0?Math.abs(ni.descender):0,Li=(bi+qi)*hn;Pi-u/2;){if(N--,N<0)return!1;E-=f[N].dist(j),j=f[N]}E+=f[N].dist(f[N+1]),N++;const R=[];let B=0;for(;Eg;)B-=R.shift().angleDelta;if(B>y)return!1;N++,E+=H.dist(G)}return!0}function Ave(f){let l=0;for(let u=0;uB){const se=(B-R)/J,pe=Rn(G.x,X.x,se),ke=Rn(G.y,X.y,se),we=new tx(pe,ke,0,X.angleTo(G),H);return!N||Tve(f,we,E,N,l)?we:void 0}R+=J}}function $qe(f,l,u,g,y,j,N,E,R){const B=Eve(g,j,N),H=Ive(g,y),G=H*N,X=f[0].x===0||f[0].x===R||f[0].y===0||f[0].y===R;return l-G=0&&qe=0&&dt=0&&X+B<=H){const it=new tx(qe,dt,0,Oe,se);g&&!Tve(f,it,j,g,y)||J.push(it)}}G+=we}return E||J.length||N||(J=Pve(f,G/2,u,g,y,j,N,!0,R)),J}function Lve(f){let l=0,u=0;for(const N of f)l+=N.w*N.h,u=Math.max(u,N.w);f.sort((N,E)=>E.h-N.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(l/.95)),u),h:1/0}];let y=0,j=0;for(const N of f)for(let E=g.length-1;E>=0;E--){const R=g[E];if(!(N.w>R.w||N.h>R.h)){if(N.x=R.x,N.y=R.y,j=Math.max(j,N.y+N.h),y=Math.max(y,N.x+N.w),N.w===R.w&&N.h===R.h){const B=g.pop();B&&E1?se-1:se,fc.copy(G.data,B,{x:0,y:0},{x:pe,y:ke},G.data,g),fc.copy(G.data,B,{x:0,y:Oe-se},{x:pe,y:ke-se},{width:we,height:se},g),fc.copy(G.data,B,{x:0,y:0},{x:pe,y:ke+Oe},{width:we,height:se},g),fc.copy(G.data,B,{x:we-se,y:0},{x:pe-se,y:ke},{width:se,height:Oe},g),fc.copy(G.data,B,{x:0,y:0},{x:pe+we,y:ke},{width:se,height:Oe},g),fc.copy(G.data,B,{x:we-se,y:Oe-se},{x:pe-se,y:ke-se},{width:se,height:se},g),fc.copy(G.data,B,{x:0,y:Oe-se},{x:pe+we,y:ke-se},{width:se,height:se},g),fc.copy(G.data,B,{x:0,y:0},{x:pe+we,y:ke+Oe},{width:se,height:se},g),fc.copy(G.data,B,{x:we-se,y:0},{x:pe-se,y:ke+Oe},{width:se,height:se},g)}this.lut=g,this.image=B,this.iconPositions=y,this.patternPositions=j}addImages(l,u,g,y){for(const[j,N]of l.entries()){const{bin:E,imagePosition:R,imageVariant:B}=ioe(j,N,g);u.set(j,R),y.push(E),N.hasRenderCallback&&this.haveRenderCallbacks.push(B.id)}}patchUpdatedImages(l,u,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(y=>l.hasImage(y,g)),l.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const y of l.getUpdatedImages(g)){for(const j of this.iconPositions.keys()){const N=cp.parse(j);if(Mc.isEqual(N.id,y)){const E=l.getImage(y,g);this.patchUpdatedImage(this.iconPositions.get(j),E,u,null)}}for(const j of this.patternPositions.keys()){const N=cp.parse(j);if(Mc.isEqual(N.id,y)){const E=l.getImage(y,g);this.patchUpdatedImage(this.patternPositions.get(j),E,u,this.lut)}}}}patchUpdatedImage(l,u,g,y=null){if(!l||!u||l.version===u.version)return;l.version=u.version;const[j,N]=l.tl,E=l.sdf;if(this.lut||E){const R={width:u.data.width,height:u.data.height},B=new fc(R);fc.copy(u.data,B,{x:0,y:0},{x:0,y:0},R,y,E),g.update(B,{position:{x:j,y:N}})}else g.update(u.data,{position:{x:j,y:N}})}}Xr(Z3,"ImagePosition"),Xr(Ove,"ImageAtlas");const Y3=1e20;function Dve(f,l,u,g,y,j,N,E,R){for(let B=l;B-1);R++,j[R]=E,N[R]=B,N[R+1]=Y3}for(let E=0,R=0;E{let R=this.entries[j];R||(R=this.entries[j]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let B=R.glyphs[N];if(B!==void 0)return void E(null,{stack:j,id:N,glyph:B});if(B=this._tinySDF(R,j,N),B)return R.glyphs[N]=B,void E(null,{stack:j,id:N,glyph:B});const H=Math.floor(N/256);if(256*H>65535)return $r("glyphs > 65535 not supported"),void E(null,{stack:j,id:N,glyph:B});if(R.ranges[H])return void E(null,{stack:j,id:N,glyph:B});let G=R.requests[H];G||(G=R.requests[H]=[],CN.loadGlyphRange(j,H,y,this.requestManager,(X,J)=>{if(J){R.ascender=J.ascender,R.descender=J.descender;for(const se in J.glyphs)this._doesCharSupportLocalGlyph(+se)||(R.glyphs[+se]=J.glyphs[+se]);R.ranges[H]=!0}for(const se of G)se(X,J);delete R.requests[H]})),G.push((X,J)=>{X?E(X):J&&E(null,{stack:j,id:N,glyph:J.glyphs[N]||null})})},(j,N)=>{if(j)u(j);else if(N){const E={};for(const{stack:R,id:B,glyph:H}of N)E[R]===void 0&&(E[R]={}),E[R].glyphs===void 0&&(E[R].glyphs={}),E[R].glyphs[B]=H&&{id:H.id,bitmap:H.bitmap.clone(),metrics:H.metrics},E[R].ascender=this.entries[R].ascender,E[R].descender=this.entries[R].descender;u(null,E)}})}_doesCharSupportLocalGlyph(l){return this.localGlyphMode!==aoe.none&&(this.localGlyphMode===aoe.all?!!this.localFontFamily:!!this.localFontFamily&&(Tn["CJK Unified Ideographs"](l)||Tn["Hangul Syllables"](l)||Tn.Hiragana(l)||Tn.Katakana(l)||Tn["CJK Symbols and Punctuation"](l)||Tn["CJK Unified Ideographs Extension A"](l)||Tn["CJK Unified Ideographs Extension B"](l)||Tn.Osage(l)))}_tinySDF(l,u,g){const y=this.localFontFamily;if(!y||!this._doesCharSupportLocalGlyph(g))return;let j=l.tinySDF;if(!j){let pe="400";/bold/i.test(u)?pe="900":/medium/i.test(u)?pe="500":/light/i.test(u)&&(pe="200"),j=l.tinySDF=new CN.TinySDF({fontFamily:y,fontWeight:pe,fontSize:24*Cp,buffer:3*Cp,radius:8*Cp}),j.fontWeight=pe}if(this.localGlyphs[j.fontWeight][g])return this.localGlyphs[j.fontWeight][g];const N=String.fromCodePoint(g),{data:E,width:R,height:B,glyphWidth:H,glyphHeight:G,glyphLeft:X,glyphTop:J,glyphAdvance:se}=j.draw(N);return this.localGlyphs[j.fontWeight][g]={id:g,bitmap:new zy({width:R,height:B},E),metrics:{width:H/Cp,height:G/Cp,left:X/Cp,top:J/Cp-27,advance:se/Cp,localGlyph:!0}}}}CN.loadGlyphRange=function(f,l,u,g,y){const j=256*l,N=j+255,E=g.transformRequest(g.normalizeGlyphsURL(u).replace("{fontstack}",f).replace("{range}",`${j}-${N}`),Og.Glyphs);$u(E,(R,B)=>{if(R)y(R);else if(B){const H={},G=function(X){return new n6(X).readFields(Oqe,{})}(B);for(const X of G.glyphs)H[X.id]=X;y(null,{glyphs:H,ascender:G.ascender,descender:G.descender})}})},CN.TinySDF=class{constructor({fontSize:f=24,buffer:l=3,radius:u=8,cutoff:g=.25,fontFamily:y="sans-serif",fontWeight:j="normal",fontStyle:N="normal",lang:E=null}={}){this.buffer=l,this.cutoff=g,this.radius=u,this.lang=E;const R=this.size=f+4*l,B=this._createCanvas(R),H=this.ctx=B.getContext("2d",{willReadFrequently:!0});H.font=`${N} ${j} ${f}px ${y}`,H.textBaseline="alphabetic",H.textAlign="left",H.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(f){const l=document.createElement("canvas");return l.width=l.height=f,l}draw(f){const{width:l,actualBoundingBoxAscent:u,actualBoundingBoxDescent:g,actualBoundingBoxLeft:y,actualBoundingBoxRight:j}=this.ctx.measureText(f),N=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(j-y))),R=Math.min(this.size-this.buffer,N+Math.ceil(g)),B=E+2*this.buffer,H=R+2*this.buffer,G=Math.max(B*H,0),X=new Uint8ClampedArray(G),J={data:X,width:B,height:H,glyphWidth:E,glyphHeight:R,glyphTop:N,glyphLeft:0,glyphAdvance:l};if(E===0||R===0)return J;const{ctx:se,buffer:pe,gridInner:ke,gridOuter:we}=this;this.lang&&(se.lang=this.lang),se.clearRect(pe,pe,E,R),se.fillText(f,pe,pe+N);const Oe=se.getImageData(pe,pe,E,R);we.fill(Y3,0,G),ke.fill(0,0,G);for(let ze=0;ze0?pt*pt:0,ke[it]=pt<0?pt*pt:0}}Dve(we,0,0,B,H,B,this.f,this.v,this.z),Dve(ke,pe,pe,E,R,B,this.f,this.v,this.z);for(let ze=0;ze{const gr=o6(Pt.stretch-Oe,ze,H,f.left*y),yr=l6(Pt.fixed-it,pt,Pt.stretch,se),hr=o6(Jt.stretch-qe,dt,G,f.top*y),fr=l6(Jt.fixed-wt,St,Jt.stretch,pe),Qt=o6(or.stretch-Oe,ze,H,f.left*y),Kt=l6(or.fixed-it,pt,or.stretch,se),pr=o6(lr.stretch-qe,dt,G,f.top*y),Tr=l6(lr.fixed-wt,St,lr.stretch,pe),jr=new ir(gr,hr),dn=new ir(Qt,hr),Fr=new ir(Qt,pr),Hr=new ir(gr,pr),tn=new ir(yr/E,fr/E),ms=new ir(Kt/E,Tr/E),kr=l*Math.PI/180;if(kr){const Pi=Math.sin(kr),at=Math.cos(kr),ut=[at,-Pi,Pi,at];jr._matMult(ut),dn._matMult(ut),Hr._matMult(ut),Fr._matMult(ut)}const rn=Pt.stretch+Pt.fixed,$n=or.stretch+or.fixed,Ps=Jt.stretch+Jt.fixed,zs=lr.stretch+lr.fixed,Jn=f.imageSecondary;return{tl:jr,tr:dn,bl:Hr,br:Fr,texPrimary:{x:N.paddedRect.x+$m+rn,y:N.paddedRect.y+$m+Ps,w:$n-rn,h:zs-Ps},texSecondary:Jn?{x:Jn.paddedRect.x+$m+rn,y:Jn.paddedRect.y+$m+Ps,w:$n-rn,h:zs-Ps}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:tn,pixelOffsetBR:ms,minFontScaleX:pt/E/H,minFontScaleY:St/E/G,isSDF:u}};if(g&&(N.stretchX||N.stretchY)){const Pt=zve(X,ke,se),Jt=zve(J,we,pe);for(let or=0;orj)&&(j=se.x),(!J||se.y>N)&&(N=se.y)}const R=Math.min(j-g,N-y);let B=R/2;const H=new xk([],Hqe);if(R===0)return new ir(g,y);for(let J=g;JG.d||!G.d)&&(G=J,u&&console.log("found best %d after %d probes",Math.round(1e4*J.d)/1e4,X)),J.max-G.d<=l||(B=J.h/2,H.push(new MN(J.p.x-B,J.p.y-B,B,f)),H.push(new MN(J.p.x+B,J.p.y-B,B,f)),H.push(new MN(J.p.x-B,J.p.y+B,B,f)),H.push(new MN(J.p.x+B,J.p.y+B,B,f)),X+=4)}return u&&(console.log(`num probes: ${X}`),console.log(`best distance: ${G.d}`)),G.p}function Hqe(f,l){return l.max-f.max}class MN{constructor(l,u,g,y){this.p=new ir(l,u),this.h=g,this.d=function(j,N){let E=!1,R=1/0;for(let B=0;Bj.y!=pe.y>j.y&&j.x<(pe.x-se.x)*(j.y-se.y)/(pe.y-se.y)+se.x&&(E=!E),R=Math.min(R,Ya(j,se,pe))}}return(E?1:-1)*Math.sqrt(R)}(this.p,y),this.max=this.d+this.h*Math.SQRT2}}const Wqe=Object.keys,loe=Number.POSITIVE_INFINITY,Gqe=Math.sqrt(2);function $y(f,l,u,g,y){const j=roe(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],N={top:f.top-j[1],bottom:f.bottom+j[3],left:f.left-j[0],right:f.right+j[2],scaled:!1};return g!==void 0&&function(E,R){E.top*=R,E.bottom*=R,E.left*=R,E.right*=R,E.scaled=!0}(N,g),u&&function(E,R){if(!R)return;const B=rs(R),H=new ir(E.left,E.top),G=new ir(E.right,E.top),X=new ir(E.left,E.bottom),J=new ir(E.right,E.bottom),se=new ir(0,0);H._rotateAround(B,se),G._rotateAround(B,se),X._rotateAround(B,se),J._rotateAround(B,se),E.left=Math.min(H.x,G.x,X.x,J.x),E.right=Math.max(H.x,G.x,X.x,J.x),E.top=Math.min(H.y,G.y,X.y,J.y),E.bottom=Math.max(H.y,G.y,X.y,J.y)}(N,u),y&&(N.left+=y[0],N.right+=y[0],N.top+=y[1],N.bottom+=y[1]),l?{top:Math.min(l.top,N.top),bottom:Math.max(l.bottom,N.bottom),left:Math.min(l.left,N.left),right:Math.max(l.right,N.right),scaled:l.scaled||N.scaled}:N}function $ve(f,[l,u]){let g=0,y=0;if(u===loe){l<0&&(l=0);const j=l/Gqe;switch(f){case"top-right":case"top-left":y=j-7;break;case"bottom-right":case"bottom-left":y=7-j;break;case"bottom":y=7-l;break;case"top":y=l-7}switch(f){case"top-right":case"bottom-right":g=-j;break;case"top-left":case"bottom-left":g=j;break;case"left":g=l;break;case"right":g=-l}}else{switch(l=Math.abs(l),u=Math.abs(u),f){case"top-right":case"top-left":case"top":y=u-7;break;case"bottom-right":case"bottom-left":case"bottom":y=7-u}switch(f){case"top-right":case"bottom-right":case"right":g=-l;break;case"top-left":case"bottom-left":case"left":g=l}}return[g,y]}function Kqe(f,l,u,g,y,j,N,E,R,B,H,G,X,J){const se=f.layers[0],pe=se.appearances;if(pe.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const ke={iconBBox:null,iconVerticalBBox:null},we={textBBox:null,textVerticalBBox:null},{baseIconRotate:Oe,baseTextRotate:ze,iconScaleFactor:qe}=function(it,pt,wt){const St=it.get("icon-rotate").evaluate(pt,{},wt),Gt=it.get("text-rotate").evaluate(pt,{},wt),[Pt,Jt]=it.get("icon-size-scale-range");return{baseIconRotate:St,baseTextRotate:Gt,iconScaleFactor:_e(1,Pt,Jt)}}(g,y,j);l&&(ke.iconBBox=$y(l,ke.iconBBox,Oe,N),u)&&(ke.iconVerticalBBox=$y(u,ke.iconVerticalBBox,Oe+90,N));const dt=d6(G.horizontal);dt&&(we.textBBox=$y(dt,we.textBBox,ze,1,J)),G.vertical&&(we.textVerticalBBox=$y(G.vertical,we.textVerticalBBox,ze+90,1,J));for(const it of pe)it.hasIconProperties()&&Zqe(ke,f,se,it,y,j,E,Oe,N,R,l,B,qe,H),it.hasTextProperties()&&Yqe(we,se,it,y,j,J,ze,X,dt,G.vertical);return{iconBBox:ke.iconBBox,iconVerticalBBox:ke.iconVerticalBBox,textBBox:we.textBBox,textVerticalBBox:we.textVerticalBBox}}function Zqe(f,l,u,g,y,j,N,E,R,B,H,G,X,J){const{appearanceIconOffset:se,appearanceIconRotate:pe,appearanceIconSize:ke}=function(qe,dt,it,pt,wt,St,Gt,Pt){const Jt=qe.hasProperty("icon-offset")?dt.getAppearanceValueAndResolveTokens(qe,"icon-offset",it,pt,[]):null,or=Jt&&Array.isArray(Jt)?Jt:wt,lr=qe.hasProperty("icon-rotate")?dt.getAppearanceValueAndResolveTokens(qe,"icon-rotate",it,pt,[]):null,gr=typeof lr=="number"?lr:St,yr=qe.hasProperty("icon-size")?dt.getAppearanceValueAndResolveTokens(qe,"icon-size",it,pt,[]):null;return{appearanceIconOffset:or,appearanceIconRotate:gr,appearanceIconSize:typeof yr=="number"?yr*Pt.iconScaleFactor:Gt}}(g,u,y,j,N,E,R,B);let we=null,Oe=null,ze=null;g.hasProperty("icon-image")?ze=function(qe,dt,it,pt,wt,St,Gt){let Pt=null;const Jt=dt.getAppearanceValueAndResolveTokens(it,"icon-image",pt,wt,[]);if(Jt){const or=qe.getResolvedImageFromTokens(Jt),lr=it.getUnevaluatedProperty("icon-size"),gr=X3(or,NN(qe.zoom,lr,qe.worldview),lr,wt,qe.zoom,pt,qe.pixelRatio,Gt,qe.worldview);Pt=St.get(gr.iconPrimary.toString())}return Pt}(l,u,g,y,j,G,X):H&&(ze=H.imagePrimary),ze&&(we=i6(ze,null,se,J),l.allowVerticalPlacement&&(Oe=i6(ze,null,se,J))),we&&(f.iconBBox=$y(we,f.iconBBox,pe,ke)),Oe&&(f.iconVerticalBBox=$y(Oe,f.iconVerticalBBox,pe+90,ke))}function Yqe(f,l,u,g,y,j,N,E,R,B){const{appearanceTextOffset:H,appearanceTextRotate:G,appearanceTextSize:X}=function(se,pe,ke,we,Oe,ze,qe){const dt=se.hasProperty("text-offset")?pe.getAppearanceValueAndResolveTokens(se,"text-offset",ke,we,[]):null,it=dt&&Array.isArray(dt)?[dt[0]*ul,dt[1]*ul]:Oe,pt=se.hasProperty("text-rotate")?pe.getAppearanceValueAndResolveTokens(se,"text-rotate",ke,we,[]):null,wt=typeof pt=="number"?pt:ze,St=se.hasProperty("text-size")?pe.getAppearanceValueAndResolveTokens(se,"text-size",ke,we,[]):null;return{appearanceTextOffset:it,appearanceTextRotate:wt,appearanceTextSize:typeof St=="number"?St:qe}}(u,l,g,y,j,N,E),J=X/E;R&&(f.textBBox=$y(R,f.textBBox,G,J,H)),B&&(f.textVerticalBBox=$y(B,f.textVerticalBBox,G+90,J,H))}function c6(f,l,u,g,y,j,N,E,R){if(!l||!l.usvg)return;const B=Mve(g),H=Mve(y),G=j!=="both"&&j!=="width"||!Sve(g)?1:H.width/B.width,X=j!=="both"&&j!=="height"||!Cve(g)?1:H.height/B.height;u.scaleSelf(G,X);const J=u.toString();N.set(J,u),E.set(J,l);const{imagePosition:se}=ioe(J,l,Rv);R.set(J,se)}function Uve(f,l,u,g,y,j,N,E,R){if(!f)return;const B=function(H,G,X,J,se,pe){if(H.kind==="camera")return H.maxSize;if(H.kind==="composite"){const ke=G.possiblyEvaluate(new Ji(H.maxZoom,{worldview:pe}),X).evaluate(se,{},X),we=G.possiblyEvaluate(new Ji(H.minZoom,{worldview:pe}),X).evaluate(se,{},X);return Math.max(ke,we)}return G.possiblyEvaluate(new Ji(J,{worldview:pe})).evaluate(se,{},X)}(l,u,g,y,j,R);return f.scaleSelf(B*E*N)}function X3(f,l,u,g,y,j,N,E,R){return{iconPrimary:Uve(f.getPrimary(),l,u,g,y,j,N,E,R),iconSecondary:Uve(f.getSecondary(),l,u,g,y,j,N,E,R)}}function Xqe(f,l,u){if(!l)return;const g=u.get(f.toString()),y=u.get(l.toString());g&&y&&(g.paddedRect.w===y.paddedRect.w&&g.paddedRect.h===y.paddedRect.h||$r(`Mismatch in icon variant sizes: ${f.toString()} and ${l.toString()}`),g.usvg!==y.usvg&&$r(`Mismatch in icon variant image types: ${f.id} and ${l.id}`))}function qve(f,l,u,g){if(!f)return;const y=l.get(u.toString());if(f.imagePrimary=y,g){const j=l.get(g.toString());f.imageSecondary=j}}function Qqe(f,l){for(const u in f.horizontal)Vve(f.horizontal[u],l);Vve(f.vertical,l)}function Vve(f,l){if(f){for(const u of f.positionedLines)for(const g of u.positionedGlyphs)if(g.image!==null){const y=g.image.toString();g.rect=l.get(y).paddedRect}}}function coe(f){switch(f){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Jqe(f,l,u,g,y,j,N,E,R){const B=d6(j.horizontal)||j.vertical,H=u.get("icon-text-fit-padding").evaluate(g,{},y);let G,X=l;return l&&R!=="none"&&(f.allowVerticalPlacement&&j.vertical&&(G=noe(l,j.vertical,R,H,E,N)),B&&(X=noe(l,B,R,H,E,N))),{defaultShapedIcon:X,verticallyShapedIcon:G}}function eVe(f,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe,ze,qe,dt,it,pt){let wt=N.textMaxSize.evaluate(l,{},X);wt===void 0?wt=E*N.textScaleFactor:wt*=N.textScaleFactor;const St=f.layers[0].layout,Gt=ul,Pt=E*N.textScaleFactor/Gt,Jt=d6(u.horizontal)||u.vertical;if(ke!=="none"&&f.appearanceFeatureData&&l.index18&&pr>2&&(pr>>=1),Math.max(Mr/(512*pr),1)*St.get("symbol-spacing")),yr=St.get("text-padding")*f.tilePixelRatio,hr=St.get("icon-padding")*f.tilePixelRatio,fr=rs(St.get("text-max-angle")),Qt=St.get("icon-rotation-alignment")==="map"&&ze!=="point",Kt=gr/2;var pr;f.hasAnyIconTextFit===!1&&ke!=="none"&&(f.hasAnyIconTextFit=!0);const Tr=l.properties?+l.properties[Zt]:null,jr=Tr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Tr):65535,dn=(Fr,Hr,tn)=>{if(Hr.x<0||Hr.x>=Mr||Hr.y<0||Hr.y>=Mr)return;let ms=null;if(or){const{x:kr,y:rn,z:$n}=J.projectTilePoint(Hr.x,Hr.y,tn);ms={anchor:new tx(kr,rn,$n,0,void 0),up:J.upVector(tn,Hr.x,Hr.y)}}(function(kr,rn,$n,Ps,zs,Jn,Pi,at,ut,er,xr,Lr,Or,hn,mn,Xn,as,ps,Cs,Pn,Bn,Qs,ni,si,bi,qi,Li,di,gi,ls,Rs,ba,An){const Ms=kr.addToLineVertexArray(rn,Ps);let zi,Zi,ea,no,Xi,En,Ca,wi=0,ma=0,Bo=0,hl=0,No=-1,So=-1;const rl={};let _d=ik("");const Qi=$n?$n.anchor:rn,Xa=di!=="none";let so=0,Fd=0;if(ut._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Ql=ut.layout.get("text-offset").evaluate(Bn,{},bi);so=Ql[0]*ul,Fd=Ql[1]*ul}else so=ut.layout.get("text-radial-offset").evaluate(Bn,{},bi)*ul,Fd=loe;if(kr.allowVerticalPlacement&&zs.vertical){const Ql=zs.vertical;if(mn)En=doe(Ql),at&&(Ca=doe(at));else{const Xc=ut.layout.get("text-rotate").evaluate(Bn,{},bi)+90;ea=u6(er,Qi,rn,xr,Lr,Or,Ql,hn,Xc,Xn,ba),at&&(no=u6(er,Qi,rn,xr,Lr,Or,at,ps,Xc,null,Rs))}}if(Jn){const Ql=kr.iconSizeData,Xc=ut.layout.get("icon-rotate").evaluate(Bn,{},bi),uu=ooe(Jn,Xc,ni,Xa,Qs.iconScaleFactor),Vy=at?ooe(at,Xc,ni,Xa,Qs.iconScaleFactor):void 0;Zi=u6(er,Qi,rn,xr,Lr,Or,Jn,ps,Xc,null,ls);const ON=function(Ep,mM,c2e,hHe,d2e,u2e,fHe,pHe){const h2e=Ep.layers[0],f2e=h2e.appearances;let DN=mM.length;if(c2e&&(DN=Math.max(DN,c2e.length)),f2e.length===0)return DN;const[mHe,gHe]=hHe.get("icon-size-scale-range"),xHe=_e(1,mHe,gHe);for(const p2e of f2e){const m2e=p2e.getUnevaluatedProperties();if(m2e._values["icon-image"].value!==void 0){const g2e=h2e.getAppearanceValueAndResolveTokens(p2e,"icon-image",d2e,u2e,[]);if(g2e){const x2e=Ep.getResolvedImageFromTokens(g2e);if(x2e){const y2e=m2e._values["icon-size"],yHe=X3(x2e,NN(Ep.zoom,y2e,Ep.worldview),y2e,u2e,Ep.zoom,d2e,Ep.pixelRatio,xHe,Ep.worldview),vHe=fHe.get(yHe.iconPrimary.toString());DN=Math.max(DN,Uqe(vHe,pHe))}}}}return DN}(kr,uu,Vy,ut.layout,Bn,bi,kr.iconAtlasPositions,Xa);wi=4*ON;let Ap=null;Ql.kind==="source"?(Ap=[Sp*ut.layout.get("icon-size").evaluate(Bn,{},bi)*Qs.iconScaleFactor],Ap[0]>rx&&$r(`${kr.layerIds[0]}: Value for "icon-size" is >= ${Q3}. Reduce your "icon-size".`)):Ql.kind==="composite"&&(Ap=[Sp*Qs.compositeIconSizes[0].evaluate(Bn,{},bi)*Qs.iconScaleFactor,Sp*Qs.compositeIconSizes[1].evaluate(Bn,{},bi)*Qs.iconScaleFactor],(Ap[0]>rx||Ap[1]>rx)&&$r(`${kr.layerIds[0]}: Value for "icon-size" is >= ${Q3}. Reduce your "icon-size".`)),kr.addSymbols(kr.icon,uu,Ap,Pn,Cs,Bn,void 0,$n,rn,Ms.lineStartIndex,Ms.lineLength,-1,si,bi,qi,Li,kr.symbolInstances.length,ON),No=kr.icon.placedSymbolArray.length-1,Vy&&(ma=4*ON,kr.addSymbols(kr.icon,Vy,Ap,Pn,Cs,Bn,du.vertical,$n,rn,Ms.lineStartIndex,Ms.lineLength,-1,si,bi,qi,Li,kr.symbolInstances.length,ON),So=kr.icon.placedSymbolArray.length-1)}for(const Ql in zs.horizontal){const Xc=Ql,uu=zs.horizontal[Xc];zi||(_d=ik(uu.text),mn?Xi=doe(uu):zi=u6(er,Qi,rn,xr,Lr,Or,uu,hn,ut.layout.get("text-rotate").evaluate(Bn,{},bi),Xn,ba));const Vy=uu.positionedLines.length===1;if(Bo+=Hve(kr,$n,rn,uu,Pi,ut,mn,Bn,Xn,Ms,zs.vertical?du.horizontal:du.horizontalOnly,Vy?Wqe(zs.horizontal):[Xc],rl,No,Qs,si,bi,kr.symbolInstances.length,qi),Vy)break}zs.vertical&&(hl+=Hve(kr,$n,rn,zs.vertical,Pi,ut,mn,Bn,Xn,Ms,du.vertical,["vertical"],rl,So,Qs,si,bi,kr.symbolInstances.length,qi));let $o=-1;const yf=(Ql,Xc)=>Ql?Math.max(Ql,Xc):Xc;$o=yf(Xi,$o),$o=yf(En,$o),$o=yf(Ca,$o);const Um=$o>-1?1:0;kr.glyphOffsetArray.length>=65535&&$r("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Bn.sortKey!==void 0&&kr.addToSortKeyRanges(kr.symbolInstances.length,Bn.sortKey),kr.symbolInstances.emplaceBack(rn.x,rn.y,Qi.x,Qi.y,Qi.z,rl.right>=0?rl.right:-1,rl.center>=0?rl.center:-1,rl.left>=0?rl.left:-1,rl.vertical>=0?rl.vertical:-1,No,So,_d,zi!==void 0?zi:kr.collisionBoxArray.length,zi!==void 0?zi+1:kr.collisionBoxArray.length,ea!==void 0?ea:kr.collisionBoxArray.length,ea!==void 0?ea+1:kr.collisionBoxArray.length,Zi!==void 0?Zi:kr.collisionBoxArray.length,Zi!==void 0?Zi+1:kr.collisionBoxArray.length,no||kr.collisionBoxArray.length,no?no+1:kr.collisionBoxArray.length,xr,Bo,hl,wi,ma,Um,0,so,Fd,$o,0,Xa?1:0,gi)})(f,Hr,ms,Fr,u,g,j,y,f.layers[0],f.collisionBoxArray,l.index,l.sourceLayerIndex,f.index,yr,Oe,B,0,hr,Qt,we,l,N,H,G,X,se,pe,ke,jr,qe,dt,it)};if(ze==="line")for(const Fr of WP(l.geometry,0,0,Mr,Mr)){const Hr=$qe(Fr,gr,fr,u.vertical||Jt,g,Gt,lr,f.overscaling,Mr);for(const tn of Hr)Jt&&tVe(f,Jt.text,Kt,tn)||dn(Fr,tn,X)}else if(ze==="line-center"){for(const Fr of l.geometry)if(Fr.length>1){const Hr=Bqe(Fr,fr,u.vertical||Jt,g,Gt,lr);Hr&&dn(Fr,Hr,X)}}else if(l.type==="Polygon")for(const Fr of L3(l.geometry,0)){const Hr=Vqe(Fr,16);dn(Fr[0],new tx(Hr.x,Hr.y,0,0,void 0),X)}else if(l.type==="LineString")for(const Fr of l.geometry)dn(Fr,new tx(Fr[0].x,Fr[0].y,0,0,void 0),X);else if(l.type==="Point")for(const Fr of l.geometry)for(const Hr of Fr)dn([Hr],new tx(Hr.x,Hr.y,0,0,void 0),X)}const Q3=255,rx=Q3*Sp;function Hve(f,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe){const ze=function(it,pt,wt,St,Gt,Pt,Jt,or){const lr=[];if(pt.positionedLines.length===0)return lr;const gr=St.layout.get("text-rotate").evaluate(Pt,{})*Math.PI/180,yr=function(pr){const Tr=pr[0],jr=pr[1],dn=Tr*jr;return dn>0?[Tr,-jr]:dn<0?[-Tr,jr]:Tr===0?[jr,Tr]:[jr,-Tr]}(wt);let hr=Math.abs(pt.top-pt.bottom);for(const pr of pt.positionedLines)hr-=pr.lineOffset;const fr=pt.positionedLines.length,Qt=hr/fr;let Kt=pt.top-wt[1];for(let pr=0;prrx&&$r(`${f.layerIds[0]}: Value for "text-size" is >= ${Q3}. Reduce your "text-size".`)):qe.kind==="composite"&&(dt=[Sp*se.compositeTextSizes[0].evaluate(E,{},ke)*se.textScaleFactor,Sp*se.compositeTextSizes[1].evaluate(E,{},ke)*se.textScaleFactor],(dt[0]>rx||dt[1]>rx)&&$r(`${f.layerIds[0]}: Value for "text-size" is >= ${Q3}. Reduce your "text-size".`)),f.addSymbols(f.text,ze,dt,R,N,E,H,l,u,B.lineStartIndex,B.lineLength,J,pe,ke,Oe,!1,we,ze.length);for(const it of G)X[it]=f.text.placedSymbolArray.length-1;return 4*ze.length}function d6(f){for(const l in f)return f[l];return null}function u6(f,l,u,g,y,j,N,E,R,B,H){let G,X,J,se;if(G=H?H.top:N.top,X=H?H.bottom:N.bottom,J=H?H.left:N.left,se=H?H.right:N.right,roe(N)&&N.collisionPadding){const pe=N.collisionPadding;J-=pe[0],G-=pe[1],se+=pe[2],X+=pe[3]}if(R){const pe=new ir(J,G),ke=new ir(se,G),we=new ir(J,X),Oe=new ir(se,X),ze=rs(R);let qe=new ir(0,0);B&&(qe=new ir(B[0],B[1])),pe._rotateAround(ze,qe),ke._rotateAround(ze,qe),we._rotateAround(ze,qe),Oe._rotateAround(ze,qe),J=Math.min(pe.x,ke.x,we.x,Oe.x),se=Math.max(pe.x,ke.x,we.x,Oe.x),G=Math.min(pe.y,ke.y,we.y,Oe.y),X=Math.max(pe.y,ke.y,we.y,Oe.y)}return f.emplaceBack(l.x,l.y,l.z,u.x,u.y,J,G,se,X,E,g,y,j),f.length-1}function doe(f){roe(f)&&f.collisionPadding&&(f.top-=f.collisionPadding[1],f.bottom+=f.collisionPadding[3]);const l=f.bottom-f.top;return l>0?Math.max(10,l):null}function tVe(f,l,u,g){const y=f.compareText;if(l in y){const j=y[l];for(let N=j.length-1;N>=0;N--)if(g.dist(j[N])ze&&(qe(it,lr,wt,St,Jt,or),qe(lr,pt,Jt,or,Gt,Pt))}qe(G,X,g,j,y,j),qe(X,J,y,j,y,N),qe(J,se,y,N,g,N),qe(se,G,g,N,g,j),pe-=ze,ke-=ze,we+=ze,Oe+=ze;const dt=1/Math.max(we-pe,Oe-ke);return{scale:dt,x:pe*dt,y:ke*dt,x2:we*dt,y2:Oe*dt,projection:l}}function Gve(f,{x:l,y:u},g=0){return new ir(((l-g)*f.scale-f.x)*Mr,(u*f.scale-f.y)*Mr)}const rVe=T(new Float32Array(16));class Uy{constructor(l){this.spec=l,this.name=l.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(l,u){return{x:0,y:0,z:0}}unproject(l,u){return new p(0,0)}projectTilePoint(l,u,g){return{x:l,y:u,z:0}}locationPoint(l,u,g,y=!0){return l._coordinatePoint(l.locationCoordinate(u,g),y)}pixelsPerMeter(l,u){return Y(1,l)*u}pixelSpaceConversion(l,u,g){return 1}farthestPixelDistance(l){return Wve(l,l.pixelsPerMeter)}pointCoordinate(l,u,g,y){const j=l.horizonLineFromTop(!1),N=new ir(u,Math.max(j,g));return l.rayIntersectionCoordinate(l.pointRayIntersection(N,y))}pointCoordinate3D(l,u,g){const y=new ir(u,g);if(l.elevation)return l.elevation.pointCoordinate(y);{const j=this.pointCoordinate(l,y.x,y.y,0);return[j.x,j.y,j.z]}}isPointAboveHorizon(l,u){if(l.elevation&&l.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(l,u.x,u.y);const g=l.horizonLineFromTop();return u.y0?u<-TN+g&&(u=-TN+g):u>TN-g&&(u=TN-g);const N=j/Math.pow(f6(u),y);let E=N*Math.sin(y*l),R=j-N*Math.cos(y*l);return E=.5*(E/Math.PI+.5),R=.5*(R/Math.PI+.5),{x:E,y:this.southernCenter?R:1-R,z:0}}unproject(l,u){l=(2*l-.5)*Math.PI,this.southernCenter&&(u=1-u),u=(2*(1-u)-.5)*Math.PI;const{n:g,f:y}=this,j=y-u,N=Math.sign(j),E=Math.sign(g)*Math.sqrt(l*l+j*j);let R=Math.atan2(l,Math.abs(j))*N;j*g<0&&(R-=Math.PI*Math.sign(l)*N);const B=_e(po(R/g)+this.center[0],-180,180),H=_e(po(2*Math.atan(Math.pow(y/E,1/g))-TN),-de,de);return new p(B,this.southernCenter?-H:H)}}class Kve extends Uy{constructor(l){super(l),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(l,u){return{x:z(l),y:V(u),z:0}}unproject(l,u){const g=Q(l),y=ce(u);return new p(g,y)}}const Zve=rs(de);class oVe extends Uy{project(l,u){const g=(u=rs(u))*u,y=g*g;return{x:.5*((l=rs(l))*(.8707-.131979*g+y*(y*(.003971*g-.001529*y)-.013791))/Math.PI+.5),y:1-.5*(u*(1.007226+g*(.015085+y*(.028874*g-.044475-.005916*y)))/Math.PI+1),z:0}}unproject(l,u){l=(2*l-.5)*Math.PI;let g=u=(2*(1-u)-1)*Math.PI,y=25,j=0,N=g*g;do{N=g*g;const B=N*N;j=(g*(1.007226+N*(.015085+B*(.028874*N-.044475-.005916*B)))-u)/(1.007226+N*(.045255+B*(.259866*N-.311325-.005916*11*B))),g=_e(g-j,-Zve,Zve)}while(Math.abs(j)>1e-6&&--y>0);N=g*g;const E=_e(po(l/(.8707+N*(N*(N*N*N*(.003971-.001529*N)-.013791)-.131979))),-180,180),R=po(g);return new p(E,R)}}const Yve=rs(de);class lVe extends Uy{project(l,u){u=rs(u),l=rs(l);const g=Math.cos(u),y=2/Math.PI,j=Math.acos(g*Math.cos(l/2)),N=Math.sin(j)/j,E=.5*(l*y+2*g*Math.sin(l/2)/N)||0,R=.5*(u+Math.sin(u)/N)||0;return{x:.5*(E/Math.PI+.5),y:1-.5*(R/Math.PI+1),z:0}}unproject(l,u){let g=l=(2*l-.5)*Math.PI,y=u=(2*(1-u)-1)*Math.PI,j=25;const N=1e-6;let E=0,R=0;do{const B=Math.cos(y),H=Math.sin(y),G=2*H*B,X=H*H,J=B*B,se=Math.cos(g/2),pe=Math.sin(g/2),ke=2*se*pe,we=pe*pe,Oe=1-J*se*se,ze=Oe?1/Oe:0,qe=Oe?Math.acos(B*se)*Math.sqrt(1/Oe):0,dt=.5*(2*qe*B*pe+2*g/Math.PI)-l,it=.5*(qe*H+y)-u,pt=.5*ze*(J*we+qe*B*se*X)+1/Math.PI,wt=ze*(ke*G/4-qe*H*pe),St=.125*ze*(G*pe-qe*H*J*ke),Gt=.5*ze*(X*se+qe*we*B)+.5,Pt=wt*St-Gt*pt;E=(it*wt-dt*Gt)/Pt,R=(dt*St-it*pt)/Pt,g=_e(g-E,-Math.PI,Math.PI),y=_e(y-R,-Yve,Yve)}while((Math.abs(E)>N||Math.abs(R)>N)&&--j>0);return new p(po(g),po(y))}}class Xve extends Uy{constructor(l){super(l),this.center=l.center||[0,0],this.parallels=l.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(rs(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(l,u){const{scale:g,cosPhi:y}=this;return{x:rs(l)*y*g+.5,y:-Math.sin(rs(u))/y*g+.5,z:0}}unproject(l,u){const{scale:g,cosPhi:y}=this,j=-(u-.5)/g,N=_e(po((l-.5)/g)/y,-180,180),E=Math.asin(_e(j*y,-1,1)),R=_e(po(E),-de,de);return new p(N,R)}}class cVe extends Kve{constructor(l){super(l),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(l,u,g){const y=M3(l,u,g);return Ye(y,y,RP(Sh(g))),{x:y[0],y:y[1],z:y[2]}}locationPoint(l,u,g){const y=Oy(u.lat,u.lng),j=Fe([],y),N=g?l._centerAltitude+g:l.elevation?l.elevation.getAtPointOrZero(l.locationCoordinate(u),l._centerAltitude):l._centerAltitude;Ne(y,y,j,Y(1,0)*Mr*N);const E=T(new Float64Array(16));return A(E,l.pixelMatrix,l.globeMatrix),Ye(y,y,E),new ir(y[0],y[1])}pixelsPerMeter(l,u){return Y(1,0)*u}pixelSpaceConversion(l,u,g){const y=Y(1,l)*u,j=Rn(Y(1,45)*u,y,g);return this.pixelsPerMeter(l,u)/j}createTileMatrix(l,u,g){const y=mae(Sh(g.canonical));return A(new Float64Array(16),l.globeMatrix,y)}createInversionMatrix(l,u){const{center:g}=l,y=RP(Sh(u));return q(y,y,rs(g.lng)),F(y,y,rs(g.lat)),$(y,y,[l._pixelsPerMercatorPixel,l._pixelsPerMercatorPixel,1]),Float32Array.from(y)}pointCoordinate(l,u,g,y){return Ry(l,u,g,!0)||new $e(0,0)}pointCoordinate3D(l,u,g){const y=this.pointCoordinate(l,u,g,0);return[y.x,y.y,y.z]}isPointAboveHorizon(l,u){return!Ry(l,u.x,u.y,!1)}farthestPixelDistance(l){const u=function(y,j){const N=y.cameraToCenterDistance,E=y._centerAltitude*j,R=y._camera,B=y._camera.forward(),H=fe([],ae([],B,-N),[0,0,E]),G=y.worldSize/(2*Math.PI),X=[0,0,-G],J=y.width/y.height,se=Math.tan(y.fovAboveCenter),pe=ae([],R.up(),se),ke=ae([],R.right(),se*J),we=Fe([],fe([],fe([],B,pe),ke)),Oe=[];let ze;if(new Jr(H,we).closestPointOnSphere(X,G,Oe)){const qe=fe([],Oe,X),dt=Me([],qe,H);ze=Math.cos(y.fovAboveCenter)*ye(dt)}else{const qe=Me([],H,X),dt=Me([],X,H);Fe(dt,dt);const it=ye(qe)-G;ze=Math.sqrt(it*(it+2*G));const pt=Math.acos(ze/(G+it))-Math.acos(Ce(B,dt));ze*=Math.cos(pt)}return 1.01*ze}(l,this.pixelsPerMeter(l.center.lat,l.worldSize)),g=Fy(l.zoom);if(g>0){const y=Wve(l,Y(1,l.center.lat)*l.worldSize),j=l.worldSize/(2*Math.PI),N=Math.max(l.width,l.height)/l.worldSize*Math.PI;return Rn(u,y+j*(1-Math.cos(N)),Math.pow(g,10))}return u}upVector(l,u,g){return M3(u,g,l,1)}upVectorScale(l){return{metersToTile:gf(DP(Sh(l)))}}}function Qve(f){const l=f.parallels,u=!!l&&Math.abs(l[0]+l[1])<.01;switch(f.name){case"mercator":return new Kve(f);case"equirectangular":return new iVe(f);case"naturalEarth":return new oVe(f);case"equalEarth":return new sVe(f);case"winkelTripel":return new lVe(f);case"albers":return u?new Xve(f):new nVe(f);case"lambertConformalConic":return u?new Xve(f):new aVe(f);case"globe":return new cVe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const dVe=Tt.types,uVe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function sM(f,l,u,g,y,j,N,E,R,B,H,G,X){const J=E?Math.min(rx,Math.round(E[0])):0,se=E?Math.min(rx,Math.round(E[1])):0;f.emplaceBack(l,u,Math.round(32*g),Math.round(32*y),j,N,(J<<1)+(R?1:0),0+(se<<1),16*B,16*H,256*G,256*X)}function iM(f,l,u){f.emplaceBack(l,u)}function aM(f,l,u,g,y,j,N){f.emplaceBack(l,u,g,y,j,N)}const p6=(f,l,u,g)=>{for(let y=0;y0&&(this.iconTransitioningVertexBuffer=l.createVertexBuffer(this.iconTransitioningVertexArray,vqe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=l.createVertexBuffer(this.globeExtVertexArray,mqe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||j)&&(this.zOffsetVertexBuffer=l.createVertexBuffer(this.zOffsetVertexArray,xqe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=l.createVertexBuffer(this.orientationVertexArray,yqe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||y)&&this.programConfigurations.upload(l))}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())}}Xr(uoe,"SymbolBuffers");class hoe{constructor(l,u,g){this.layoutVertexArray=new l,this.layoutAttributes=u,this.indexArray=new g,this.segments=new ka,this.collisionVertexArray=new f3,this.collisionVertexArrayExt=new Dm}upload(l){this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=l.createVertexBuffer(this.collisionVertexArray,_qe.members,!0),this.collisionVertexBufferExt=l.createVertexBuffer(this.collisionVertexArrayExt,bqe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Xr(hoe,"CollisionBuffers");class m6{constructor(l){this.collisionBoxArray=l.collisionBoxArray,this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(N=>N.fqid),this.index=l.index,this.pixelRatio=l.pixelRatio,this.sourceLayerIndex=l.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=T([]),this.placementViewportMatrix=T([]);const u=this.layers[0]._unevaluatedLayout._values;this.worldview=l.worldview,this.localizable=l.localizable,this.textSizeData=NN(this.zoom,u["text-size"],this.worldview),this.iconSizeData=NN(this.zoom,u["icon-size"],this.worldview);const g=this.layers[0].layout,y=g.get("symbol-sort-key"),j=g.get("symbol-z-order");this.lut=l.lut,this.canOverlap=g.get("text-allow-overlap")||g.get("icon-allow-overlap")||g.get("text-ignore-placement")||g.get("icon-ignore-placement"),this.sortFeaturesByKey=j!=="viewport-y"&&y.constantOr(1)!==void 0,this.sortFeaturesByY=(j==="viewport-y"||j==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(N=>du[N]),this.stateDependentLayerIds=this.layers.filter(N=>N.isStateDependent()).map(N=>N.id),this.sourceID=l.sourceID,this.projection=l.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(l){const u=this.layers[0].getAppearances();return!(!u||u.length===0)&&u.some(g=>g.getProperty(l)!=null)}createArrays(){this.text=new uoe(new kh(this.layers,{zoom:this.zoom,lut:this.lut},l=>l.startsWith("text")||l.startsWith("symbol"))),this.icon=new uoe(new kh(this.layers,{zoom:this.zoom,lut:this.lut},l=>l.startsWith("icon")||l.startsWith("symbol"))),this.glyphOffsetArray=new oN,this.lineVertexArray=new EP,this.symbolInstances=new _3}calculateGlyphDependencies(l,u,g,y,j){for(const N of l){const E=N.codePointAt(0);if(E===void 0)break;if(u[E]=!0,y&&j&&E<=65535){const R=G3[N];R&&(u[R.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(l,u,g,y,j,N){let E=1;const R=l.getUnevaluatedProperties()._values["icon-size"],B=NN(this.zoom,R,this.worldview),H=SN(B,u);if(B.kind!=="constant"&&B.kind!=="camera"||(E=H.uSize),B.kind==="composite"){const{minZoom:G,maxZoom:X}=B,J=R.possiblyEvaluate(new Ji(G,{worldview:this.worldview}),y),se=R.possiblyEvaluate(new Ji(X,{worldview:this.worldview}),y),pe=J.evaluate(g,{},y,j);E=pe+(se.evaluate(g,{},y,j)-pe)*H.uSizeT}return B.kind==="source"&&(E=R.possiblyEvaluate(new Ji(this.zoom,{worldview:this.worldview}),y).evaluate(g,{},y,j)),E*N}updateFootprints(l,u){}updateReplacement(l,u){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(l.toUnwrapped(),!0);return!qP(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(l){return typeof l=="string"?Wc.build(l):l}populate(l,u,g,y){const j=this.layers[0],N=j.layout,E=this.projection.name==="globe",R=N.get("text-font"),B=N.get("text-field"),H=N.get("icon-image"),[G,X]=N.get("icon-size-scale-range"),J=_e(u.scaleFactor||1,G,X),se=(B.value.kind!=="constant"||B.value.value instanceof Hc&&!B.value.value.isEmpty()||B.value.value.toString().length>0)&&(R.value.kind!=="constant"||R.value.value.length>0),pe=H.value.kind!=="constant"||!!H.value.value||Object.keys(H.parameters).length>0,ke=this.hasAnyAppearanceProperty("icon-image"),we=N.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!se&&!pe&&!ke)return;const Oe=u.iconDependencies,ze=u.glyphDependencies,qe=u.availableImages,dt=new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),it=pt=>{const wt=pt.id.toString();Oe.has(wt)?Oe.get(wt).push(pt):Oe.set(wt,[pt])};for(const pt of l){const{feature:wt,id:St,index:Gt,sourceLayerIndex:Pt}=pt,Jt=j._featureFilter.needGeometry,or=It(wt,Jt);if(!j._featureFilter.filter(dt,or,g))continue;if(Jt||(or.geometry=_t(wt,g,y)),E&&wt.type!==1&&g.z<=5){const pr=or.geometry,Tr=.98078528056,jr=(dn,Fr)=>Ce(M3(dn.x,dn.y,g,1),M3(Fr.x,Fr.y,g,1)){if(!pr.getProperty("icon-image"))return;const Tr=this.getCombinedIconPrimary(pr,yr,or,g,qe,Qt,J);Tr&&it(Tr)}),lr){const pr=R.evaluate(or,{},g).join(","),Tr=N.get("text-rotation-alignment")==="map"&&N.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(du.vertical)>=0;for(const jr of lr.sections)if(jr.image){const dn=jr.image.getPrimary().scaleSelf(this.pixelRatio),Fr=dn.id.toString(),Hr=Oe.get(Fr)||[];Hr.push(dn),Oe.set(Fr,Hr)}else{const dn=yv(lr.toString()),Fr=jr.fontStack||pr,Hr=ze[Fr]=ze[Fr]||{};this.calculateGlyphDependencies(jr.text,Hr,Tr,this.allowVerticalPlacement,dn)}}}if(N.get("symbol-placement")==="line"&&(this.features=function(pt){const wt={},St={},Gt=[];let Pt=0;function Jt(yr){Gt.push(pt[yr]),Pt++}function or(yr,hr,fr){const Qt=St[yr];return delete St[yr],St[hr]=Qt,Gt[Qt].geometry[0].pop(),Gt[Qt].geometry[0]=Gt[Qt].geometry[0].concat(fr[0]),Qt}function lr(yr,hr,fr){const Qt=wt[hr];return delete wt[hr],wt[yr]=Qt,Gt[Qt].geometry[0].shift(),Gt[Qt].geometry[0]=fr[0].concat(Gt[Qt].geometry[0]),Qt}function gr(yr,hr,fr){const Qt=fr?hr[0][hr[0].length-1]:hr[0][0];return`${yr}:${Qt.x}:${Qt.y}`}for(let yr=0;yryr.geometry)}(this.features)),N.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",u.elevationFeatures){!this.elevationFeatures&&u.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const pt of u.elevationFeatures)this.elevationFeatureIdToIndex.set(pt.id,this.elevationFeatures.length),this.elevationFeatures.push(pt)}}else N.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((pt,wt)=>pt.sortKey-wt.sortKey)}getCombinedIconPrimary(l,u,g,y,j,N,E){let R,B;const H=l.getUnevaluatedProperties();if(H._values["icon-image"].value!==void 0){const G=u.getAppearanceValueAndResolveTokens(l,"icon-image",g,y,j);R=this.getResolvedImageFromTokens(G)}else{const G=u.getValueAndResolveTokens("icon-image",g,y,j);R=this.getResolvedImageFromTokens(G)}if(R){const G=H._values["icon-size"]||u._unevaluatedLayout._values["icon-size"];B=X3(R,NN(this.zoom,G,this.worldview),G,y,this.zoom,N,this.pixelRatio,E,this.worldview).iconPrimary}return B}updateAppearanceBasedIconTextures(l,u,g,y){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const j=this.layers[0];let N=!1,E=0;const R=j.layout,[B,H]=R.get("icon-size-scale-range"),G=_e(1,B,H);for(let X=0;X=0){const ke=pe.id,we=u&&ke!==void 0?u[String(ke)]:void 0,Oe={type:"Point",id:pe.id,properties:pe.properties,geometry:[]},ze=this.layers[0].appearances&&this.layers[0].appearances.find(qe=>qe.isActive({globals:y,feature:Oe,canonical:l,featureState:we}));if(pe.activeAppearance===ze){E+=J.numIconVertices;continue}if(ze){pe.activeAppearance=ze;const qe=this.getCombinedIconPrimary(ze,j,Oe,l,g,{sortKey:void 0,text:void 0,icon:null,index:J.featureIndex,sourceLayerIndex:J.featureIndex,geometry:[],properties:pe.properties,type:"Point",id:pe.id},G);if(!qe)continue;const dt=qe.toString(),it=this.iconAtlasPositions&&this.iconAtlasPositions.get(dt);if(it){const pt=j.getAppearanceValueAndResolveTokens(ze,"icon-offset",Oe,l,g),wt=pt&&Array.isArray(pt)?pt:[0,0];let St=i6(it,void 0,wt,j.layout.get("icon-anchor").evaluate(Oe,{},l));const Gt=j.getAppearanceValueAndResolveTokens(ze,"icon-rotate",Oe,l,g),Pt=typeof Gt=="number"?Gt:0,Jt=it.sdf,or=j.layout.get("icon-text-fit").constantOr("none");or!=="none"&&pe.textShaping&&pe.iconTextFitPadding&&pe.fontScale&&(St=noe(St,pe.textShaping,or,pe.iconTextFitPadding,wt,pe.fontScale));const lr=this.calculateEffectiveAppearanceIconSize(ze,y.zoom,Oe,l,g,G),gr=0,yr=1+(Math.min(rx,Math.round(lr*Sp))<<1),hr=ooe(St,Pt,Jt,or!=="none",G);pe.isUsingAppearanceVertexData||(pe.isUsingAppearanceVertexData=!0,pe.layoutBasedVertexData=this.icon.getIconVertexData(E,J.numIconVertices));for(let Qt=0;Qt0&&(this.icon.updateIconVertexData(E,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(E+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(E+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(E+3,0,0,0,0,0,0,0,0,0,0,0,0),N=!0),E+=J.numIconVertices,pe.activeAppearance=null;else if(pe.isUsingAppearanceVertexData){const dt=pe.layoutBasedVertexData.length/12;for(let it=0;it0||X>0,ke=J>0,we=this.elevationFeatures[R.elevationFeatureIndex];if(we){const Oe=new ir(R.tileAnchorX,R.tileAnchorY),ze=.075+we.pointElevation(Oe);R.zOffset!==ze&&(u=!0,R.zOffset=ze),ze!==0&&(this.hasAnyZOffset=!0);const qe=we.computeSlopeNormal(Oe,y),dt=qn(Ot(),ie(0,0,1),qe);ft(B,B,dt),ft(H,H,dt),B[2]*=g,H[2]*=g,B[0]===1&&B[1]===0&&B[2]===0&&H[0]===0&&H[1]===1&&H[2]===0||(j=j||pe,N=N||ke)}if(pe&&(p6(this.text.orientationVertexArray,G,B,H),p6(this.text.orientationVertexArray,X,B,H)),ke){const{placedIconSymbolIndex:Oe,verticalPlacedIconSymbolIndex:ze}=R;Oe>=0&&p6(this.icon.orientationVertexArray,J,B,H),ze>=0&&p6(this.icon.orientationVertexArray,se,B,H)}}j||(this.text.orientationVertexArray=void 0),N||(this.icon.orientationVertexArray=void 0),u&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const l=(j,N,E)=>{g+=N,g>j.length&&j.resize(g);for(let R=-N;R<0;R++)j.emplace(R+g,E)},u=(j,N,E)=>{y+=N,y>j.length&&j.resize(y);for(let R=-N;R<0;R++)j.emplace(R+y,E)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,y=0;for(let j=0;j0;if((E>0||R>0)&&(l(this.text.zOffsetVertexArray,E,H),l(this.text.zOffsetVertexArray,R,H)),G){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:J}=N;X>=0&&u(this.icon.zOffsetVertexArray,B,H),J>=0&&u(this.icon.zOffsetVertexArray,N.numVerticalIconVertices,H)}}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(l,u,g,y,j){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(l),this.iconCollisionBox.upload(l)),this.text.upload(l,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(N=>N.appearances&&N.appearances.length>0)),this.icon.upload(l,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(l,u,g,y){return!!(l&&u&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(l,u,g,y)&&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=Qve(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(l,u){const g=this.lineVertexArray.length;if(l.segment!==void 0)for(const{x:y,y:j}of u)this.lineVertexArray.emplaceBack(y,j);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe,ke,we,Oe){const ze=l.indexArray,qe=l.layoutVertexArray,dt=l.globeExtVertexArray,it=l.segments.prepareSegment(4*Oe,qe,ze,this.canOverlap?N.sortKey:void 0),pt=this.glyphOffsetArray.length,wt=it.vertexLength,St=this.allowVerticalPlacement&&E===du.vertical?Math.PI/2:0,Gt=N.text&&N.text.sections;for(let or=0;or=0?u.rightJustifiedTextSymbolIndex:u.centerJustifiedTextSymbolIndex>=0?u.centerJustifiedTextSymbolIndex:u.leftJustifiedTextSymbolIndex>=0?u.leftJustifiedTextSymbolIndex:u.verticalPlacedTextSymbolIndex>=0?u.verticalPlacedTextSymbolIndex:y),N=soe(this.textSizeData,l,j)/ul;return this.tilePixelRatio*N}getSymbolInstanceIconSize(l,u,g){const y=this.icon.placedSymbolArray.get(g),j=soe(this.iconSizeData,l,y);return this.tilePixelRatio*j}_commitDebugCollisionVertexUpdate(l,u,g,y){l.emplaceBack(u,-g,-g,y),l.emplaceBack(u,g,-g,y),l.emplaceBack(u,g,g,y),l.emplaceBack(u,-g,g,y)}_updateTextDebugCollisionBoxes(l,u,g,y,j,N,E){for(let R=y;R0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(l,u){const g=l.placedSymbolArray.get(u),y=g.vertexStartIndex+4*g.numGlyphs;for(let j=g.vertexStartIndex;jy[E]-y[R]||j[R]-j[E]),N}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let l=0;lthis.symbolInstances.get(u).zOffset-this.symbolInstances.get(l).zOffset)}addToSortKeyRanges(l,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=l+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:l,symbolInstanceEnd:l+1})}sortFeatures(l){if(this.sortFeaturesByY&&this.sortedAngle!==l&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(l),this.sortedAngle=l,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const u of this.symbolInstanceIndexes){const g=this.symbolInstances.get(u);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:y,centerJustifiedTextSymbolIndex:j,leftJustifiedTextSymbolIndex:N,verticalPlacedTextSymbolIndex:E,placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:B}=g;y>=0&&this.addIndicesForPlacedSymbol(this.text,y),j>=0&&j!==y&&this.addIndicesForPlacedSymbol(this.text,j),N>=0&&N!==j&&N!==y&&this.addIndicesForPlacedSymbol(this.text,N),E>=0&&this.addIndicesForPlacedSymbol(this.text,E),R>=0&&this.addIndicesForPlacedSymbol(this.icon,R),B>=0&&this.addIndicesForPlacedSymbol(this.icon,B)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(l){const u=this.symbolInstances.get(this.text.symbolInstanceIndices[l]).elevationFeatureIndex;let g;return this.elevationFeatures&&ug in f?String(f[g]):"")}let e_e,t_e,foe;Xr(m6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),m6.addDynamicAttributes=AN;class r_e{constructor(l){this.type=l.property.overrides?l.property.overrides.runtimeType:vh,this.defaultValue=l}evaluate(l){if(l.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(l.formattedSection))return u.getOverride(l.formattedSection)}return l.feature&&l.featureState?this.defaultValue.evaluate(l.feature,l.featureState):this.defaultValue.property.specification.default}eachChild(l){this.defaultValue.isConstant()||l(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Xr(r_e,"FormatSectionOverride",{omit:["defaultValue"]});const poe=()=>foe||(foe={layout:e_e||(e_e=new Fa({"symbol-placement":new Nr(Rt.layout_symbol["symbol-placement"]),"symbol-spacing":new Nr(Rt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Nr(Rt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ir(Rt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Nr(Rt.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Nr(Rt.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Nr(Rt.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Nr(Rt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Nr(Rt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Nr(Rt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Nr(Rt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ir(Rt.layout_symbol["icon-size"]),"icon-size-scale-range":new Nr(Rt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ir(Rt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ir(Rt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ir(Rt.layout_symbol["icon-image"]),"icon-image-use-theme":new Nr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ir(Rt.layout_symbol["icon-rotate"]),"icon-padding":new Nr(Rt.layout_symbol["icon-padding"]),"icon-keep-upright":new Nr(Rt.layout_symbol["icon-keep-upright"]),"icon-offset":new Ir(Rt.layout_symbol["icon-offset"]),"icon-anchor":new Ir(Rt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Nr(Rt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Nr(Rt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Nr(Rt.layout_symbol["text-rotation-alignment"]),"text-field":new Ir(Rt.layout_symbol["text-field"]),"text-font":new Ir(Rt.layout_symbol["text-font"]),"text-size":new Ir(Rt.layout_symbol["text-size"]),"text-size-scale-range":new Nr(Rt.layout_symbol["text-size-scale-range"]),"text-max-width":new Ir(Rt.layout_symbol["text-max-width"]),"text-line-height":new Ir(Rt.layout_symbol["text-line-height"]),"text-letter-spacing":new Ir(Rt.layout_symbol["text-letter-spacing"]),"text-justify":new Ir(Rt.layout_symbol["text-justify"]),"text-radial-offset":new Ir(Rt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Nr(Rt.layout_symbol["text-variable-anchor"]),"text-anchor":new Ir(Rt.layout_symbol["text-anchor"]),"text-max-angle":new Nr(Rt.layout_symbol["text-max-angle"]),"text-writing-mode":new Nr(Rt.layout_symbol["text-writing-mode"]),"text-rotate":new Ir(Rt.layout_symbol["text-rotate"]),"text-padding":new Nr(Rt.layout_symbol["text-padding"]),"text-keep-upright":new Nr(Rt.layout_symbol["text-keep-upright"]),"text-transform":new Ir(Rt.layout_symbol["text-transform"]),"text-offset":new Ir(Rt.layout_symbol["text-offset"]),"text-allow-overlap":new Nr(Rt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Nr(Rt.layout_symbol["text-ignore-placement"]),"text-optional":new Nr(Rt.layout_symbol["text-optional"]),visibility:new Nr(Rt.layout_symbol.visibility)})),paint:t_e||(t_e=new Fa({"icon-opacity":new Ir(Rt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ir(Rt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ir(Rt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ir(Rt.paint_symbol["text-emissive-strength"]),"icon-color":new Ir(Rt.paint_symbol["icon-color"]),"icon-halo-color":new Ir(Rt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ir(Rt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ir(Rt.paint_symbol["icon-halo-blur"]),"icon-translate":new Nr(Rt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Nr(Rt.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Nr(Rt.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ir(Rt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ir(Rt.paint_symbol["text-occlusion-opacity"]),"text-color":new Ir(Rt.paint_symbol["text-color"],{runtimeType:gd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Ir(Rt.paint_symbol["text-halo-color"]),"text-halo-width":new Ir(Rt.paint_symbol["text-halo-width"]),"text-halo-blur":new Ir(Rt.paint_symbol["text-halo-blur"]),"text-translate":new Nr(Rt.paint_symbol["text-translate"]),"text-translate-anchor":new Nr(Rt.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Nr(Rt.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Nr(Rt.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Nr(Rt.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Nr(Rt.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ir(Rt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"})}))},foe);class g6 extends Zc{constructor(l,u,g,y){super(l,poe(),u,g,y,l.layout?l.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=T([]),this.hasOcclusionOpacityProperties=l.paint!==void 0&&("icon-occlusion-opacity"in l.paint||"text-occlusion-opacity"in l.paint)}_handleSpecialPaintPropertyUpdate(l){l!=="icon-occlusion-opacity"&&l!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(l,u){super.recalculate(l,u),this.appearances&&this.appearances.forEach(y=>{y.recalculate(l,u,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const g=this.layout.get("text-writing-mode");if(g){const y=[];for(const j of g)y.indexOf(j)<0&&y.push(j);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(l,u,g,y){return this._saturation===l&&this._contrast===u&&this._brightnessMin===g&&this._brightnessMax===y||(this._colorAdjustmentMatrix=function(j,N,E,R){j=ha(j),N=Ws(N);const B=C(),H=j/3,G=1-2*H,X=[G,H,H,0,H,G,H,0,H,H,G,0,0,0,0,1],J=.5-.5*N,se=R-E;return A(B,[se,0,0,0,0,se,0,0,0,0,se,0,E,E,E,1],[N,0,0,0,0,N,0,0,0,0,N,0,J,J,J,1]),A(B,B,X),B}(l,u,g,y),this._saturation=l,this._contrast=u,this._brightnessMin=g,this._brightnessMax=y),this._colorAdjustmentMatrix}getValueAndResolveTokens(l,u,g,y){const j=this.layout.get(l).evaluate(u,{},g,y),N=this._unevaluatedLayout._values[l];return N.isDataDriven()||gv(N.value)||!j?j:Jve(u.properties,j)}getAppearanceValueAndResolveTokens(l,u,g,y,j){const N=l.getProperty(u);if(!N)return;const E=N.evaluate(g,{},y,j),R=l.getUnevaluatedProperties()._values[u];return R.isDataDriven()||gv(R.value)||!E||typeof E!="string"?E:Jve(g.properties,E)}createBucket(l){return new m6(l)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const l of poe().paint.overridableProperties){if(!g6.hasPaintOverride(this.layout,l))continue;const u=this.paint.get(l),g=new r_e(u),y=new Rk(g,u.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let j=null;j=u.value.kind==="constant"||u.value.kind==="source"?new Sy("source",y):new qg("composite",y,u.value.zoomStops,u.value.interpolationType),this.paint._values[l]=new Hg(u.property,j,u.parameters)}}_handleOverridablePaintPropertyUpdate(l,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&g6.hasPaintOverride(this.layout,l)}static hasPaintOverride(l,u){const g=l.get("text-field"),y=poe().paint.properties[u];let j=!1;const N=E=>{for(const R of E)if(y.overrides&&y.overrides.hasOverride(R))return void(j=!0)};if(g.value.kind==="constant"&&g.value.value instanceof Hc)N(g.value.value.sections);else if(g.value.kind==="source"){const E=B=>{j||(B instanceof dp&&dl(B.value)===tv?N(B.value.sections):B instanceof lf?N(B.sections):B.eachChild(E))},R=g.value;R._styleExpression&&E(R._styleExpression.expression)}return j}getProgramIds(){return["symbol"]}getDefaultProgramParams(l,u,g){return{config:new Fm(this,{zoom:u,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let n_e,s_e,i_e,a_e;var moe=Ss([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function x6(f,l,u,g,y,j,N,E){const R=[f,l,1,u,g,1,y,j,1],B=[N,E,1],H=w([],R),[G,X,J]=ge(B,B,H);return k(R,R,[G,0,0,0,X,0,0,0,J])}function o_e(f,l,u,g,y,j,N,E){const R=function(B,H,G,X,J,se,pe,ke){const we=x6(0,0,1,0,1,1,0,1),Oe=x6(B,H,G,X,J,se,pe,ke);return k(Oe,Oe,w([],we))}(f,l,u,g,y,j,N,E);return[R[2]/R[8]/Mr,R[5]/R[8]/Mr]}function y6(f){return[f[0],Math.min(Math.max(f[1],-de),de)]}class l_e extends Rg{constructor(l,u,g,y){super(),this.id=l,this.dispatcher=g,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(y),this.options=u,this._dirty=!1}load(l,u){if(this._loaded=u||!1,this.fire(new af("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return l&&(this.coordinates=l),this._loaded=!0,void this._finishLoading();this._imageRequest=vs(this.map._requestManager.transformRequest(this.url,Og.Image),(g,y)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new Q1(g)):y&&(this.image=y instanceof HTMLImageElement?Do.getImageData(y):y,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,l&&(this.coordinates=l),this._finishLoading())})}loaded(){return this._loaded}updateImage(l){return l.url?(this._imageRequest&&l.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=l.url,this.load(l.coordinates,this._loaded),this):this}setTexture(l){if(!(l.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new V3(this.map.painter.context,l.handle),this.width=l.dimensions[0],this.height=l.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new af("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(l){this.map=l,this.load()}onRemove(l){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof V3||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(l){if(this.coordinates=l,this._boundsArray=void 0,this._unsupportedCoords=!1,!l.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let u=l[0][1],g=l[0][1];for(const j of l)j[1]>g&&(g=j[1]),j[1]de?this.onNorthPole=!0:y<-de&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const j=l.map($e.fromLngLat);this.tileID=function(N){let E=1/0,R=1/0,B=-1/0,H=-1/0;for(const pe of N)E=Math.min(E,pe.x),R=Math.min(R,pe.y),B=Math.max(B,pe.x),H=Math.max(H,pe.y);const G=Math.max(B-E,H-R),X=Math.max(0,Math.floor(-Math.log2(G))),J=Math.pow(2,X);let se=Math.floor((E+B)/2*J);return se>1&&(se-=1),new Ui(X,se,Math.floor((R+H)/2*J))}(j),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new af("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof V3||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(l){for(const we in this.tiles){const Oe=this.tiles[we];Oe.state!=="loaded"&&(Oe.state="loaded",Oe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const u=J3(new Ui(0,0,0),this.map.transform.projection),g=[u.projection.project(this.coordinates[0][0],this.coordinates[0][1]),u.projection.project(this.coordinates[1][0],this.coordinates[1][1]),u.projection.project(this.coordinates[2][0],this.coordinates[2][1]),u.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(we){const Oe=we[1].x-we[0].x,ze=we[1].y-we[0].y,qe=we[2].x-we[1].x,dt=we[2].y-we[1].y,it=we[3].x-we[2].x,pt=we[3].y-we[2].y,wt=we[0].x-we[3].x,St=we[0].y-we[3].y,Gt=Oe*dt-qe*ze,Pt=qe*pt-it*dt,Jt=it*St-wt*pt,or=wt*ze-Oe*St;return Gt>0&&Pt>0&&Jt>0&&or>0||Gt<0&&Pt<0&&Jt<0&&or<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const y=J3(this.tileID,this.map.transform.projection),[j,N,E,R]=this.coordinates.map(we=>{const Oe=y.projection.project(we[0],we[1]);return Gve(y,Oe)._round()});this.perspectiveTransform=o_e(j.x,j.y,N.x,N.y,E.x,E.y,R.x,R.y);const B=this._boundsArray=new Ay;B.emplaceBack(j.x,j.y,0,0),B.emplaceBack(N.x,N.y,Mr,0),B.emplaceBack(R.x,R.y,0,Mr),B.emplaceBack(E.x,E.y,Mr,Mr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=l.createVertexBuffer(B,moe.members),this.boundsSegments=ka.simpleSegment(0,0,4,2);const H=[],G=[y6((X=this.coordinates)[0]),y6(X[1]),y6(X[2]),y6(X[3])];var X;const[J,se,pe,ke]=function(we){let Oe=we[0][0],ze=Oe,qe=we[0][1],dt=qe;for(let it=1;itze&&(ze=we[it][0]),we[it][1]dt&&(dt=we[it][1]);return[Oe,qe,ze-Oe,dt-qe]}(G);{const we=new Ay,[Oe,ze,qe,dt]=function(hr){let fr=hr[0].x,Qt=fr,Kt=hr[0].y,pr=Kt;for(let Tr=1;TrQt&&(Qt=hr[Tr].x),hr[Tr].ypr&&(pr=hr[Tr].y);return[fr,Kt,Qt-fr,pr-Kt]}(g),it=hr=>[(hr.x-Oe)/qe,(hr.y-ze)/dt],[pt,wt,St,Gt]=g.map(it),Pt=function(hr,fr,Qt,Kt,pr,Tr,jr,dn){const Fr=x6(0,0,1,0,1,1,0,1);return k(Fr,Fr,w([],x6(hr,fr,Qt,Kt,pr,Tr,jr,dn)))}(pt[0],pt[1],wt[0],wt[1],St[0],St[1],Gt[0],Gt[1]);this.elevatedGlobePerspectiveTransform=o_e(pt[0],pt[1],wt[0],wt[1],St[0],St[1],Gt[0],Gt[1]);const Jt=(hr,fr)=>{H.push(hr.lng);const Qt=Math.round((hr.lng-J)/pe*Mr),Kt=Math.round((hr.lat-se)/ke*Mr),pr=it(fr),Tr=ge([],[pr[0],pr[1],1],Pt),jr=Math.round(Tr[0]/Tr[2]*Mr),dn=Math.round(Tr[1]/Tr[2]*Mr);we.emplaceBack(Qt,Kt,jr,dn)},or=g[3].x-g[0].x,lr=g[3].y-g[0].y,gr=g[2].x-g[1].x,yr=g[2].y-g[1].y;for(let hr=0;hr<65;hr++){const fr=hr/64,Qt=[g[0].x+fr*or,g[0].y+fr*lr],Kt=[g[1].x+fr*gr,g[1].y+fr*yr],pr=Kt[0]-Qt[0],Tr=Kt[1]-Qt[1];for(let jr=0;jr<65;jr++){const dn=jr/64,Fr={x:Qt[0]+pr*dn,y:Qt[1]+Tr*dn};Jt(u.projection.unproject(Fr.x,Fr.y),Fr)}}this.elevatedGlobeVertexBuffer=l.createVertexBuffer(we,moe.members)}{this.maxLongitudeTriangleSize=0;let we=[],Oe=new Ro;const ze=(qe,dt,it)=>{Oe.emplaceBack(qe,dt,it);const pt=H[qe],wt=H[dt],St=H[it],Gt=Math.min(Math.min(pt,wt),St),Pt=Math.max(Math.max(pt,wt),St)-Gt;Pt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Pt),we.push(Gt+Pt/2)};for(let qe=0;qe<64;qe++)for(let dt=0;dt<64;dt++){const it=65*qe+dt,pt=it+1,wt=it+65,St=wt+1;ze(it,wt,pt),ze(pt,wt,St)}[we,Oe]=function(qe,dt){const it=Array.from({length:qe.length},(St,Gt)=>Gt);it.sort((St,Gt)=>qe[St]-qe[Gt]);const pt=[],wt=new Ro;for(let St=0;St{N.segments.push({vertexOffset:0,primitiveOffset:G,vertexLength:u.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},R=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-y)<=R){const G=va(g,0,g.length,y+R);return G===g.length||E(G,oo(g,G+1,g.length,y+360-R)-G),N}yMr?y-Mr:y,new ir(Math.trunc(y),Math.trunc(g[u+1]))}translationForInstance(l){const u=16*l,g=this.instancedDataArray.float32;return[g[u+4],g[u+5],g[u+6]]}rotationScaleForInstance(l){const u=16*l,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+10],g[u+11],g[u+12],g[u+13],g[u+14],g[u+15]]}transformForInstance(l){const u=16*l,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+4],g[u+10],g[u+11],g[u+12],g[u+5],g[u+13],g[u+14],g[u+15],g[u+6],0,0,0,1]}}class yoe{constructor(l){this.zoom=l.zoom,this.canonical=l.canonical,this.overscaledZ=this.canonical.z+Math.log2(l.overscaling),this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.projection=l.projection,this.index=l.index,this.worldview=l.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=l.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(l,u){}updateAppearances(l,u,g,y){}populate(l,u,g,y){this.tileToMeter=Ee(g);const j=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:N,id:E,index:R,sourceLayerIndex:B}of l){const H=E??(N.properties&&N.properties.hasOwnProperty("id")?N.properties.id:void 0),G=It(N,j);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:H,sourceLayerIndex:B,index:R,geometry:j?G.geometry:_t(N,g,y),properties:N.properties,type:N.type,patterns:{}},J=this.addFeature(X,X.geometry,G);J&&u.featureIndex.insert(N,X.geometry,R,B,this.index,this.instancesPerModel[J].instancedDataArray.length,Mr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const l=this.layers[0].modelManager,u=this.layers[0].scope;let g=0;for(const y of this.modelUris){const j=l.getModel(y,u);if(!j)continue;const N=this.instancesPerModel[y];if(N){const E=.5*Te(j.aabb.max,j.aabb.min)*N.maxScale+N.maxXYTranslationDistance,R=Math.min(Mr,Math.max(E/this.tileToMeter,Mr/32));g=Math.max(R,g)}}return g}update(l,u,g,y){for(const j in this.instancesPerModel){const N=this.instancesPerModel[j];for(const E in l)N.idToFeaturesIndex.hasOwnProperty(E)&&(this.evaluate(N.features[N.idToFeaturesIndex[E]],l[E],N,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let l=!1;for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];for(const y of g.features){const j=this.layers[0],N=y.feature,E=this.canonical,R=j.paint.get("model-rotation").evaluate(N,{},E),B=j.paint.get("model-scale").evaluate(N,{},E),H=j.paint.get("model-translation").evaluate(N,{},E);Ve(y.rotation,R)&&Ve(y.scale,B)&&Ve(y.translation,H)||(this.evaluate(y,y.featureStates,g,!0),l=!0)}}return l}updateReplacement(l,u,g,y){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const j=u.getReplacementRegionsForTile(l.toUnwrapped(),!0);if(qP(this.activeReplacements,j))return!1;this.activeReplacements=j;let N=!1;for(const E in this.instancesPerModel){const R=this.instancesPerModel[E],B=R.instancedDataArray;for(const H of R.features){const G=H.instancedDataOffset,X=H.instancedDataCount;for(let J=0;JMr;pe=ke?pe-Mr:pe;const we=Math.floor(pe),Oe=Math.floor(B.float32[se+1]);let ze=!1;for(const qe of this.activeReplacements)if(!s1e(qe,g,g_e.Model,y)&&!(qe.min.x>we||we>qe.max.x||qe.min.y>Oe||Oe>qe.max.y)&&(ze=c1e(l1e(we,Oe,l.canonical,qe.footprintTileId.canonical),qe.footprint),ze))break;B.float32[se]=ze?pe+Mr:pe,N=N||ze!==ke}}}return N}isEmpty(){for(const l in this.instancesPerModel)if(this.instancesPerModel[l].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(l){if(!this.uploaded)for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=l.createVertexBuffer(g.instancedDataArray,RUe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(l){for(const g in this.instancesPerModel){const y=this.instancesPerModel[g];y.instancedDataArray.length!==0&&y.instancedDataBuffer&&y.instancedDataBuffer.destroy()}const u=this.layers[0].modelManager;if(l&&u&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)u.removeModel(g,"",!0)}addFeature(l,u,g){const y=this.layers[0],j=y.layout.get("model-id").evaluate(g,{},this.canonical);if(!j)return $r(`modelId is not evaluated for layer ${y.id} and it is not going to get rendered.`),j;(xoe(j,!1)||this.styleDefinedModelURLs[j]!==void 0)&&(this.modelUris.includes(j)||this.modelUris.push(j)),this.instancesPerModel[j]||(this.instancesPerModel[j]=new y_e);const N=this.instancesPerModel[j],E=N.instancedDataArray,R=new x_e(g,E.length);for(const B of u)for(const H of B){if(H.x<0||H.x>=Mr||H.y<0||H.y>=Mr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Mr,J=this.lookupDim*(H.y*X|0)+H.x*X|0;if(this.lookup){if(this.lookup[J]!==0)continue;this.lookup[J]=1}}this.instanceCount++;const G=E.length;E.resize(G+1),N.instancesEvaluatedElevation.push(0),E.float32[16*G]=H.x,E.float32[16*G+1]=H.y}return R.instancedDataCount=N.instancedDataArray.length-R.instancedDataOffset,R.instancedDataCount>0&&(l.id&&(N.idToFeaturesIndex[l.id]=N.features.length),N.features.push(R),this.evaluate(R,{},N,!1)),j}getModelUris(){return this.modelUris}evaluate(l,u,g,y){const j=this.layers[0],N=l.feature,E=this.canonical,R=l.rotation=j.paint.get("model-rotation").evaluate(N,u,E),B=l.scale=j.paint.get("model-scale").evaluate(N,u,E),H=l.translation=j.paint.get("model-translation").evaluate(N,u,E),G=Object.assign({},j.paint.get("model-color").evaluate(N,u,E));G.a=j.paint.get("model-color-mix-intensity").evaluate(N,u,E);const X=[];this.maxVerticalOffset0?Math.sqrt(J):0;g.maxScale=Math.max(Math.max(g.maxScale,B[0]),Math.max(B[1],B[2])),g.maxXYTranslationDistance=Math.max(g.maxXYTranslationDistance,se),this.maxScale=Math.max(Math.max(this.maxScale,B[0]),Math.max(B[1],B[2])),Z1e(X,R,B);const pe=Math.round(100*G.a)+G.b/1.05;for(let ke=0;ke10?this.tileToMeter:Ee(E,dt)),ze[Oe+4]=H[0],ze[Oe+5]=H[1],ze[Oe+6]=H[2]+qe,ze[Oe+7]=X[0],ze[Oe+8]=X[1],ze[Oe+9]=X[2],ze[Oe+10]=X[4],ze[Oe+11]=X[5],ze[Oe+12]=X[6],ze[Oe+13]=X[8],ze[Oe+14]=X[9],ze[Oe+15]=X[10],g.instancesEvaluatedElevation[we]=H[2]}}}let v_e,__e;Xr(yoe,"ModelBucket",{omit:["layers"]}),Xr(y_e,"PerModelAttributes"),Xr(x_e,"ModelFeature");class EN{constructor(l,u,g){this._demTile=l,this._dem=this._demTile.dem,this._scale=u,this._offset=g}static create(l,u,g){const y=g||l.findDEMTileFor(u);if(!y||!y.dem)return;const j=y.dem,N=y.tileID,E=1<B.fqid),this.stateDependentLayerIds=this.layers.filter(B=>B.isStateDependent()).map(B=>B.id),this.modelTraits|=wN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,y&&(this.modelTraits|=wN.HasMapboxMeshFeatures),j&&(this.modelTraits|=wN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=N,this.worldview=R,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const B of u)this.nodesInfo.push(new k_e(B)),w_e(B,E.featureIndexArray.length,E.grid),E.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,E.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(l,u){for(const g of this.getNodesInfo()){const y=g.node;y.footprint&&u.push({footprint:y.footprint,id:l})}}updateAppearances(l,u,g,y){}update(l){const u=Object.keys(l).length!==0;if(u&&!this.stateDependentLayers.length)return;const g=u?this.stateDependentLayers:this.layers;if(!ho(l,this.states))for(const y of g)this.evaluate(y,l);this.states=structuredClone(l)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(l){if(!this.needsUpload)return;const u=this.getNodesInfo();for(const g of u){const y=g.node;this.uploaded?this.updatePbrBuffer(y):qae(y,l,!0)}for(const g of u)t6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(l){let u=!1;if(!l.meshes)return u;for(const g of l.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),u=!0);return u}needsReEvaluation(l,u,g){const y=l.transform.projectionOptions,j=l.style.getBrightness(),N=this.brightness!==j;if(!this.uploaded||this.dirty||y.name!==this.projection.name||oM(g.paint.get("model-color").value,N)||oM(g.paint.get("model-color-mix-intensity").value,N)||oM(g.paint.get("model-roughness").value,N)||oM(g.paint.get("model-emissive-strength").value,N)||oM(g.paint.get("model-height-based-emissive-strength-multiplier").value,N)){this.projection=y,this.brightness=j;const E=this.getNodesInfo();for(const R of E)R.state=null;return!0}return!1}evaluateTransform(l,u){if(l.transform.zoom===this.zoom)return;this.zoom=l.transform.zoom;const g=this.getNodesInfo(),y=this.id.canonical;for(const j of g){const N=j.feature;j.evaluatedTranslation=u.paint.get("model-translation").evaluate(N,{},y),j.evaluatedScale=u.paint.get("model-scale").evaluate(N,{},y)}}evaluate(l,u){const g=this.getNodesInfo();for(const y of g){if(!y.node.meshes)continue;const j=y.feature,N=u&&u[j.id];if(ho(N,y.state))continue;y.state=structuredClone(N);const E=y.node.meshes&&y.node.meshes[0].featureData,R=y.evaluatedColor[2],B=y.evaluatedRMEA[2],H=this.id.canonical;if(y.hasTranslucentParts=!1,E){for(let G=0;G=it)continue;const hr=voe[yr],fr=Math.abs(hr);fr>Pt&&(Gt=hr,Pt=fr,Jt=gr,or=lr)}if(Pt>.1){const lr=1-(it+.5*Math.abs(Jt*or))/se;let gr=u._dem.get(wt,pt)+Gt*lr;const yr=u._dem.get(wt+Jt,pt+or),hr=u._dem.get(wt-Jt,pt-or,!0);(gr-yr)*(gr-hr)>0&&(gr=(yr+hr)/2),voe[St]=u._dem.set(wt,pt,gr),Fv[St]=it}}}}}E&&(u._demTile.needsDEMTextureUpload=!0,u._dem._timestamp=Do.now())}setFilter(l){this.filter=l?Wk(l):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(l=>this.filter.filter(new Ji(this.id.overscaledZ,{worldview:this.worldview}),l.feature,this.id.canonical)):this.nodesInfo}destroy(){const l=this.getNodesInfo();for(const u of l)t6(u.node),Vae(u.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(l,u){if(u.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(l.toUnwrapped());for(const y of this.getNodesInfo()){const j=y.node.footprint;y.hiddenByReplacement=!!j&&!g.find(N=>N.footprint===j)}}getHeightAtTileCoord(l,u){const g=[],y=[0,0,0],j=T([]);for(const N of this.getNodesInfo()){const E=N.node.meshes[0],R=E.transformedAabb;if(lR.max[0]||u>R.max[1])continue;if(N.node.hidden===!0)return{height:1/0,maxHeight:N.feature.properties.height,hidden:!1,verticalScale:N.evaluatedScale[2]};I(j,N.node.globalMatrix),y[0]=l,y[1]=u,Ye(y,y,j);const B=(y[0]-E.aabb.min[0])/(E.aabb.max[0]-E.aabb.min[0])*Ov|0,H=Math.min(63,(y[1]-E.aabb.min[1])/(E.aabb.max[1]-E.aabb.min[1])*Ov|0)*Ov+Math.min(63,B),G=E.heightmap[H];if(!(G<0&&N.node.footprint))return N.hiddenByReplacement?void 0:{height:G,maxHeight:N.feature.properties.height,hidden:!1,verticalScale:N.evaluatedScale[2]};if(N.node.footprint.grid.query(new ir(l,u),new ir(l,u),g),g.length>0)return{height:void 0,maxHeight:N.feature.properties.height,hidden:N.hiddenByReplacement,verticalScale:N.evaluatedScale[2]}}}}function oM(f,l){return f instanceof Sy&&!f.isLightConstant&&l}function mVe(f,l,u,g,y,j,N,E){let R=(61440&l|(61440&l)>>4)>>8,B=(3840&l|(3840&l)>>4)>>4,H=240&l|(240&l)>>4;u[3]>0&&(R=Rn(R,255*u[0],u[3]),B=Rn(B,255*u[1],u[3]),H=Rn(H,255*u[2],u[3]));const G=R<<8|B,X=H<<8|Math.floor(255*g[3]),J=function(it){const pt=_e(it,0,2);return Math.min(Math.round(.5*pt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],se=_e(y[0],0,1),pe=_e(y[1],0,1),ke=_e(y[2],0,1),we=_e(y[3],0,1);let Oe,ze,qe,dt;if(se!==pe&&N!==j&&pe!==se){const it=N-j;ze=1/(it*(pe-se)),qe=-(j+it*se)/(it*(pe-se));const pt=_e(y[4],-1,1);dt=Math.pow(10,pt),Oe=255*ke<<8|255*we}else Oe=65535,ze=0,qe=1,dt=1;if(f.emplaceBack(G,X,J,Oe,ze,qe,dt),E){const it=E.length;E.clear();for(let pt=0;pt>16&65535,H=j?R>>16&65535:65535&R,G=(15&H)<8?15&H:0,X=f.evaluatedRMEA[G],J=f.evaluatedColor[G],se=f.emissionHeightBasedParams[G];let pe;if(E&&G===2&&g.lights&&(pe=new nN,pe.resize(10*g.lights.length)),mVe(N.featureArray,B,J,X,se,N.aabb.min[2],N.aabb.max[2],pe),pe&&E){E=!1;const ke=g.meshes[g.lightMeshIndex];ke.featureArray=pe,ke.featureArray._trim()}}N.featureArray._trim(),y++}}Xr(_6,"Tiled3dModelBucket",{omit:["layers"]}),Xr(k_e,"Tiled3dModelFeature");const xVe=["id","tile","layer","source","sourceLayer","state"];class zv{constructor(l,u,g,y,j){this.type="Feature",this._vectorTileFeature=l,this._z=u,this._x=g,this._y=y,this.properties=l?l.properties:{},this.id=j}clone(){const l=new zv(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(l.state=Object.assign({},this.state)),this.layer&&(l.layer=Object.assign({},this.layer)),this.source&&(l.source=this.source),this.sourceLayer&&(l.sourceLayer=this.sourceLayer),l}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(l){this._geometry=l}toJSON(){const l={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const u of xVe)this[u]!==void 0&&(l[u]=this[u]);return l}}class Bv extends Rg{constructor(l,u,g,y){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=u,this._modelsInfo=new Map}load(){const l=[];for(const u in this._options.models){const g=this._options.models[u],y=this._modelsInfo.get(u);if(y){const j=y.model;j.position=g.position!=null?new p(g.position[0],g.position[1]):new p(0,0),j.orientation=g.orientation!=null?g.orientation:[0,0,0],y.modelSpec=g,Bv.applyModelSpecification(j,g),j.computeBoundsAndApplyParent(),this.models.push(j)}else{const j=H1e(this.map._requestManager.transformRequest(g.uri,Og.Model).url).then(N=>{if(!N)return;const E=Wae(N),R=new Y1e(u,g.uri,g.position,g.orientation,E);Bv.applyModelSpecification(R,g),R.computeBoundsAndApplyParent(),this.models.push(R),this._modelsInfo.set(u,{modelSpec:g,model:R})}).catch(N=>{this.fire(new Q1(new Error(`Could not load model ${u} from ${g.uri}: ${N.message}`)))});l.push(j)}}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new af("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(u=>{this._loaded=!0,this.fire(new Q1(new Error(`Could not load models: ${u.message}`)))})}static applyModelSpecification(l,u){u.nodeOverrides&&Bv.convertNodeOverrides(l,u.nodeOverrides),u.materialOverrides&&Bv.convertMaterialOverrides(l,u.materialOverrides),u.nodeOverrideNames&&(l.nodeOverrideNames=[...u.nodeOverrideNames]),u.materialOverrideNames&&(l.materialOverrideNames=[...u.materialOverrideNames]),u.featureProperties&&(l.featureProperties=u.featureProperties)}static convertNodeOverrides(l,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){l.nodeOverrideNames=[];for(const g of u)l.nodeOverrideNames.push(g)}else Object.entries(u).forEach(([g,y])=>{const j={orientation:[0,0,0]};if(y.hasOwnProperty("orientation")){const N=y.orientation;N&&(j.orientation=N)}l.nodeOverrides.set(g,j)})}static convertMaterialOverrides(l,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){l.materialOverrideNames=[];for(const g of u)l.materialOverrideNames.push(g)}else Object.entries(u).forEach(([g,y])=>{const j={color:new vi(1,1,1),colorMix:0,emissionStrength:0,opacity:1},N=y["model-color"];N!==void 0&&(j.color.r=N[0],j.color.g=N[1],j.color.b=N[2]);const E=y["model-color-mix-intensity"];E!==void 0&&(j.colorMix=E);const R=y["model-emissive-strength"];R!==void 0&&(j.emissionStrength=R);const B=y["model-opacity"];B!==void 0&&(j.opacity=B),l.materialOverrides.set(g,j)})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,u){}serialize(){return this._options}setProperty(l,u){return!1}reload(){const l=jh(this.id,this.scope);this.map.style.clearSource(l),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(l){this.models=[];const u=new Map;for(const g in l){const y=l[g];if(this._modelsInfo.has(g)){const j=this._modelsInfo.get(g);j&&j.modelSpec.uri===y.uri&&u.set(g,j)}}this._modelsInfo=u,this._options.models=l,this._loaded=!1,this.load()}}function _oe(f,l,u,g){const y=1<qe.polygon).flat());const ke=J?E:null,[we,Oe]=P1e(j,g,G,H,B,N,ke,X,se,j.center.lat,f.tileID.canonical),ze=f.queryGeometry;return I1e(we,Oe,ze.isPointQuery()?ze.screenBounds:ze.screenGeometry)}},building:class extends Zc{constructor(f,l,u,g){super(f,{layout:nve||(nve=new Fa({visibility:new Nr(Rt.layout_building.visibility),"building-facade":new Ir(Rt.layout_building["building-facade"]),"building-facade-floors":new Ir(Rt.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ir(Rt.layout_building["building-facade-unit-width"]),"building-facade-window":new Ir(Rt.layout_building["building-facade-window"]),"building-roof-shape":new Ir(Rt.layout_building["building-roof-shape"]),"building-height":new Ir(Rt.layout_building["building-height"]),"building-base":new Ir(Rt.layout_building["building-base"]),"building-flood-light-wall-radius":new Ir(Rt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ir(Rt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ir(Rt.layout_building["building-flip-roof-orientation"])})),paint:sve||(sve=new Fa({"building-opacity":new Nr(Rt.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Nr(Rt.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Nr(Rt.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Nr(Rt.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Nr(Rt.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Nr(Rt.paint_building["building-vertical-scale"]),"building-cast-shadows":new Nr(Rt.paint_building["building-cast-shadows"]),"building-color":new Ir(Rt.paint_building["building-color"]),"building-emissive-strength":new Ir(Rt.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Nr(Rt.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Nr(Rt.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Nr(Rt.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Nr(Rt.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Nr(Rt.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ir({type:"string",default:"default","property-type":"data-driven"})}))},l,u,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new rve(f)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(f){return!0}queryRadius(f){return 0}queryIntersectsFeature(f,l,u,g,y,j,N,E,R){let B=this.layout.get("building-height").evaluate(l,u);const H=this.layout.get("building-base").evaluate(l,u),G=f.tile.getBucket(this).getFootprint(l);if(G){if(G.hiddenFlags!==0)return!1;B=G.height}const[X,J]=P1e(j,g,H,B,new ir(0,0),N,null,[0,0],1,j.center.lat,f.tileID.canonical),se=f.queryGeometry;return I1e(X,J,se.isPointQuery()?se.screenBounds:se.screenGeometry)}},line:class extends Zc{constructor(f,l,u,g){const y=pve();super(f,y,l,u,g),y.layout&&(this.layout=new Wg(y.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(f){if(f==="line-gradient"){const l=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=l._styleExpression&&l._styleExpression.expression instanceof dv,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(f,l){super.recalculate(f,l),this.paint._values["line-floorwidth"]=(()=>{if(W3)return W3;const u=pve();return W3=new fqe(u.paint.properties["line-width"].specification),W3.useIntegerZoom=!0,W3})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new Zae(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,l,u){const g=hve(this);return{config:new Fm(this,{zoom:l,lut:u}),defines:g,overrideFog:!1}}queryRadius(f){const l=f,u=mve(hc("line-width",this,l),hc("line-gap-width",this,l)),g=hc("line-offset",this,l);return u/2+Math.abs(g)+Ll(this.paint.get("line-translate"))}queryIntersectsFeature(f,l,u,g,y,j){if(f.queryGeometry.isAboveHorizon)return!1;const N=lu(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),j.angle,f.pixelToTileUnitsFactor),E=f.pixelToTileUnitsFactor/2*mve(this.paint.get("line-width").evaluate(l,u),this.paint.get("line-gap-width").evaluate(l,u)),R=this.paint.get("line-offset").evaluate(l,u);return R&&(g=function(B,H){const G=[],X=new ir(0,0);for(let J=0;J=3){for(let se=0;se>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function IVe(f,l,u){f===1?(l.rgb_color=k6(u.readVarint()),l.paint="rgb_color"):f===2?(l.linear_gradient_idx=u.readVarint(),l.paint="linear_gradient_idx"):f===3?(l.radial_gradient_idx=u.readVarint(),l.paint="radial_gradient_idx"):f===5?u.readPackedFloat(l.dasharray):f===6?l.dashoffset=u.readFloat():f===7?l.miterlimit=u.readFloat():f===8?l.opacity=u.readVarint():f===9?l.width=u.readFloat():f===10?l.linecap=u.readVarint():f===11&&(l.linejoin=u.readVarint())}function PVe(f,l,u){f===1?l.transform=j6(u,u.readVarint()+u.pos):f===2?l.spread_method=u.readVarint():f===3?l.stops.push(M_e(u,u.readVarint()+u.pos)):f===4?l.x1=u.readFloat():f===5?l.y1=u.readFloat():f===6?l.x2=u.readFloat():f===7&&(l.y2=u.readFloat())}function M_e(f,l){return f.readFields(LVe,{offset:0,opacity:255,rgb_color:boe},l)}function LVe(f,l,u){f===1?l.offset=u.readFloat():f===2?l.opacity=u.readVarint():f===3&&(l.rgb_color=k6(u.readVarint()))}function OVe(f,l,u){f===1?l.transform=j6(u,u.readVarint()+u.pos):f===2?l.spread_method=u.readVarint():f===3?l.stops.push(M_e(u,u.readVarint()+u.pos)):f===4?l.cx=u.readFloat():f===5?l.cy=u.readFloat():f===6?l.r=u.readFloat():f===7?l.fx=u.readFloat():f===8?l.fy=u.readFloat():f===9&&(l.fr=u.readFloat())}function DVe(f,l,u){f===1?l.transform=j6(u,u.readVarint()+u.pos):f===2?l.clip_path_idx=u.readVarint():f===3&&l.children.push(w6(u,u.readVarint()+u.pos))}function RVe(f,l,u){f===1?l.left=l.top=u.readFloat():f===2?l.width=l.height=u.readFloat():f===3?l.top=u.readFloat():f===4?l.height=u.readFloat():f===5?l.mask_type=u.readVarint():f===6?l.mask_idx=u.readVarint():f===7&&l.children.push(w6(u,u.readVarint()+u.pos))}class FVe{static calculate(l={},u=[]){const g=new Map,y=new Map;if(Object.keys(l).length===0)return g;u.forEach(j=>{y.set(j.name,j.rgb_color||new vi(0,0,0))});for(const[j,N]of Object.entries(l))y.has(j)?g.set(y.get(j).toString(),N):console.warn(`Ignoring unknown image variable "${j}"`);return g}}function IN(f,l=255,u){const g=l/255,y=f.toString(),j=u.has(y)?u.get(y).clone():f.clone();return j.a*=g,j.toString()}function cM(f,l){if(!ru()){const u=document.createElement("canvas");return u.width=f,u.height=l,u}return new OffscreenCanvas(f,l)}let koe,dM=null;function Noe(f,l,u,g,y){for(const j of g.children)T_e(f,l,u,j,y)}function T_e(f,l,u,g,y){g.group?(f.save(),function(j,N,E,R,B){const H=R.mask_idx!=null?E.masks[R.mask_idx]:null,G=R.clip_path_idx!=null?E.clip_paths[R.clip_path_idx]:null;if(R.transform&&(N=PN(R.transform).preMultiplySelf(N)),!function(se,pe,ke){return se.opacity!==255||pe||ke}(R,G!=null,H!=null))return void Noe(j,N,E,R,B);const X=cM(j.canvas.width,j.canvas.height),J=X.getContext("2d");Noe(J,N,E,R,B),G&&D_e(J,N,E,G),H&&R_e(J,N,E,H,B),j.globalAlpha=R.opacity/255,j.drawImage(X,0,0)}(f,l,u,g.group,y),f.restore()):g.path&&(f.save(),function(j,N,E,R,B){j.setTransform(N),R.paint_order===_Ve.PAINT_ORDER_FILL_AND_STROKE?(A_e(j,E,R,B),I_e(j,E,R,B)):(I_e(j,E,R,B),A_e(j,E,R,B))}(f,l,u,g.path,y),f.restore())}function A_e(f,l,u,g){const y=u.fill;if(!y)return;const j=y.opacity/255;switch(f.save(),f.beginPath(),F_e(u,f),y.paint){case"rgb_color":f.fillStyle=IN(y.rgb_color,y.opacity,g);break;case"linear_gradient_idx":{const N=l.linear_gradients[y.linear_gradient_idx];N.transform&&f.setTransform(PN(N.transform).preMultiplySelf(f.getTransform())),f.fillStyle=P_e(f,N,j,g);break}case"radial_gradient_idx":{const N=l.radial_gradients[y.radial_gradient_idx];N.transform&&f.setTransform(PN(N.transform).preMultiplySelf(f.getTransform())),f.fillStyle=L_e(f,N,j,g)}}f.fill(E_e(u)),f.restore()}function E_e(f){return f.rule===woe.PATH_RULE_NON_ZERO?"nonzero":f.rule===woe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function I_e(f,l,u,g){const y=u.stroke;if(!y)return;const j=z_e(u);f.lineWidth=y.width,f.miterLimit=y.miterlimit,f.setLineDash(y.dasharray),f.lineDashOffset=y.dashoffset;const N=y.opacity/255;switch(y.paint){case"rgb_color":f.strokeStyle=IN(y.rgb_color,y.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=P_e(f,l.linear_gradients[y.linear_gradient_idx],N,g,!0);break;case"radial_gradient_idx":f.strokeStyle=L_e(f,l.radial_gradients[y.radial_gradient_idx],N,g,!0)}switch(y.linejoin){case b6.LINE_JOIN_MITER_CLIP:case b6.LINE_JOIN_MITER:f.lineJoin="miter";break;case b6.LINE_JOIN_ROUND:f.lineJoin="round";break;case b6.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(y.linecap){case joe.LINE_CAP_BUTT:f.lineCap="butt";break;case joe.LINE_CAP_ROUND:f.lineCap="round";break;case joe.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(j)}function P_e(f,l,u,g,y=!1){if(l.stops.length===1){const X=l.stops[0];return IN(X.rgb_color,X.opacity*u,g)}const{x1:j,y1:N,x2:E,y2:R}=l;let B=new DOMPoint(j,N),H=new DOMPoint(E,R);if(y){const X=PN(l.transform);B=X.transformPoint(B),H=X.transformPoint(H)}const G=f.createLinearGradient(B.x,B.y,H.x,H.y);for(const X of l.stops)G.addColorStop(X.offset,IN(X.rgb_color,X.opacity*u,g));return G}function L_e(f,l,u,g,y=!1){if(l.stops.length===1){const we=l.stops[0];return IN(we.rgb_color,we.opacity*u,g)}const j=PN(l.transform),{fx:N,fy:E,fr:R,cx:B,cy:H,r:G}=l;let X=new DOMPoint(N,E),J=new DOMPoint(B,H),se=R,pe=G;if(y){X=j.transformPoint(X),J=j.transformPoint(J);const we=(j.a+j.d)/2;se=R*we,pe=l.r*we}const ke=f.createRadialGradient(X.x,X.y,se,J.x,J.y,pe);for(const we of l.stops)ke.addColorStop(we.offset,IN(we.rgb_color,we.opacity*u,g));return ke}function O_e(f,l,u,g){const y=g.transform?PN(g.transform).preMultiplySelf(l):l,j=cM(f.canvas.width,f.canvas.height),N=j.getContext("2d");for(const R of g.children)if(R.group)O_e(N,y,u,R.group);else if(R.path){const B=R.path,H=new Path2D;H.addPath(z_e(B),y),N.fill(H,E_e(B))}const E=g.clip_path_idx!=null?u.clip_paths[g.clip_path_idx]:null;E&&D_e(N,y,u,E),f.globalCompositeOperation="source-over",f.drawImage(j,0,0)}function D_e(f,l,u,g){const y=cM(f.canvas.width,f.canvas.height);O_e(y.getContext("2d"),l,u,g),f.globalCompositeOperation="destination-in",f.drawImage(y,0,0)}function R_e(f,l,u,g,y){if(g.children.length===0)return;const j=g.mask_idx!=null?u.masks[g.mask_idx]:null;j&&R_e(f,l,u,j,y);const N=f.canvas.width,E=f.canvas.height,R=cM(N,E),B=R.getContext("2d"),H=g.width,G=g.height,X=g.left,J=g.top,se=new Path2D,pe=new Path2D;pe.rect(X,J,H,G),se.addPath(pe,l),B.clip(se);for(const Oe of g.children)T_e(B,l,u,Oe,y);const ke=B.getImageData(0,0,N,E),we=ke.data;if(g.mask_type===N_e.MASK_TYPE_LUMINANCE)for(let Oe=0;Oel[N])return null}else{const E=1/g[N];let R=(f[N]-u[N])*E,B=(l[N]-u[N])*E;if(R>B){const H=R;R=B,B=H}if(R>y&&(y=R),Bj)return null}return y}function U_e(f,l,u,g,y,j,N,E,R,B,H){const G=g-f,X=y-l,J=j-u,se=N-f,pe=E-l,ke=R-u,we=H[1]*ke-H[2]*pe,Oe=H[2]*se-H[0]*ke,ze=H[0]*pe-H[1]*se,qe=G*we+X*Oe+J*ze;if(Math.abs(qe)<1e-15)return null;const dt=1/qe,it=B[0]-f,pt=B[1]-l,wt=B[2]-u,St=(it*we+pt*Oe+wt*ze)*dt;if(St<0||St>1)return null;const Gt=pt*J-wt*X,Pt=wt*G-it*J,Jt=it*X-pt*G,or=(H[0]*Gt+H[1]*Pt+H[2]*Jt)*dt;return or<0||St+or>1?null:(se*Gt+pe*Pt+ke*Jt)*dt}function q_e(f,l,u){return(f-l)/(u-l)}function V_e(f,l,u,g,y,j,N,E,R){const B=1<{const Oe=ke?1:0,ze=(J+1)*pe-Oe,qe=se*pe,dt=(se+1)*pe-Oe;we[0]=J*pe,we[1]=qe,we[2]=ze,we[3]=dt};let G=new B_e(R);const X=[];for(let J=0;J=1;R/=2){const J=E[E.length-1];G=new B_e(R);for(let se=0;se0;){const{idx:se,t:pe,nodex:ke,nodey:we,depth:Oe}=J.pop();if(this.leaves[se]){V_e(ke,we,Oe,l,u,g,y,G,X);const qe=1<=yr[2])return pe}continue}let ze=0;for(let qe=0;qe=B[H[wt]]&&(H.splice(wt,0,qe),pt=!0);pt||(H[ze]=qe),ze++}}for(let qe=0;qe=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(l+1)}static pack(l,u){const g=[0,0,0,0],y=S6.getUnpackVector(u);let j=Math.floor((l+y[3])/y[2]);return g[2]=j%256,j=Math.floor(j/256),g[1]=j%256,j=Math.floor(j/256),g[0]=j,g}getPixels(){return new B0e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(l,u,g){if(this.dim!==l.dim)throw new Error("dem dimension mismatch");let y=u*this.dim,j=u*this.dim+this.dim,N=g*this.dim,E=g*this.dim+this.dim;switch(u){case-1:y=j-1;break;case 1:j=y+1}switch(g){case-1:N=E-1;break;case 1:E=N+1}const R=-u*this.dim,B=-g*this.dim;for(let H=N;H=1;g--){const y=g===1?1:0,j=g===2?1:0;for(let N=0;N>>1^-(1&f[l]);return f}function QVe(f,l){switch(l){case"uint32":return f;case"uint16":for(let u=0;u>4|(61440&g)>>8|(240&y)<<4|61440&y,f[u+1]=15&g|(3840&g)>>4|(15&y)<<8|(3840&y)<<4}return f;case"uint8":for(let u=0;u>6|(192&y)>>4|(192&j)>>2|192&N,f[u+1]=(48&g)>>4|(48&y)>>2|48&j|(48&N)<<2,f[u+2]=(12&g)>>2|12&y|(12&j)<<2|(12&N)<<4,f[u+3]=3&g|(3&y)<<2|(3&j)<<4|(3&N)<<6}return f;default:throw new Error(`Invalid pixel format, "${l}"`)}}Xr(S6,"DEMData"),Xr(H_e,"DemMinMaxQuadTree",{omit:["dem"]});var Ch=Uint8Array,uM=Uint16Array,JVe=Int32Array,G_e=new Ch([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]),K_e=new Ch([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]),eHe=new Ch([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Z_e=function(f,l){for(var u=new uM(31),g=0;g<31;++g)u[g]=l+=1<>1|(21845&tl)<<1;Q_e[tl]=((65280&(LN=(61680&(LN=(52428&LN)>>2|(13107&LN)<<2))>>4|(3855&LN)<<4))>>8|(255&LN)<<8)>>1}var hM=function(f,l,u){for(var g=f.length,y=0,j=new uM(l);y>R]=B;return N},fM=new Ch(288);for(tl=0;tl<144;++tl)fM[tl]=8;for(tl=144;tl<256;++tl)fM[tl]=9;for(tl=256;tl<280;++tl)fM[tl]=7;for(tl=280;tl<288;++tl)fM[tl]=8;var J_e=new Ch(32);for(tl=0;tl<32;++tl)J_e[tl]=5;var nHe=hM(fM,9),sHe=hM(J_e,5),Coe=function(f){for(var l=f[0],u=1;ul&&(l=f[u]);return l},Mp=function(f,l,u){var g=l/8|0;return(f[g]|f[g+1]<<8)>>(7&l)&u},Moe=function(f,l){var u=l/8|0;return(f[u]|f[u+1]<<8|f[u+2]<<16)>>(7&l)},iHe=["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"],Tp=function(f,l,u){var g=new Error(l||iHe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Tp),!u)throw g;return g},aHe=new Ch(0),oHe=typeof TextDecoder<"u"&&new TextDecoder;try{oHe.decode(aHe,{stream:!0})}catch{}const lHe={gzip_data:"gzip"};class xf extends Error{constructor(l){super(l),this.name="MRTError"}}const cHe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},e2e={uint32:1,uint16:2,uint8:4},dHe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Toe;class C6{constructor(l=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=l}getLayer(l){const u=this.layers[l];if(!u)throw new xf(`Layer '${l}' not found`);return u}getHeaderLength(l){const u=new Uint8Array(l),g=new DataView(l);if(u[0]!==13)throw new xf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(l){const u=new Uint8Array(l),g=this.getHeaderLength(l);if(u.length= ${g} but got buffer of length ${u.length}`);const y=new Toe(u.subarray(0,g)).readFields(UVe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==y.x||this.y!==y.y||this.z!==y.z))throw new xf(`Invalid attempt to parse header ${y.z}/${y.x}/${y.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=y.x,this.y=y.y,this.z=y.z;for(const j of y.layers)this.layers[j.name]=new t2e(j,{cacheSize:this._cacheSize});return this}createDecodingTask(l){const u=[],g=this.getLayer(l.layerName);for(let y of l.blockIndices){const j=g.dataIndex[y],N=j.firstByte-l.firstByte,E=j.lastByte-l.firstByte;if(g._blocksInProgress.has(y))continue;const R={layerName:g.name,firstByte:N,lastByte:E,pixelFormat:g.pixelFormat,blockIndex:y,blockShape:[j.bands.length].concat(g.bandShape),buffer:g.buffer,codec:j.codec.codec,filters:j.filters.map(B=>B.filter)};g._blocksInProgress.add(y),u.push(R)}return new r2e(u,()=>{u.forEach(y=>g._blocksInProgress.delete(y.blockIndex))},(y,j)=>{if(u.forEach(N=>g._blocksInProgress.delete(N.blockIndex)),y)throw y;j.forEach(N=>{this.getLayer(N.layerName).processDecodedData(N)})})}}class t2e{constructor({version:l,name:u,units:g,tileSize:y,pixelFormat:j,buffer:N,dataIndex:E},R){if(this.version=l,this.version!==1)throw new xf(`Cannot parse raster layer encoded with MRT version ${l}`);this.name=u,this.units=g,this.tileSize=y,this.buffer=N,this.pixelFormat=cHe[j],this.dataIndex=E,this.bandShape=[y+2*N,y+2*N,e2e[this.pixelFormat]],this._decodedBlocks=new N6(R?R.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return e2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:l})=>l).flat()}processDecodedData(l){const u=l.blockIndex.toString();this._decodedBlocks.get(u)||this._decodedBlocks.put(u,l.data)}getBlockForBand(l){let u=0;switch(typeof l){case"string":for(const[g,y]of this.dataIndex.entries()){for(const[j,N]of y.bands.entries())if(N===l)return{bandIndex:u+j,blockIndex:g,blockBandIndex:j};u+=y.bands.length}break;case"number":for(const[g,y]of this.dataIndex.entries()){if(l>=u&&lthis.cacheSize)throw new xf(`Number of blocks to decode (${j.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:u,lastByte:g,blockIndices:y}}hasBand(l){const{blockIndex:u}=this.getBlockForBand(l);return u>=0}hasDataForBand(l){const{blockIndex:u}=this.getBlockForBand(l);return u>=0&&!!this._decodedBlocks.get(u.toString())}getBandView(l){const{blockIndex:u,blockBandIndex:g}=this.getBlockForBand(l);if(u<0)throw new xf(`Band not found: ${JSON.stringify(l)}`);const y=this._decodedBlocks.get(u.toString());if(!y)throw new xf(`Data for band ${JSON.stringify(l)} of layer "${this.name}" not decoded.`);const j=this.dataIndex[u],N=this.bandShape.reduce((B,H)=>B*H,1),E=g*N,R=y.subarray(E,E+N);return{data:R,bytes:new Uint8Array(R.buffer).subarray(R.byteOffset,R.byteOffset+R.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:j.offset,scale:j.scale}}}C6.setPbf=function(f){Toe=f};class r2e{constructor(l,u,g){this.tasks=l,this._onCancel=u,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(l,u){this._finalized||(this._onComplete(l,u),this._finalized=!0)}}C6.performDecoding=function(f,l){const u=new Uint8Array(f);return Promise.all(l.tasks.map(g=>{const{layerName:y,firstByte:j,lastByte:N,pixelFormat:E,blockShape:R,blockIndex:B,filters:H,codec:G}=g,X=u.subarray(j,N+1),J=new Uint32Array(R[0]*R[1]*R[2]);let se;if(G!=="gzip_data")throw new xf(`Unhandled codec: ${G}`);return se=function(pe,ke){if(!globalThis.DecompressionStream&&ke==="gzip_data")return Promise.resolve(((qe=function(pt){pt[0]==31&&pt[1]==139&&pt[2]==8||Tp(6,"invalid gzip data");var wt=pt[3],St=10;4&wt&&(St+=2+(pt[10]|pt[11]<<8));for(var Gt=(wt>>3&1)+(wt>>4&1);Gt>0;Gt-=!pt[St++]);return St+(2&wt)}(ze=pe))+8>ze.length&&Tp(6,"invalid gzip data"),function(pt,wt,St,Gt){var Pt=pt.length;if(!Pt||wt.f&&!wt.l)return St||new Ch(0);var Jt=!St,or=Jt||wt.i!=2,lr=wt.i;Jt&&(St=new Ch(3*Pt));var gr,yr,hr=function(Li){var di=St.length;if(Li>di){var gi=new Ch(Math.max(2*di,Li));gi.set(St),St=gi}},fr=wt.f||0,Qt=wt.p||0,Kt=wt.b||0,pr=wt.l,Tr=wt.d,jr=wt.m,dn=wt.n,Fr=8*Pt;do{if(!pr){fr=Mp(pt,Qt,1);var Hr=Mp(pt,Qt+1,3);if(Qt+=3,!Hr){var tn=pt[(er=4+((Qt+7)/8|0))-4]|pt[er-3]<<8,ms=er+tn;if(ms>Pt){lr&&Tp(0);break}or&&hr(Kt+tn),St.set(pt.subarray(er,ms),Kt),wt.b=Kt+=tn,wt.p=Qt=8*ms,wt.f=fr;continue}if(Hr==1)pr=nHe,Tr=sHe,jr=9,dn=5;else if(Hr==2){var kr=Mp(pt,Qt,31)+257,rn=Mp(pt,Qt+10,15)+4,$n=kr+Mp(pt,Qt+5,31)+1;Qt+=14;for(var Ps=new Ch($n),zs=new Ch(19),Jn=0;Jn>4)<16)Ps[Jn++]=er;else{var Lr=0,Or=0;for(er==16?(Or=3+Mp(pt,Qt,3),Qt+=2,Lr=Ps[Jn-1]):er==17?(Or=3+Mp(pt,Qt,7),Qt+=3):er==18&&(Or=11+Mp(pt,Qt,127),Qt+=7);Or--;)Ps[Jn++]=Lr}}var hn=Ps.subarray(0,kr),mn=Ps.subarray(kr);jr=Coe(hn),dn=Coe(mn),pr=hM(hn,jr),Tr=hM(mn,dn)}else Tp(1);if(Qt>Fr){lr&&Tp(0);break}}or&&hr(Kt+131072);for(var Xn=(1<>4;if((Qt+=15&Lr)>Fr){lr&&Tp(0);break}if(Lr||Tp(2),Cs<256)St[Kt++]=Cs;else{if(Cs==256){ps=Qt,pr=null;break}var Pn=Cs-254;Cs>264&&(Pn=Mp(pt,Qt,(1<<(ni=G_e[Jn=Cs-257]))-1)+X_e[Jn],Qt+=ni);var Bn=Tr[Moe(pt,Qt)&as],Qs=Bn>>4;if(Bn||Tp(3),Qt+=15&Bn,mn=rHe[Qs],Qs>3){var ni=K_e[Qs];mn+=Moe(pt,Qt)&(1<Fr){lr&&Tp(0);break}or&&hr(Kt+131072);var si=Kt+Pn;if(Ktgr.length)&&(yr=gr.length),new Ch(gr.subarray(0,yr))):St.subarray(0,Kt)}(ze.subarray(qe,-8),{i:2},new Ch(((we=ze)[(Oe=we.length)-4]|we[Oe-3]<<8|we[Oe-2]<<16|we[Oe-1]<<24)>>>0))));var we,Oe,ze,qe;const dt=lHe[ke];if(!dt)throw new Error(`Unhandled codec: ${ke}`);const it=new globalThis.DecompressionStream(dt);return new Response(new Blob([pe]).stream().pipeThrough(it)).arrayBuffer().then(pt=>new Uint8Array(pt))}(X,G).then(pe=>(function(ke,we){ke.readFields(KVe,we)}(new Toe(pe),J),new dHe[E](J.buffer))),se.then(pe=>{for(let ke=H.length-1;ke>=0;ke--)switch(H[ke]){case"delta_filter":YVe(pe,R);break;case"zigzag_filter":XVe(pe);break;case"bitshuffle_filter":QVe(pe,E);break;default:throw new xf(`Unhandled filter "${H[ke]}"`)}return{layerName:y,blockIndex:B,data:pe}}).catch(pe=>{throw pe})}))},Xr(r2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Xr(C6,"MapboxRasterTile"),Xr(t2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class n2e{constructor(l){this._stringToNumber={},this._numberToString=[];for(let u=0;u=0&&X[3]>=0&&B.insert(R,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new zt(new n6(this.rawTileData)).layers,this.sourceLayerCoder=new n2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const l in this.vtLayers)this.vtFeatures[l]=[]}return this.vtLayers}query(l,u){const{tilespaceGeometry:g,transform:y,tileTransform:j,pixelPosMatrix:N,availableImages:E,worldview:R}=u;this.loadVTLayers(),this.serializedLayersCache.clear();const B=u.queryRadius?u.queryRadius:0,H=g.bufferedTilespaceBounds,G=this.grid.query(H.min.x,H.min.y,H.max.x,H.max.y,(pe,ke,we,Oe)=>Yc(g.bufferedTilespaceGeometry,pe-B,ke-B,we+B,Oe+B));G.sort(uHe);let X=null;y.elevation&&G.length>0&&(X=EN.create(y.elevation,this.tileID));const J={};let se;for(let pe=0;pe(Oe||(Oe=_t(ze,this.tileID.canonical,j)),qe.queryIntersectsFeature(g,ze,dt,Oe,this.z,y,N,X,it)))}return J}loadMatchingFeature(l,u,g,y,j,N){const{featureIndex:E,bucketIndex:R,sourceLayerIndex:B,layoutVertexArrayOffset:H}=u,G=this.bucketLayerIDs[R],X=g.layers,J=Object.keys(X);if(J.length&&!Gr(J,G))return;const se=g.sourceCache,pe=this.sourceLayerCoder.decode(B),ke=this.vtLayers[pe].feature(E),we=this.getId(ke,pe);for(let Oe=0;Oe`${E.key}: ${E.message}`).join(", ");return void $r(`Failed to create expression for promoteId: ${N}`)}this.promoteIdExpression=j.value}g=this.promoteIdExpression.evaluate({zoom:0},l)}else g=l.properties[y];typeof g=="boolean"&&(g=Number(g))}return g}}function i2e(f,l,u,g,y){return Ut(f,(j,N)=>{const E=l instanceof Wg?l.get(N):null;return E&&E.evaluate?E.evaluate(u,g,void 0,y):E})}function uHe(f,l){return l-f}Xr(s2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const a2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Aoe{static from(l){if(!(l instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(l,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const y=g>>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const j=a2e[15&g];if(!j)throw new Error("Unrecognized array type.");const[N]=new Uint16Array(l,2,1),[E]=new Uint32Array(l,4,1);return new Aoe(E,N,j,l)}constructor(l,u=64,g=Float64Array,y){if(isNaN(l)||l<0)throw new Error(`Unpexpected numItems value: ${l}.`);this.numItems=+l,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=l<65536?Uint16Array:Uint32Array;const j=a2e.indexOf(this.ArrayType),N=2*l*this.ArrayType.BYTES_PER_ELEMENT,E=l*this.IndexArrayType.BYTES_PER_ELEMENT,R=(8-E%8)%8;if(j<0)throw new Error(`Unexpected typed array class: ${g}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,l),this.coords=new this.ArrayType(this.data,8+E+R,2*l),this._pos=2*l,this._finished=!0):(this.data=new ArrayBuffer(8+N+E+R),this.ids=new this.IndexArrayType(this.data,8,l),this.coords=new this.ArrayType(this.data,8+E+R,2*l),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+j]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=l)}add(l,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=l,this.coords[this._pos++]=u,g}finish(){const l=this._pos>>1;if(l!==this.numItems)throw new Error(`Added ${l} items when expected ${this.numItems}.`);return Eoe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(l,u,g,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:j,coords:N,nodeSize:E}=this,R=[0,j.length-1,0],B=[];for(;R.length;){const H=R.pop()||0,G=R.pop()||0,X=R.pop()||0;if(G-X<=E){for(let ke=X;ke<=G;ke++){const we=N[2*ke],Oe=N[2*ke+1];we>=l&&we<=g&&Oe>=u&&Oe<=y&&B.push(j[ke])}continue}const J=X+G>>1,se=N[2*J],pe=N[2*J+1];se>=l&&se<=g&&pe>=u&&pe<=y&&B.push(j[J]),(H===0?l<=se:u<=pe)&&(R.push(X),R.push(J-1),R.push(1-H)),(H===0?g>=se:y>=pe)&&(R.push(J+1),R.push(G),R.push(1-H))}return B}within(l,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:j,nodeSize:N}=this,E=[0,y.length-1,0],R=[],B=g*g;for(;E.length;){const H=E.pop()||0,G=E.pop()||0,X=E.pop()||0;if(G-X<=N){for(let ke=X;ke<=G;ke++)l2e(j[2*ke],j[2*ke+1],l,u)<=B&&R.push(y[ke]);continue}const J=X+G>>1,se=j[2*J],pe=j[2*J+1];l2e(se,pe,l,u)<=B&&R.push(y[J]),(H===0?l-g<=se:u-g<=pe)&&(E.push(X),E.push(J-1),E.push(1-H)),(H===0?l+g>=se:u+g>=pe)&&(E.push(J+1),E.push(G),E.push(1-H))}return R}}function Eoe(f,l,u,g,y,j){if(y-g<=u)return;const N=g+y>>1;o2e(f,l,N,g,y,j),Eoe(f,l,u,g,N-1,1-j),Eoe(f,l,u,N+1,y,1-j)}function o2e(f,l,u,g,y,j){for(;y>g;){if(y-g>600){const B=y-g+1,H=u-g+1,G=Math.log(B),X=.5*Math.exp(2*G/3),J=.5*Math.sqrt(G*X*(B-X)/B)*(H-B/2<0?-1:1);o2e(f,l,u,Math.max(g,Math.floor(u-H*X/B+J)),Math.min(y,Math.floor(u+(B-H)*X/B+J)),j)}const N=l[2*u+j];let E=g,R=y;for(pM(f,l,g,u),l[2*y+j]>N&&pM(f,l,g,y);EN;)R--}l[2*g+j]===N?pM(f,l,g,R):(R++,pM(f,l,R,y)),R<=u&&(g=R+1),u<=R&&(y=R-1)}}function pM(f,l,u,g){Ioe(f,u,g),Ioe(l,2*u,2*g),Ioe(l,2*u+1,2*g+1)}function Ioe(f,l,u){const g=f[l];f[l]=f[u],f[u]=g}function l2e(f,l,u,g){const y=f-u,j=l-g;return y*y+j*j}a.$=uk,a.A=cp,a.B=jh,a.C=2,a.D=yN,a.E=Rg,a.F=Z3,a.G=Lve,a.H=dk,a.I=Mc,a.J=vP,a.K=cn,a.L=py,a.M=Ok,a.N=mv,a.O=aP,a.P=ir,a.Q=gv,a.R=Og,a.S=Hk,a.T=Bae,a.U=Pm,a.V=v6,a.W=r3,a.X=vy,a.Y=yy,a.Z=cv,a._=Gc,a.a=function(f){return ks.API_CDN_URL_REGEX.test(f)},a.a$=ce,a.a0=zn,a.a1=Uu,a.a2=hf,a.a3=class extends v6{},a.a4=Dk,a.a5=iP,a.a6=Rt,a.a7=function(f){const l=f.value;return l?zn(l)?xoe(l,!0)?[]:[new v6(f.key,l,`invalid url "${l}"`)]:[new v6(f.key,l,`string expected, "${cn(l)}" found`)]:[]},a.a8=mP,a.a9=Fa,a.aA=_e,a.aB=A,a.aC=Lt,a.aD=dc,a.aE=$i,a.aF=z,a.aG=Ue,a.aH=function(f,l){const u={};for(let g=0;g{g(j,N)},l):g(j,N),()=>{}}return y.callbacks.push(g),y.cancel||(y.cancel=u((j,N)=>{y.result=[j,N];for(const E of y.callbacks)this.scheduler?this.scheduler.add(()=>{E(j,N)},l):E(j,N);setTimeout(()=>delete this.entries[f],3e3)})),()=>{y.result||(y.callbacks=y.callbacks.filter(j=>j!==g),y.callbacks.length||(y.cancel(),delete this.entries[f]))}}},a.aL=function(f,l,u){const g=JSON.stringify(f.request);return f.data&&(this.deduped.entries[g]={result:[null,f.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:f.isSymbolTile,zoom:f.tileZoom},y=>{const j=$u(f.request,(N,E,R)=>{N?y(N):E&&y(null,{rawData:E,vectorTile:u?void 0:new zt(new n6(E)),responseHeaders:new Map(R.entries())})});return()=>{j.cancel(),y()}},l)},a.aM=function(f){return f?{cacheControl:f.get("Cache-Control"),expires:f.get("Expires")}:{cacheControl:void 0,expires:void 0}},a.aN=Vc,a.aO=function(f){Dd++,Dd>wm&&(f.getActor().send("enforceCacheSizeLimit",sp),Dd=0)},a.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},a.aQ=Pa,a.aR=c_e,a.aS=m_e,a.aT=p,a.aU=l_e,a.aV=function(f,l){const u=document.createElement("video");u.muted=!0,u.onloadstart=function(){l(null,u)};for(let g=0;g{}}},a.aW=V3,a.aX=Bv,a.aY=At,a.aZ=J3,a.a_=Q,a.aa=Nr,a.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,l){return Yn(f.expression.evaluate(l))}interpolate(f,l,u){return{x:Rn(f.x,l.x,u),y:Rn(f.y,l.y,u),z:Rn(f.z,l.z,u),azimuthal:Rn(f.azimuthal,l.azimuthal,u),polar:Rn(f.polar,l.polar,u)}}},a.ac=Ji,a.ad=qg,a.ae=$e,a.af=Ye,a.ag=ye,a.ah=De,a.ai=Wg,a.aj=Fy,a.ak=Rn,a.al=Mr,a.am=N5,a.an=rs,a.ao=vi,a.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,l){return function([u,g]){const y=Yn([1,u,g]);return{x:y.x,y:y.y,z:y.z}}(f.expression.evaluate(l))}interpolate(f,l,u){return{x:Rn(f.x,l.x,u),y:Rn(f.y,l.y,u),z:Rn(f.z,l.z,u)}}},a.aq=function(f,l,u=0,g=!0){const y=new ir(u,u),j=f.sub(y),N=l.add(y),E=[j,new ir(N.x,j.y),N,new ir(j.x,N.y)];return g&&E.push(j.clone()),E},a.ar=function(f,l){const u=[];for(let g=0;g1)return!1;const u=l.getSource().maxzoom,g=1<1)return l;const y=g.getSource().maxzoom,j=1<{const E=this.getAtTileOffset(f,y,j,N),R=g.upVector(f.canonical,y.x,y.y);return ae(R,R,E*g.upVectorScale(f.canonical,l,u).metersToTile),R}}getForTilePoints(f,l,u,g){if(this.isUsingMockSource())return!1;const y=EN.create(this,f,g);return!!y&&(l.forEach(j=>{j[2]=this.exaggeration()*y.getElevationAt(j[0],j[1],u)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const l=this.findDEMTileFor(f);if(!l||!l.dem)return null;const u=l.dem.tree,g=l.tileID,y=1<0&&(g+=(f[y]-0)*(f[y]-0)),l[y]<0&&(g+=(0-l[y])*(0-l[y]));return g},a.c0=c1e,a.c1=toe,a.c2=$ve,a.c3=coe,a.c4=Aoe,a.c5=ae,a.c6=Re,a.c7=Dt,a.c8=function(f,l,u){u*=.5;var g=l[0],y=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return f[0]=g*R+y*E,f[1]=y*R-g*E,f[2]=j*R+N*E,f[3]=N*R-j*E,f},a.c9=kt,a.cA=je,a.cB=ci,a.cC=G1e,a.cD=Ui,a.cE=k0e,a.cF=function(f,l,u,g,y,j,N,E,R){if(R.name==="globe")return k0e(f,l,new Ui(u,g,y),!1);const B=J3({z:u,x:g,y},R);return new on([(j+B.x/B.scale)*l,l*(B.y/B.scale),N],[(j+B.x2/B.scale)*l,l*(B.y2/B.scale),E])},a.cG=function(f,l,u){return f[0]=Math.min(l[0],u[0]),f[1]=Math.min(l[1],u[1]),f[2]=Math.min(l[2],u[2]),f[3]=Math.min(l[3],u[3]),f},a.cH=function(f,l,u){return f[0]=Math.max(l[0],u[0]),f[1]=Math.max(l[1],u[1]),f[2]=Math.max(l[2],u[2]),f[3]=Math.max(l[3],u[3]),f},a.cI=function(f){const l=Math.round((f+45+360)%360/90)%4;return Od[l]},a.cJ=de,a.cK=tt,a.cL=mN,a.cM=function(f){const l=T(new Float64Array(16));A(l,f.pixelMatrix,f.globeMatrix);const u=[0,Ku,0],g=[0,Zu,0];return Ye(u,u,l),Ye(g,g,l),[u[0]>0&&u[0]<=f.width&&u[1]>0&&u[1]<=f.height&&!xae(f,new p(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!xae(f,new p(f.center.lat,-90))]},a.cN=function(f,l){const{scale:u}=f.tileTransform,g=u*Mr/(f.tileSize*Math.pow(2,l.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(y,j,N){var E=j[1],R=j[2],B=j[3],H=N[0],G=N[1];return y[0]=j[0]*H,y[1]=E*H,y[2]=R*G,y[3]=B*G,y}(new Float32Array(4),l.inverseAdjustmentMatrix,[g,g])},a.cO=XP,a.cP=ue,a.cQ=W1e,a.cR=function(f){const l=W1e(f,!0);return x([],[l[0],l[1],l[4],l[5]])},a.cS=$,a.cT=Rr,a.cU=F,a.cV=function(f){const{x:l,y:u}=f.point,{lng:g,lat:y}=f._center;return C0e(l,u,f.worldSize,g,y)},a.cW=Ie,a.cX=po,a.cY=Sa,a.cZ=Xl,a.c_=Gu,a.ca=Ea,a.cb=function(f,l){return f[0]=-l[0],f[1]=-l[1],f[2]=-l[2],f[3]=l[3],f},a.cc=he,a.cd=function(f,l,u,g,y){var j=1/Math.tan(l/2);if(f[0]=j/u,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=j,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,y!=null&&y!==1/0){var N=1/(g-y);f[10]=(y+g)*N,f[14]=2*y*g*N}else f[10]=-1,f[14]=-2*g;return f},a.ce=function(f,l,u,g,y,j,N){var E=1/(l-u),R=1/(g-y),B=1/(j-N);return f[0]=-2*E,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*R,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*B,f[11]=0,f[12]=(l+u)*E,f[13]=(y+g)*R,f[14]=(N+j)*B,f[15]=1,f},a.cf=Y,a.cg=function(f,l,u){f[4*l+0]=u[0],f[4*l+1]=u[1],f[4*l+2]=u[2],f[4*l+3]=u[3]},a.ch=uN,a.ci=Nv,a.cj=Fo,a.ck=mf,a.cl=Cv,a.cm=Qve,a.cn=function(){var f=new m(4);return m!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},a.co=function(f,l,u){var g=l[0],y=l[1],j=l[2],N=l[3],E=Math.sin(u),R=Math.cos(u);return f[0]=g*R+j*E,f[1]=y*R+N*E,f[2]=g*-E+j*R,f[3]=y*-E+N*R,f},a.cp=function(f,l){return f[0]===l[0]&&f[1]===l[1]&&f[2]===l[2]&&f[3]===l[3]},a.cq=Ve,a.cr=function(f){var l=f[0],u=f[1],g=f[2],y=f[3];return Math.sqrt(l*l+u*u+g*g+y*y)},a.cs=pn,a.ct=ft,a.cu=mo,a.cv=3,a.cw=2,a.cx=7,a.cy=6,a.cz=Ae,a.d=function(f){return ks.API_TILEJSON_REGEX.test(f)},a.d$=class{constructor(f,l,u,g){this.context=f,this.format=g,this.size=u,this.texture=f.gl.createTexture();const[y,j,N]=this.size,{gl:E}=f;E.bindTexture(E.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in l&&l.data&&E.texImage3D(E.TEXTURE_3D,0,this.format,y,j,N,0,Fae(this.format),zae(this.format),l.data)}bind(f,l){const{context:u}=this,{gl:g}=u;g.bindTexture(g.TEXTURE_3D,this.texture),f!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,f),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,f),this.minFilter=f),l!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,l),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,l),this.wrapS=l)}destroy(){const{gl:f}=this.context;f.deleteTexture(this.texture),this.texture=null}},a.d0=function(f){return f*f*f*f*f},a.d1=O,a.d2=45,a.d3=hN,a.d4=function(f,l,u){const g=Math.sqrt(f*f+l*l+u*u),y=g>0?Math.acos(u/g)*fo:0;let j=f!==0||l!==0?Math.atan2(-l,-f)*fo+90:0;return j<0&&(j+=360),[g,j,y]},a.d5=ie,a.d6=Yn,a.d7=Ee,a.d8=fe,a.d9=on,a.dA=function(f){return f({pluginStatus:Kc,pluginURL:mp}),qk.on("pluginStateChange",f),f},a.dB=Sv,a.dC=class extends yp{constructor(f){super(f),this.current=fN}set(f,l,u){if(this.fetchUniformLocation(f,l)){for(let g=0;g<9;g++)if(u[g]!==this.current[g]){this.current=u,this.gl.uniformMatrix3fv(this.location,!1,u);break}}}},a.dD=vr,a.dE=function(f,l,u){const g=Fy(u.zoom),y=f.style.map._antialias,j=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!y&&!j},a.dF=function(f){const l=f.pixelsPerMeter,u=l/Y(1,f.center.lat),g=T(new Float64Array(16));return D(g,g,[f.point.x,f.point.y,0]),$(g,g,[u,u,l]),Float32Array.from(g)},a.dG=OP,a.dH=function(f){const l=de-5;f=_e(f,-l,l)/l*90;const u=Math.pow(Math.abs(Math.sin(rs(f))),3);return Math.round(u*(C3.length-1))},a.dI=function(f,l,u,g){const y=l.getNorth(),j=l.getSouth(),N=l.getWest(),E=l.getEast(),R=1<0){const se=180/g;k(J,J,[se/B+1,0,0,0,se/H+1,0,-.5*se/G,.5*se/X,1])}return J[2]=R,J[5]=f.x,J[8]=f.y,J},a.dJ=Sh,a.dK=function(f,l,u){const g=T(new Float64Array(16)),y=(l/(1<({u_matrix:new Cv(f),u_texsize:new mf(f),u_pixels_to_tile_units:new pN(f),u_device_pixel_ratio:new Fo(f),u_width_scale:new Fo(f),u_floor_width_scale:new Fo(f),u_image:new uN(f),u_units_to_pixels:new mf(f),u_tile_units_to_pixels:new Fo(f),u_alpha_discard_threshold:new Fo(f),u_trim_offset:new mf(f),u_trim_fade_range:new mf(f),u_trim_color:new hN(f),u_zbias_factor:new Fo(f),u_tile_to_meter:new Fo(f),u_ground_shadow_factor:new Nv(f),u_pattern_transition:new Fo(f)}),a.dX=f=>({u_matrix:new Cv(f),u_pixels_to_tile_units:new pN(f),u_device_pixel_ratio:new Fo(f),u_width_scale:new Fo(f),u_floor_width_scale:new Fo(f),u_units_to_pixels:new mf(f),u_dash_image:new uN(f),u_gradient_image:new uN(f),u_image_height:new Fo(f),u_texsize:new mf(f),u_tile_units_to_pixels:new Fo(f),u_alpha_discard_threshold:new Fo(f),u_trim_offset:new mf(f),u_trim_fade_range:new mf(f),u_trim_color:new hN(f),u_zbias_factor:new Fo(f),u_tile_to_meter:new Fo(f),u_ground_shadow_factor:new Nv(f)}),a.dY=f=>({u_camera_to_center_distance:new Fo(f),u_extrude_scale:new pN(f),u_device_pixel_ratio:new Fo(f),u_matrix:new Cv(f),u_inv_rot_matrix:new Cv(f),u_merc_center:new mf(f),u_tile_id:new Nv(f),u_zoom_transition:new Fo(f),u_up_dir:new Nv(f),u_emissive_strength:new Fo(f)}),a.dZ=rN,a.d_=wqe,a.da=ve,a.db=function(f){return[Math.pow(f[0],1/2.2),Math.pow(f[1],1/2.2),Math.pow(f[2],1/2.2)]},a.dc=H1e,a.dd=Wae,a.de=Y1e,a.df=xoe,a.dg=function(f,l){return f.readFields(bVe,{icons:[]},l)},a.dh=GP,a.di=CN,a.dj=aoe,a.dk=uy,a.dl=vv,a.dm=Fu,a.dn=ik,a.dp=ar,a.dq=function(f){const l=f.indexOf(Zg);return l>=0?f.slice(0,l):f},a.dr=function(f){return f.indexOf(Zg)>=0},a.ds=function(f){const l=f.lastIndexOf(Zg);return l>=0?f.slice(l+1):""},a.dt=function(f){const l=[],u=f.id;return u===void 0&&l.push({message:`layers.${u}: missing required property "id"`}),f.render===void 0&&l.push({message:`layers.${u}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&l.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),l},a.du=function(f,l,u,g){return f.type==="custom"?new pVe(f,l):new vVe[f.type](f,l,u,g)},a.dv=mr,a.dw=function(f){const l=f.indexOf(Zg);return l>=0?f.slice(l+1):""},a.dx=class extends zv{constructor(f,l){super(f._vectorTileFeature,f._z,f._x,f._y,f.id),f.state&&(this.state=Object.assign({},f.state)),this.target=l.target,this.namespace=l.namespace,l.properties&&(this.properties=l.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=f.source,this.sourceLayer=f.sourceLayer,this.layer=f.layer)}toJSON(){const f=super.toJSON();return f.target=this.target,f.namespace=this.namespace,f}},a.dy=qk,a.dz=lp,a.e=ks,a.e$=me,a.e0=A0e,a.e1=(f,l,u,g,y,j)=>{const N=f.transform,E=N.projection.name==="globe";let R;if(j.paint.get("circle-pitch-alignment")==="map")if(E){const H=S0e(N.zoom,l.canonical)*N._pixelsPerMercatorPixel;R=Float32Array.from([H,0,0,H])}else R=N.calculatePixelsToTileUnitsMatrix(u);else R=new Float32Array([N.pixelsToGLUnits[0],0,0,N.pixelsToGLUnits[1]]);const B={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(N.projection),u_matrix:f.translatePosMatrix(l.projMatrix,u,j.paint.get("circle-translate"),j.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Do.devicePixelRatio,u_extrude_scale:R,u_inv_rot_matrix:F$e,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:j.paint.get("circle-emissive-strength")};if(E){B.u_inv_rot_matrix=g,B.u_merc_center=y,B.u_tile_id=[l.canonical.x,l.canonical.y,1<{const H=f.transform,G=H.pitch<15?cve(.07,.7,_e((14-H.zoom)/5,0,1)):.07,X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:uve(f,l,u,g),u_texsize:l.imageAtlasTexture?l.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:H.calculatePixelsToTileUnitsMatrix(l),u_device_pixel_ratio:y,u_width_scale:j,u_floor_width_scale:N,u_image:0,u_tile_units_to_pixels:dve(l,H),u_units_to_pixels:[1/H.pixelsToGLUnits[0],1/H.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:E,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:G,u_tile_to_meter:Ee(l.tileID.canonical,0),u_ground_shadow_factor:R,u_pattern_transition:B}},a.e5=(f,l,u,g,y,j,N,E,R,B)=>{const H=f.transform,G=H.calculatePixelsToTileUnitsMatrix(l),X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none",J=H.pitch<15?cve(.07,.7,_e((14-H.zoom)/5,0,1)):.07;return{u_matrix:uve(f,l,u,g),u_pixels_to_tile_units:G,u_device_pixel_ratio:j,u_width_scale:N,u_floor_width_scale:E,u_units_to_pixels:[1/H.pixelsToGLUnits[0],1/H.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:y,u_texsize:fve(u)&&l.lineAtlasTexture?l.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:dve(l,f.transform),u_alpha_discard_threshold:0,u_trim_offset:R,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:J,u_tile_to_meter:Ee(l.tileID.canonical,0),u_ground_shadow_factor:B}},a.e6=Bt,a.e7=T3,a.e8=le,a.e9=Xu,a.eA=function(f,l){var u=2*Math.acos(l[3]),g=Math.sin(u/2);return g>h?(f[0]=l[0]/g,f[1]=l[1]/g,f[2]=l[2]/g):(f[0]=1,f[1]=0,f[2]=0),u},a.eB=_oe,a.eC=e6,a.eD=JP,a.eE=[1,1,1],a.eF=EN,a.eG=Ge,a.eH=function(f,l,u,g){var y=l[0],j=l[1],N=l[2],E=l[3];return f[0]=y+g*(u[0]-y),f[1]=j+g*(u[1]-j),f[2]=N+g*(u[2]-N),f[3]=E+g*(u[3]-E),f},a.eI=wN,a.eJ=ou,a.eK=pf,a.eL=function(f,l,u,g,y,j,N,E,R,B,H,G,X,J,se,pe){var ke=new m(16);return ke[0]=f,ke[1]=l,ke[2]=u,ke[3]=g,ke[4]=y,ke[5]=j,ke[6]=N,ke[7]=E,ke[8]=R,ke[9]=B,ke[10]=H,ke[11]=G,ke[12]=X,ke[13]=J,ke[14]=se,ke[15]=pe,ke},a.eM=_,a.eN=Iy,a.eO=x3,a.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ir(1/0,1/0),max:new ir(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(f,l=!1){const u=a1e(new ir(0,0),new ir(Mr,Mr),f),g=[];if(l&&!Sae(u,this._globalClipBounds))return g;for(const y of this._activeRegions){if(y.hiddenByOverlap||!Sae(u,y))continue;const j=fUe(y.min,y.max,f);g.push({min:j.min,max:j.max,sourceId:this._sourceIds[y.priority],footprint:y.footprint,footprintTileId:y.tileId,order:y.order,clipMask:y.clipMask,clipScope:y.clipScope})}return g}setSources(f){this._setSources(f.map(l=>({getSourceId:()=>l.cache.id,getFootprints:()=>{const u=[];for(const g of l.cache.getVisibleCoordinates()){const y=l.cache.getTile(g).buckets[l.layer];y&&y.updateFootprints(g.toUnwrapped(),u)}return u},getOrder:()=>l.order,getClipMask:()=>l.clipMask,getClipScope:()=>l.clipScope})))}_addSource(f){const l=f.getFootprints();if(l.length===0)return;const u=f.getOrder(),g=f.getClipMask(),y=f.getClipScope();for(const j of l){if(!j.footprint)continue;const N=a1e(j.footprint.min,j.footprint.max,j.id);this._activeRegions.push({min:N.min,max:N.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:j.id,footprint:j.footprint,order:u,clipMask:g,clipScope:y})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((l,u)=>l.priority-u.priority||UP(l.min,u.min)||UP(l.max,u.max)||l.order-u.order||l.clipMask-u.clipMask||function(g,y){const j=(N,E)=>N+E;return g.length-y.length||g.reduce(j,"").localeCompare(y.reduce(j,""))}(l.clipScope,u.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let l=0;for(;!f&&l!==this._activeRegions.length;){const u=this._activeRegions[l],g=this._prevRegions[l];f=u.priority!==g.priority||!i1e(u,g)||u.order!==g.order||u.clipMask!==g.clipMask||!ho(u.clipScope,g.clipScope),this._activeRegions[l].hiddenByOverlap=g.hiddenByOverlap,++l}}if(f){++this._updateTime;for(const u of this._activeRegions)u.order!==O3&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,u.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,u.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,u.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,u.max.y));const l=u=>{const g=this._activeRegions;if(u>=g.length)return u;const y=g[u].priority;for(;u1){let u=0,g=l(u);for(;u!==g;){let y=u;const j=u;for(;y!==g;){const N=this._activeRegions[y];N.hiddenByOverlap=!1;for(let E=0;E=0;l--)this._addSource(f[l]);this._computeReplacement()}},a.eQ=O3,a.eR=class{constructor(f){this._createGrid(f),this._createPoles(f)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const f of this._poleSegments)f.destroy();for(const f of this._gridSegments)f.withSkirts.destroy(),f.withoutSkirts.destroy()}_fillGridMeshWithLods(f,l){const u=new Om,g=new Ro,y=[],j=f+1+2,N=l[0]+1,E=l[0]+1+(1+l.length),R=(B,H,G)=>{let X=B===j-1?B-2:B===0?B:B-1;return X+=G?24575:0,[X,H]};for(let B=0;B0?(ke=2*Math.sqrt(pe+1),f[3]=.25*ke,f[0]=(G-J)/ke,f[1]=(X-R)/ke,f[2]=(E-B)/ke):N>H&&N>se?(ke=2*Math.sqrt(1+N-H-se),f[3]=(G-J)/ke,f[0]=.25*ke,f[1]=(E+B)/ke,f[2]=(X+R)/ke):H>se?(ke=2*Math.sqrt(1+H-N-se),f[3]=(X-R)/ke,f[0]=(E+B)/ke,f[1]=.25*ke,f[2]=(G+J)/ke):(ke=2*Math.sqrt(1+se-N-H),f[3]=(E-B)/ke,f[0]=(X+R)/ke,f[1]=(G+J)/ke,f[2]=.25*ke),f},a.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(l,u)=>String.fromCharCode(+("0x"+u))))},a.f0=function([f,l,u]){const g=Math.hypot(f,l,u),y=Math.atan2(f,u),j=.5*Math.PI-Math.acos(-l/g);return new p(po(y),po(j))},a.f1=Et,a.f2=$ae,a.f3=function(f){const l=f.navigator?f.navigator.userAgent:null;return!!function(u){if(Va==null){const g=u.navigator?u.navigator.userAgent:null;Va=!!u.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return Va}(f)&&!(!l||!(l.match("Version/15.4")||l.match("Version/15.5")||l.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},a.f4=function(f,l){sp=f,wm=l},a.f5=xae,a.f6=M0e,a.f7=function(f){const l=[0,0,0],u=T(new Float64Array(16));return A(u,f.pixelMatrix,f.globeMatrix),Ye(l,l,u),new ir(l[0],l[1])},a.f8=function(){const f=$3;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Iae),$3=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()"))},a.f9=function(){GP().acquire(Iae)},a.fA=S6,a.fB=Tt,a.fC=function(f){let l=0;if(new Uint32Array(f,0,1)[0]!==B1e){const u=new Uint32Array(f,0,7),[,,g,y,j,N]=u;l=u.byteLength+y+j+N+j,(g!==f.byteLength||l>=f.byteLength)&&$r("Invalid b3dm header information.")}return V1e(f,l)},a.fD=function(f,l){const u=Wae(f);for(const g of u){for(const y of g.meshes)VUe(y);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(HUe(g.lights,l)))}return u},a.fE=_6,a.fF=Os,a.fG=O1e,a.fH=gp,a.fI=Rd,a.fJ=function(f){md(),zu!=null&&zu.then(l=>{l.keys().then(u=>{for(let g=0;g$r(y.message))}).catch(u=>$r(u.message))}).catch(l=>$r(l.message))},a.fa=_v,a.fb=function(f,l,u=!1){if(Kc===Rd.deferred||Kc===Rd.loading||Kc===Rd.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");mp=Do.resolveURL(f),Kc=Rd.deferred,a3=l,Uk(),u||pP()},a.fc=function(f){vN=Do.resolveURL(f),_N||(_N=new yN(GP(),new Rg)),_N.broadcast("setMeshoptUrl",vN)},a.fd=F1e,a.fe=function(f){Oae=Do.resolveURL(f),_N||(_N=new yN(GP(),new Rg)),_N.broadcast("setDracoUrl",Oae)},a.ff=R1e,a.fg=B3,a.fh=function(f){const l=qc();if(!l)return;const u=l.delete(Yl);f&&u.then(()=>f()).catch(f)},a.fi=Lv,a.fj=Xr,a.fk=zy,a.fl=Cp,a.fm=n2e,a.fn=s2e,a.fo=ive,a.fp=Zt,a.fq="hd_road_elevation",a.fr=pi,a.fs=Ut,a.ft=Jg,a.fu=ioe,a.fv=Rv,a.fw=function(f,l,u,g,y,j,N,E=1,R,B,H){f.createArrays(),f.tilePixelRatio=Mr/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const G=f.layers[0].layout,X=f.layers[0]._unevaluatedLayout._values,J={};J.scaleFactor=E,J.textSizeScaleRange=G.get("text-size-scale-range"),J.iconSizeScaleRange=G.get("icon-size-scale-range");const[se,pe]=J.textSizeScaleRange,[ke,we]=J.iconSizeScaleRange;J.textScaleFactor=_e(J.scaleFactor,se,pe),J.iconScaleFactor=_e(J.scaleFactor,ke,we);const Oe=X["text-size"],ze=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:St,maxZoom:Gt}=f.textSizeData;J.compositeTextSizes=[Oe.possiblyEvaluate(new Ji(St,{worldview:H}),j),Oe.possiblyEvaluate(new Ji(Gt,{worldview:H}),j)]}if(f.iconSizeData.kind==="composite"){const{minZoom:St,maxZoom:Gt}=f.iconSizeData;J.compositeIconSizes=[ze.possiblyEvaluate(new Ji(St,{worldview:H}),j),ze.possiblyEvaluate(new Ji(Gt,{worldview:H}),j)]}J.layoutTextSize=Oe.possiblyEvaluate(new Ji(N+1,{worldview:H}),j),J.layoutIconSize=ze.possiblyEvaluate(new Ji(N+1,{worldview:H}),j),J.textMaxSize=Oe.possiblyEvaluate(new Ji(18,{worldview:H}),j);const qe=G.get("symbol-placement"),dt=G.get("text-rotation-alignment")==="map"&&qe!=="point",it=G.get("text-size");let pt=!1;const wt=[];for(const St of f.features){const Gt=G.get("text-font").evaluate(St,{},j).join(","),Pt=it.evaluate(St,{},j)*J.textScaleFactor,Jt=J.layoutTextSize.evaluate(St,{},j)*J.textScaleFactor,or=J.layoutIconSize.evaluate(St,{},j)*J.iconScaleFactor,lr={horizontal:{},vertical:void 0},gr=St.text;let yr,hr=[0,0];if(gr){const Jn=gr.toString(),Pi=G.get("text-letter-spacing").evaluate(St,{},j)*ul,at=G.get("text-line-height").evaluate(St,{},j)*ul,ut=s3(Jn)?Pi:0,er=G.get("text-anchor").evaluate(St,{},j),xr=G.get("text-variable-anchor");if(!xr){const Xn=G.get("text-radial-offset").evaluate(St,{},j);if(Xn)hr=$ve(er,[Xn*ul,loe]);else{const as=G.get("text-offset").evaluate(St,{},j);hr=[as[0]*ul,as[1]*ul]}}let Lr=dt?"center":G.get("text-justify").evaluate(St,{},j);const Or=qe==="point",hn=Or?G.get("text-max-width").evaluate(St,{},j)*ul:1/0,mn=Xn=>{f.allowVerticalPlacement&&yv(Jn)&&(lr.vertical=eoe(gr,l,u,y,Gt,hn,at,er,Xn,ut,hr,du.vertical,!0,Jt,Pt,R))};if(!dt&&xr){const Xn=Lr==="auto"?xr.map(ps=>coe(ps)):[Lr];let as=!1;for(let ps=0;ps=0||!yv(Jn)){const Xn=eoe(gr,l,u,y,Gt,hn,at,er,Lr,ut,hr,du.horizontal,!1,Jt,Pt,R);Xn&&(lr.horizontal[Lr]=Xn)}mn(Or?"left":Lr)}}let fr,Qt,Kt,pr,Tr,jr,dn=!1;const Fr=G.get("icon-text-fit").evaluate(St,{},j);if(St.icon&&St.icon.hasPrimary()){const Jn=X3(St.icon,f.iconSizeData,X["icon-size"],j,f.zoom,St,R,J.iconScaleFactor,H);fr=Jn.iconPrimary,Kt=Jn.iconSecondary;const Pi=fr.toString();if(Qt=g.get(Pi),Qt&&(Tr=G.get("icon-offset").evaluate(St,{},j),jr=G.get("icon-anchor").evaluate(St,{},j),yr=i6(y.get(Pi),Kt?y.get(Kt.toString()):void 0,Tr,jr),dn=Qt.sdf,f.sdfIcons===void 0?f.sdfIcons=Qt.sdf:f.sdfIcons!==Qt.sdf&&$r("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Qt.pixelRatio!==f.pixelRatio||G.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Kt){const at=Kt.toString();pr=g.get(at)}}pt=pt||!(!St.icon||!St.icon.hasSecondary());const Hr=d6(lr.horizontal)||lr.vertical;f.iconsInText||(f.iconsInText=!!Hr&&Hr.iconsInText);const tn=Jt*J.textScaleFactor/ul,{defaultShapedIcon:ms,verticallyShapedIcon:kr}=Jqe(f,yr,G,St,j,lr,tn,Tr,Fr);Fr!=="none"&&yr&&(Sve(yr)||Cve(yr))&&(c6(0,Qt,fr,yr,ms,Fr,B,g,y),c6(0,pr,Kt,yr,ms,Fr,B,g,y),kr&&(c6(0,Qt,fr,yr,kr,Fr,B,g,y),c6(0,pr,Kt,yr,kr,Fr,B,g,y))),yr=ms;const{iconBBox:rn,iconVerticalBBox:$n,textBBox:Ps,textVerticalBBox:zs}=Kqe(f,yr,kr,G,St,j,or,Tr,J,y,jr,lr,Jt,hr);wt.push({feature:St,shapedTextOrientations:lr,shapedText:Hr,shapedIcon:yr,iconPrimary:fr,iconSecondary:Kt,iconOffset:Tr,iconAnchor:jr,verticallyShapedIcon:kr,layoutTextSize:Jt,layoutIconSize:or,textOffset:hr,isSDFIcon:dn,iconTextFit:Fr,iconCollisionBounds:rn,iconVerticalCollisionBounds:$n,textCollisionBounds:Ps,textVerticalCollisionBounds:zs})}return{featureData:wt,sizes:J,hasAnySecondaryIcon:pt,textAlongLine:dt,symbolPlacement:qe}},a.fx=Ove,a.fy=function(f,l,u,g,y,j,N,E,R,B){f.iconAtlasPositions=B.iconPositions;const{featureData:H,hasAnySecondaryIcon:G,sizes:X,textAlongLine:J,symbolPlacement:se}=l;for(const pe of H){const{shapedIcon:ke,verticallyShapedIcon:we,feature:Oe,shapedTextOrientations:ze,shapedText:qe,layoutTextSize:dt,textOffset:it,isSDFIcon:pt,iconPrimary:wt,iconSecondary:St,iconTextFit:Gt,iconOffset:Pt,iconCollisionBounds:Jt,iconVerticalCollisionBounds:or,textCollisionBounds:lr}=pe;qve(ke,B.iconPositions,wt,St),qve(we,B.iconPositions,wt,St),Qqe(ze,B.iconPositions),Xqe(wt,St,B.iconPositions),(qe||ke)&&eVe(f,Oe,ze,ke,we,R,X,dt,0,it,pt,g,y,N,E,G,Gt,Pt,J,se,Jt,or,lr)}u&&f.generateCollisionDebugBuffers(j,f.collisionBoxArray,X.textScaleFactor)},a.fz=zt,a.g=function(f,l){return lp(Object.assign(f,{method:"GET"}),l)},a.h=function(f){return f.indexOf("mapbox:")===0},a.i=function(f){return ks.API_STYLE_REGEX.test(f)&&!bl(f)},a.j=Ra,a.k=nu,a.l=function(f){return decodeURIComponent(atob(f).split("").map(l=>"%"+("00"+l.charCodeAt(0).toString(16)).slice(-2)).join(""))},a.m=function(f,l){return lp(Object.assign(f,{type:"json"}),l)},a.n=vs,a.o=Do,a.p=function(f,l){return lp(Object.assign(f,{method:"POST"}),l)},a.q=fc,a.r=ru,a.s=function(f){try{const l=self[f];return l.setItem("_mapbox_test_",1),l.removeItem("_mapbox_test_"),!0}catch{return!1}},a.t=function(){return Pae||(Pae=new Lv("ImageRasterizer")),Pae},a.u=function(){return function f(l){return l?(l^Math.random()*(16>>l/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,f)}()},a.v=function(f){return!!f&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(f)},a.w=$r,a.x=Soe,a.y=Q1,a.z=af}),o(["./shared"],function(a){function h(bt){const _e=bt?bt.url.toString():void 0;return _e?performance.getEntriesByName(_e):[]}function m(bt){if(typeof bt=="number"||typeof bt=="boolean"||typeof bt=="string"||bt==null)return JSON.stringify(bt);if(Array.isArray(bt)){let De="[";for(const We of bt)De+=`${m(We)},`;return`${De}]`}let _e="{";for(const De of Object.keys(bt).sort())_e+=`${De}:${m(bt[De])},`;return`${_e}}`}function x(bt){let _e="";for(const De of a.bx)_e+=`/${m(bt[De])}`;return _e}class v{constructor(_e){this.keyCache={},this._layers={},this._layerConfigs={},_e&&this.replace(_e)}replace(_e,De){this._layerConfigs={},this._layers={},this.update(_e,[],De)}update(_e,De,We){this._options=We;for(const gt of _e)this._layerConfigs[gt.id]=gt,(this._layers[gt.id]=a.du(gt,this.scope,null,this._options)).compileFilter(We),this.keyCache[gt.id]&&delete this.keyCache[gt.id];for(const gt of De)delete this.keyCache[gt],delete this._layerConfigs[gt],delete this._layers[gt];this.familiesBySource={};const vt=function(gt,Ct){const Bt={};for(let Ut=0;Utthis._layers[Gr.id]),Bt=Ct[0];if(Bt.visibility==="none")continue;const At=Bt.source||"";let Ut=this.familiesBySource[At];Ut||(Ut=this.familiesBySource[At]={});const mr=Bt.sourceLayer||"_geojsonTileLayer";let ar=Ut[mr];ar||(ar=Ut[mr]=[]),ar.push(Ct)}}}const w=1*a.fl;class k{constructor(_e){const De={},We=[];for(const Bt in _e){const At=_e[Bt],Ut=De[Bt]={};for(const mr in At.glyphs){const ar=At.glyphs[+mr];if(!ar||ar.bitmap.width===0||ar.bitmap.height===0)continue;const Gr=ar.metrics.localGlyph?w:1,en={x:0,y:0,w:ar.bitmap.width+2*Gr,h:ar.bitmap.height+2*Gr};We.push(en),Ut[mr]=en}}const{w:vt,h:gt}=a.G(We),Ct=new a.fk({width:vt||1,height:gt||1});for(const Bt in _e){const At=_e[Bt];for(const Ut in At.glyphs){const mr=At.glyphs[+Ut];if(!mr||mr.bitmap.width===0||mr.bitmap.height===0)continue;const ar=De[Bt][Ut],Gr=mr.metrics.localGlyph?w:1;a.fk.copy(mr.bitmap,Ct,{x:0,y:0},{x:ar.x+Gr,y:ar.y+Gr},mr.bitmap)}}this.image=Ct,this.positions=De}}function C(bt,_e,De){bt[_e]?De&&(bt[_e].center=De):bt[_e]={floorIds:new Set,center:De||[0,0],floors:{}}}function S(bt,_e,De,We){for(const vt of _e)C(bt,vt),bt[vt].floors[De]=We,bt[vt].floorIds.add(De)}function T(bt){return{id:bt.properties.id.toString(),center:bt.properties.center.toString().split(";").map(Number)}}function I(bt){return{id:bt.properties.id.toString(),isDefault:!!bt.properties.is_default&&bt.properties.is_default,connections:bt.properties.connected_floor_ids?new Set(bt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:bt.properties.conflicted_floor_ids?new Set(bt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:bt.properties.building_ids?new Set(bt.properties.building_ids.toString().split(";")):new Set,name:bt.properties.name.toString(),zIndex:bt.properties.z_index}}function A(bt,_e){return _e.every(De=>bt.properties&&bt.properties[De]!=null)}function D(bt){return A(bt,["type","id","name"])&&bt.properties.type==="building"}function $(bt){return A(bt,["type","id","name","z_index"])&&bt.properties.type==="floor"}a.fj(k,"GlyphAtlas");class F{constructor(_e){this.tileID=new a.aQ(_e.tileID.overscaledZ,_e.tileID.wrap,_e.tileID.canonical.z,_e.tileID.canonical.x,_e.tileID.canonical.y),this.tileZoom=_e.tileZoom,this.uid=_e.uid,this.zoom=_e.zoom,this.lut=_e.lut,this.canonical=_e.tileID.canonical,this.pixelRatio=_e.pixelRatio,this.tileSize=_e.tileSize,this.source=_e.source,this.scope=_e.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=_e.showCollisionBoxes,this.collectResourceTiming=!!_e.request&&_e.request.collectResourceTiming,this.promoteId=_e.promoteId,this.isSymbolTile=_e.isSymbolTile,this.tileTransform=a.aZ(_e.tileID.canonical,_e.projection),this.projection=_e.projection,this.worldview=_e.worldview,this.localizableLayerIds=_e.localizableLayerIds,this.brightness=_e.brightness,this.extraShadowCaster=!!_e.extraShadowCaster,this.tessellationStep=_e.tessellationStep,this.scaleFactor=_e.scaleFactor,this.worldview=_e.worldview,this.indoor=_e.indoor}parse(_e,De,We,vt,gt,Ct){this.status="parsing",this.data=_e,this.collisionBoxArray=new a.b3;const Bt=new a.fm(Object.keys(_e.layers).sort()),At=new a.fn(this.tileID,this.promoteId);At.bucketLayerIDs=[];const Ut={},mr=new a.fo(256,256),ar={featureIndex:At,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:mr,availableImages:We,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const Qn=this.indoor.indoorState.activeFloorsVisible,Zn=function(Yn,Os,ja){const Va=function(va,Ws){if(!va)return a.w("No source layers defined in indoor specification"),Ws;if(va.size===0)return Ws;const ha=va.difference(Ws);for(const Fi of ha)a.w(`Missing source layer required in indoor specification: ${Fi}`);return Ws.intersection(Ws)}(Os.sourceLayers,new Set(Object.keys(Yn.layers))),Ea=Os.indoorState,oo=function(va,Ws,ha,Fi){const ks=new Set,Ra=new Set,bl=new Set,Pl=new Map,Sc={},np=Qo=>{const pd=Pl.get(Qo)||new Set;for(const Jo of ks)if((Pl.get(Jo)||new Set).has(Qo)||pd.has(Jo))return!0;return!1};for(const Qo of Ws){const pd=va.layers[Qo];if(pd)for(let Jo=0;Jo=ha.maxzoom||ha.visibility==="none")continue;q(Ws,this.zoom,ar.brightness,We,this.worldview);const Fi=Ut[ha.id]=ha.createBucket({index:At.bucketLayerIDs.length,layers:Ws,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Va,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:vt,worldview:this.worldview,localizable:oo});At.bucketLayerIDs.push(Ws.map(Ra=>a.B(Ra.id,Ra.scope)));let ks=Fi.prepare?Fi.prepare():null;ks!=null?(ks=ks.then(()=>Fi.populate(Ea,ar,this.tileID.canonical,this.tileTransform)),Gr.push(ks)):Fi.populate(Ea,ar,this.tileID.canonical,this.tileTransform)}}const $r=()=>{let Qn,Zn,Yn,Os,ja,Va;mr.trim();const Ea={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},oo=()=>{if(Qn)return this.status="done",Ct(Qn);if(this.extraShadowCaster)this.status="done",Ct(null,{buckets:Object.values(Ut).filter(Ws=>!Ws.isEmpty()),featureIndex:At,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ar.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Zn&&Yn&&Os){const Ws=new k(Zn),ha=new Map;for(const[Ra,bl]of Yn.entries()){const{imagePosition:Pl}=a.fu(Ra,bl,a.fv);ha.set(Ra,Pl)}const Fi={};for(const Ra in Ut){const bl=Ut[Ra];bl instanceof a.b4&&(q(bl.layers,this.zoom,ar.brightness,We,this.worldview),Fi[Ra]=a.fw(bl,Zn,Ws.positions,Yn,ha,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,ja,this.worldview))}const ks={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(gt,Yn,ja,()=>{ks.iconsPending=!1,va(Fi,Ws,ks)}),this.rasterizeIfNeeded(gt,Os,Va,()=>{ks.patternsPending=!1,va(Fi,Ws,ks)})}},va=(Ws,ha,Fi,ks)=>{if(Fi.iconsPending||Fi.patternsPending)return;const Ra=new a.fx(Yn,Os,this.lut);for(const bl in Ut){const Pl=Ut[bl];if(bl in Ws)a.fy(Pl,Ws[bl],this.showCollisionBoxes,We,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Yn,Ra);else if(Pl.hasPattern&&(Pl instanceof a.ba||Pl instanceof a.bb||Pl instanceof a.ea)){q(Pl.layers,this.zoom,ar.brightness,We,this.worldview);const Sc=Object.fromEntries(Ra.patternPositions);Pl.addFeatures(ar,this.tileID.canonical,Sc,We,this.tileTransform,this.brightness)}}this.status="done",Ct(null,{buckets:Object.values(Ut).filter(bl=>!bl.isEmpty()),featureIndex:At,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ha.image,lineAtlas:mr,imageAtlas:Ra,brightness:ar.brightness})};if(!this.extraShadowCaster){const Ws=a.fs(ar.glyphDependencies,ks=>Object.keys(ks).map(Number));Object.keys(Ws).length?gt.send("getGlyphs",{uid:this.uid,stacks:Ws},(ks,Ra)=>{Qn||(Qn=ks,Zn=Ra,oo())},void 0,!1,Ea):Zn={};const ha=Array.from(ar.iconDependencies.keys()).map(ks=>a.I.parse(ks));ha.length?gt.send("getImages",{images:ha,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(ks,Ra)=>{Qn||(Qn=ks,Yn=new Map,ja=this.updateImageMapAndGetImageTaskQueue(Yn,Ra,ar.iconDependencies),oo())},void 0,!1,Ea):(Yn=new Map,ja=new Map);const Fi=Array.from(ar.patternDependencies.keys()).map(ks=>a.I.parse(ks));Fi.length?gt.send("getImages",{images:Fi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(ks,Ra)=>{Qn||(Qn=ks,Os=new Map,Va=this.updateImageMapAndGetImageTaskQueue(Os,Ra,ar.patternDependencies),oo())},void 0,!1,Ea):(Os=new Map,Va=new Map)}if(ar.elevationFeatures&&ar.elevationFeatures.length>0){const Ws=[];for(const Fi of Object.values(Ut))if(Fi instanceof a.bb){const ks=Fi.getUnevaluatedPortalGraph();ks&&Ws.push(ks)}const ha=a.ft.evaluate(Ws);for(const Fi of Object.values(Ut))if(Fi instanceof a.bb){const ks=_e.layers[Bt.decode(Fi.sourceLayerIndex)];Fi.setEvaluatedPortalGraph(ha,ks,this.tileID.canonical,ar.availableImages,ar.brightness)}}oo()};Gr.length>0?Promise.allSettled(Gr).then($r).catch(Ct):$r()}updateParameters(_e){this.scaleFactor=_e.scaleFactor,this.showCollisionBoxes=_e.showCollisionBoxes,this.projection=_e.projection,this.brightness=_e.brightness,this.tileTransform=a.aZ(_e.tileID.canonical,_e.projection),this.extraShadowCaster=_e.extraShadowCaster,this.lut=_e.lut,this.worldview=_e.worldview,this.indoor=_e.indoor}rasterizeIfNeeded(_e,De,We,vt){Array.from(De.values()).some(gt=>gt.usvg)?this.rasterize(_e,De,We,vt):vt()}updateImageMapAndGetImageTaskQueue(_e,De,We){const vt=new Map;for(const gt of De.keys()){const Ct=We.get(gt)||[];for(const Bt of Ct){const At=Bt.toString(),Ut=De.get(Bt.id.toString());Ut.usvg?vt.has(At)||(vt.set(At,Bt),_e.set(At,Object.assign({},Ut))):_e.set(At,Ut)}}return vt}rasterize(_e,De,We,vt){this.rasterizeTask=_e.send("rasterizeImages",{scope:this.scope,tasks:We},(gt,Ct)=>{if(!gt)for(const[Bt,At]of Ct.entries()){const Ut=Object.assign(De.get(Bt),{data:At});De.set(Bt,Ut)}vt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function q(bt,_e,De,We,vt){const gt=new a.ac(_e,{brightness:De,worldview:vt});for(const Ct of bt)Ct.recalculate(gt,We)}class W extends a.E{constructor(_e,De,We,vt,gt,Ct,Bt){super(),this.actor=_e,this.layerIndex=De,this.availableImages=We,this.availableModels=vt,this.loadVectorData=Ct||a.aL,this.loading={},this.loaded={},this.deduped=new a.aK(_e.scheduler),this.isSpriteLoaded=gt,this.scheduler=_e.scheduler,this.brightness=Bt}loadTile(_e,De){const We=_e.uid,vt=_e&&_e.request,gt=vt&&vt.collectResourceTiming,Ct=this.loading[We]=new F(_e);Ct.abort=this.loadVectorData(_e,(Bt,At)=>{const Ut=!this.loading[We];if(delete this.loading[We],Ct.cancelRasterize(),Ut||Bt||!At)return Ct.status="done",Ut||(this.loaded[We]=Ct),De(Bt);const mr=At.rawData,ar={},Gr=a.aM(At.responseHeaders);Gr&&Gr.expires&&(ar.expires=Gr.expires),Gr&&Gr.cacheControl&&(ar.cacheControl=Gr.cacheControl),Ct.vectorTile=At.vectorTile||new a.fz(new a.bt(mr));const en=()=>{Ct.parse(Ct.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,($r,Qn)=>{if($r||!Qn)return De($r);const Zn={};if(gt){const Yn=h(vt);Yn.length>0&&(Zn.resourceTiming=JSON.parse(JSON.stringify(Yn)))}De(null,Object.assign({rawTileData:mr.slice(0),responseHeaders:At.responseHeaders},Qn,ar,Zn))})};this.isSpriteLoaded?en():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(en,{type:"parseTile",isSymbolTile:_e.isSymbolTile,zoom:_e.tileZoom}):en()}),this.loaded=this.loaded||{},this.loaded[We]=Ct})}reloadTile(_e,De){const We=this.loaded,vt=_e.uid;if(We&&We[vt]){const gt=We[vt];gt.updateParameters(_e);const Ct=(Bt,At)=>{const Ut=gt.reloadCallback;Ut&&(delete gt.reloadCallback,gt.parse(gt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ut)),De(Bt,At)};gt.status==="parsing"?gt.reloadCallback=Ct:gt.status==="done"&&(gt.vectorTile?gt.parse(gt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ct):Ct())}else De(null,void 0)}abortTile(_e,De){const We=_e.uid,vt=this.loading[We];vt&&(vt.abort&&vt.abort(),delete this.loading[We]),De()}removeTile(_e,De){const We=this.loaded,vt=_e.uid;We&&We[vt]&&delete We[vt],De()}}class K{loadTile(_e,De){const{uid:We,encoding:vt,rawImageData:gt,padding:Ct}=_e,Bt=ImageBitmap&> instanceof ImageBitmap?this.getImageData(gt,Ct):gt;De(null,new a.fA(We,Bt,vt,Ct<1))}reloadTile(_e,De){De(null,null)}abortTile(_e,De){De()}removeTile(_e,De){De()}getImageData(_e,De){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(_e.width,_e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=_e.width,this.offscreenCanvas.height=_e.height,this.offscreenCanvasContext.drawImage(_e,0,0,_e.width,_e.height);const We=this.offscreenCanvasContext.getImageData(-De,-De,_e.width+2*De,_e.height+2*De);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),We}}a.bs.setPbf(a.bt);class Z{constructor(_e){this._mrt=new a.bs(_e.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=_e.uid,this.tileID=_e.tileID,this.source=_e.source}parse(_e,De){const We=this._mrt;this.status="parsing",this._entireBuffer=_e;try{We.parseHeader(_e),this._isHeaderLoaded=!0;const vt=[];for(const gt in We.layers){const Ct=We.getLayer(gt),Bt=Ct.getDataRange(Ct.getBandList()),At=We.createDecodingTask(Bt),Ut=_e.slice(Bt.firstByte,Bt.lastByte+1),mr=a.bs.performDecoding(Ut,At).then(ar=>At.complete(null,ar)).catch(ar=>At.complete(ar,null));vt.push(mr)}Promise.allSettled(vt).then(()=>De(null,We)).catch(gt=>De(gt))}catch(vt){De(vt)}}}class re{constructor(_e){this.actor=_e,this.loading={},this.loaded={}}loadTile(_e,De){const We=_e.uid,vt=_e.request,gt=this.loading[We]=new Z(_e),{cancel:Ct}=a.bu(vt,(Bt,At,Ut)=>{const mr=!this.loading[We];if(delete this.loading[We],mr||Bt||!At)return gt.status="done",mr||(this.loaded[We]=gt),De(Bt);gt.parse(At,(ar,Gr)=>{if(ar||!Gr)return De(ar);De(null,Gr,Ut)}),this.loaded[We]=gt});gt.abort=Ct}reloadTile(_e,De){De(null,void 0)}abortTile(_e,De){const We=_e.uid,vt=this.loading[We];vt&&(vt.abort&&vt.abort(),delete this.loading[We]),De()}removeTile(_e,De){const We=_e.uid;this.loaded[We]&&delete this.loaded[We],De()}decodeRasterArray(_e,De){a.bs.performDecoding(_e.buffer,_e.task).then(We=>De(null,We)).catch(We=>De(We))}}const he=a.fB.prototype.toGeoJSON;class ue{constructor(_e){this._feature=_e,this.extent=a.al,this.type=_e.type,this.properties=_e.tags,"id"in _e&&!isNaN(_e.id)&&(this.id=parseInt(_e.id,10))}loadGeometry(){if(this._feature.type===1){const _e=[];for(const De of this._feature.geometry)_e.push([new a.P(De[0],De[1])]);return _e}{const _e=[];for(const De of this._feature.geometry){const We=[];for(const vt of De)We.push(new a.P(vt[0],vt[1]));_e.push(We)}return _e}}toGeoJSON(_e,De,We){return he.call(this,_e,De,We)}}class je{constructor(_e,De){this.name=_e,this.extent=a.al,this.length=De.length,this._jsonFeatures=De}feature(_e){return new ue(this._jsonFeatures[_e])}}class ne{constructor(_e){this.layers={},this.extent=a.al;for(const De of Object.keys(_e))this.layers[De]=new je(De,_e[De])}}const ye=64/4096,ie=128;class me{constructor(){this.features=new Map}clear(){this.features.clear()}load(_e=[],De){for(const We of _e){const vt=We.id;if(vt==null)continue;let gt=this.features.get(vt);gt&&this.updateCache(gt,De),We.geometry?(gt=ve(We),this.updateCache(gt,De),this.features.set(vt,gt)):this.features.delete(vt),this.updateCache(gt,De)}}updateCache(_e,De){for(const{canonical:We,uid:vt}of Object.values(De)){const{z:gt,x:Ct,y:Bt}=We;fe(_e,Math.pow(2,gt),Ct,Bt)&&delete De[vt]}}getTile(_e,De,We){const vt=Math.pow(2,_e),gt=[];for(const Ct of this.features.values())fe(Ct,vt,De,We)&>.push(ae(Ct,vt,De,We));return{features:gt}}getFeatures(){return[...this.features.values()]}}function fe({minX:bt,minY:_e,maxX:De,maxY:We},vt,gt,Ct){return bt<(gt+1+ye)/vt&&_e<(Ct+1+ye)/vt&&De>(gt-ye)/vt&&We>(Ct-ye)/vt}function ve(bt){const{id:_e,geometry:De,properties:We}=bt;if(!De)return;if(De.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:vt,coordinates:gt}=De,Ct={id:_e,type:1,geometry:[],tags:We,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Bt=Ct.geometry;if(vt==="Point")Ie(gt,Bt,Ct);else if(vt==="MultiPoint")for(const At of gt)Ie(At,Bt,Ct);else if(vt==="LineString")Ct.type=2,Se(gt,Bt,Ct);else if(vt==="MultiLineString")Ct.type=2,oe(gt,Bt,Ct);else if(vt==="Polygon")Ct.type=3,oe(gt,Bt,Ct,!0);else{if(vt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Ct.type=3;for(const At of gt)oe(At,Bt,Ct,!0)}return Ct}function Ie([bt,_e],De,We){const vt=a.aF(bt);let gt=a.aJ(_e);gt=gt<0?0:gt>1?1:gt,De.push(vt,gt),We.minX=Math.min(We.minX,vt),We.minY=Math.min(We.minY,gt),We.maxX=Math.max(We.maxX,vt),We.maxY=Math.max(We.maxY,gt)}function Se(bt,_e,De,We=!1,vt=!1){const gt=[];for(const Ct of bt)Ie(Ct,gt,De);_e.push(gt),We&&function(Ct,Bt){let At=0;for(let Ut=0,mr=Ct.length,ar=mr-2;Ut0===Bt)for(let Ut=0,mr=Ct.length;Ut=Ct&&ar>=Ct||(Ut>=Ct?(mr+=Math.round($r*((Ct-Ut)/en)),Ut=Ct):ar>=Ct&&(Gr=mr+Math.round($r*((Ct-Ut)/en)),ar=Ct),mr>=Ct&&Gr>=Ct||(mr>=Ct?(Ut+=Math.round(en*((Ct-mr)/$r)),mr=Ct):Gr>=Ct&&(ar=Ut+Math.round(en*((Ct-mr)/$r)),Gr=Ct),Bt&&Ut===Bt[Bt.length-1][0]&&mr===Bt[Bt.length-1][1]||(Bt=[[Ut,mr]],vt.push(Bt)),Bt.push([ar,Gr])))))}}function Te(bt,_e,De,We,vt){const gt=(De-ye)/_e,Ct=(We-ye)/_e,Bt=(De+1+ye)/_e,At=(We+1+ye)/_e;function Ut(Gr,en){let $r=0;return GrBt&&($r|=2),enAt&&($r|=8),$r}let mr=[];for(let Gr=1;Gr<=8;Gr*=2){let en=bt[bt.length-2],$r=bt[bt.length-1],Qn=!(Ut(en,$r)&Gr);for(let Zn=0;Zn>31}function Je(bt,_e){const{geometry:De,type:We}=bt;let vt=0,gt=0;if(We===1){_e.writeVarint(Fe(1,De.length));for(const Ct of De){const Bt=Ct[0]-vt,At=Ct[1]-gt;_e.writeVarint(Ce(Bt)),_e.writeVarint(Ce(At)),vt+=Bt,gt+=At}}else for(const Ct of De){_e.writeVarint(Fe(1,1));const Bt=Ct.length-(We===3?1:0);for(let At=0;Atbt},ge=Math.fround||(ft=new Float32Array(1),bt=>(ft[0]=+bt,ft[0]));var ft;const nt=3,Ve=5,Me=6;class rt{constructor(_e){this.options=Object.assign(Object.create(Ye),_e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(_e){const{log:De,minZoom:We,maxZoom:vt}=this.options;De&&console.time("total time");const gt=`prepare ${_e.length} points`;De&&console.time(gt),this.points=_e;const Ct=[];for(let At=0;At<_e.length;At++){const Ut=_e[At];if(!Ut.geometry)continue;const[mr,ar]=Ut.geometry.coordinates,Gr=ge(tt(mr)),en=ge(Et(ar));Ct.push(Gr,en,1/0,At,-1,1),this.options.reduce&&Ct.push(0)}let Bt=this.trees[vt+1]=this._createTree(Ct);De&&console.timeEnd(gt);for(let At=vt;At>=We;At--){const Ut=+Date.now();Bt=this.trees[At]=this._createTree(this._cluster(Bt,At)),De&&console.log("z%d: %d clusters in %dms",At,Bt.numItems,+Date.now()-Ut)}return De&&console.timeEnd("total time"),this}getClusters(_e,De){let We=((_e[0]+180)%360+360)%360-180;const vt=Math.max(-90,Math.min(90,_e[1]));let gt=_e[2]===180?180:((_e[2]+180)%360+360)%360-180;const Ct=Math.max(-90,Math.min(90,_e[3]));if(_e[2]-_e[0]>=360)We=-180,gt=180;else if(We>gt){const ar=this.getClusters([We,vt,180,Ct],De),Gr=this.getClusters([-180,vt,gt,Ct],De);return ar.concat(Gr)}const Bt=this.trees[this._limitZoom(De)],At=Bt.range(tt(We),Et(Ct),tt(gt),Et(vt)),Ut=Bt.data,mr=[];for(const ar of At){const Gr=this.stride*ar;mr.push(Ut[Gr+Ve]>1?Re(Ut,Gr,this.clusterProps):this.points[Ut[Gr+nt]])}return mr}getChildren(_e){const De=this._getOriginId(_e),We=this._getOriginZoom(_e),vt="No cluster with the specified id.",gt=this.trees[We];if(!gt)throw new Error(vt);const Ct=gt.data;if(De*this.stride>=Ct.length)throw new Error(vt);const Bt=this.options.radius/(this.options.extent*Math.pow(2,We-1)),At=gt.within(Ct[De*this.stride],Ct[De*this.stride+1],Bt),Ut=[];for(const mr of At){const ar=mr*this.stride;Ct[ar+4]===_e&&Ut.push(Ct[ar+Ve]>1?Re(Ct,ar,this.clusterProps):this.points[Ct[ar+nt]])}if(Ut.length===0)throw new Error(vt);return Ut}getLeaves(_e,De,We){const vt=[];return this._appendLeaves(vt,_e,De=De||10,We=We||0,0),vt}getTile(_e,De,We){const vt=this.trees[this._limitZoom(_e)],gt=Math.pow(2,_e),{extent:Ct,radius:Bt}=this.options,At=Bt/Ct,Ut=(We-At)/gt,mr=(We+1+At)/gt,ar={features:[]};return this._addTileFeatures(vt.range((De-At)/gt,Ut,(De+1+At)/gt,mr),vt.data,De,We,gt,ar),De===0&&this._addTileFeatures(vt.range(1-At/gt,Ut,1,mr),vt.data,gt,We,gt,ar),De===gt-1&&this._addTileFeatures(vt.range(0,Ut,At/gt,mr),vt.data,-1,We,gt,ar),ar.features.length?ar:null}getClusterExpansionZoom(_e){let De=this._getOriginZoom(_e)-1;for(;De<=this.options.maxZoom;){const We=this.getChildren(_e);if(De++,We.length!==1)break;_e=We[0].properties.cluster_id}return De}_appendLeaves(_e,De,We,vt,gt){const Ct=this.getChildren(De);for(const Bt of Ct){const At=Bt.properties;if(At&&At.cluster?gt+At.point_count<=vt?gt+=At.point_count:gt=this._appendLeaves(_e,At.cluster_id,We,vt,gt):gt1;let mr,ar,Gr;if(Ut)mr=Ge(De,At,this.clusterProps),ar=De[At],Gr=De[At+1];else{const Qn=this.points[De[At+nt]];mr=Qn.properties;const[Zn,Yn]=Qn.geometry.coordinates;ar=tt(Zn),Gr=Et(Yn)}const en={type:1,geometry:[[Math.round(this.options.extent*(ar*gt-We)),Math.round(this.options.extent*(Gr*gt-vt))]],tags:mr};let $r;$r=Ut||this.options.generateId?De[At+nt]:this.points[De[At+nt]].id,$r!==void 0&&(en.id=$r),Ct.features.push(en)}}_limitZoom(_e){return Math.max(this.options.minZoom,Math.min(Math.floor(+_e),this.options.maxZoom+1))}_cluster(_e,De){const{radius:We,extent:vt,reduce:gt,minPoints:Ct}=this.options,Bt=We/(vt*Math.pow(2,De)),At=_e.data,Ut=[],mr=this.stride;for(let ar=0;arDe&&(Zn+=At[Os+Ve])}if(Zn>Qn&&Zn>=Ct){let Yn,Os=Gr*Qn,ja=en*Qn,Va=-1;const Ea=(ar/mr<<5)+(De+1)+this.points.length;for(const oo of $r){const va=oo*mr;if(At[va+2]<=De)continue;At[va+2]=De;const Ws=At[va+Ve];Os+=At[va]*Ws,ja+=At[va+1]*Ws,At[va+4]=Ea,gt&&(Yn||(Yn=this._map(At,ar,!0),Va=this.clusterProps.length,this.clusterProps.push(Yn)),gt(Yn,this._map(At,va)))}At[ar+4]=Ea,Ut.push(Os/Zn,ja/Zn,1/0,Ea,-1,Zn),gt&&Ut.push(Va)}else{for(let Yn=0;Yn1)for(const Yn of $r){const Os=Yn*mr;if(!(At[Os+2]<=De)){At[Os+2]=De;for(let ja=0;ja>5}_getOriginZoom(_e){return(_e-this.points.length)%32}_map(_e,De,We){if(_e[De+Ve]>1){const Ct=this.clusterProps[_e[De+Me]];return We?Object.assign({},Ct):Ct}const vt=this.points[_e[De+nt]].properties,gt=this.options.map(vt);return We&>===vt?Object.assign({},gt):gt}}function Re(bt,_e,De){return{type:"Feature",id:bt[_e+nt],properties:Ge(bt,_e,De),geometry:{type:"Point",coordinates:[(We=bt[_e],360*(We-.5)),Lt(bt[_e+1])]}};var We}function Ge(bt,_e,De){const We=bt[_e+Ve],vt=We>=1e4?`${Math.round(We/1e3)}k`:We>=1e3?Math.round(We/100)/10+"k":We,gt=bt[_e+Me],Ct=gt===-1?{}:Object.assign({},De[gt]);return Object.assign(Ct,{cluster:!0,cluster_id:bt[_e+nt],point_count:We,point_count_abbreviated:vt})}function tt(bt){return bt/360+.5}function Et(bt){const _e=Math.sin(bt*Math.PI/180),De=.5-.25*Math.log((1+_e)/(1-_e))/Math.PI;return De<0?0:De>1?1:De}function Lt(bt){const _e=(180-360*bt)*Math.PI/180;return 360*Math.atan(Math.exp(_e))/Math.PI-90}function Ot(bt,_e,De,We){let vt=We;const gt=_e+(De-_e>>1);let Ct,Bt=De-_e;const At=bt[_e],Ut=bt[_e+1],mr=bt[De],ar=bt[De+1];for(let Gr=_e+3;Grvt)Ct=Gr,vt=en;else if(en===vt){const $r=Math.abs(Gr-gt);$rWe&&(Ct-_e>3&&Ot(bt,_e,Ct,We),bt[Ct+2]=vt,De-Ct>3&&Ot(bt,Ct,De,We))}function Dt(bt,_e,De,We,vt,gt){let Ct=vt-De,Bt=gt-We;if(Ct!==0||Bt!==0){const At=((bt-De)*Ct+(_e-We)*Bt)/(Ct*Ct+Bt*Bt);At>1?(De=vt,We=gt):At>0&&(De+=Ct*At,We+=Bt*At)}return Ct=bt-De,Bt=_e-We,Ct*Ct+Bt*Bt}function kt(bt,_e,De,We){const vt={id:bt??null,type:_e,geometry:De,tags:We,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(_e==="Point"||_e==="MultiPoint"||_e==="LineString")sr(vt,De);else if(_e==="Polygon")sr(vt,De[0]);else if(_e==="MultiLineString")for(const gt of De)sr(vt,gt);else if(_e==="MultiPolygon")for(const gt of De)sr(vt,gt[0]);return vt}function sr(bt,_e){for(let De=0;De<_e.length;De+=3)bt.minX=Math.min(bt.minX,_e[De]),bt.minY=Math.min(bt.minY,_e[De+1]),bt.maxX=Math.max(bt.maxX,_e[De]),bt.maxY=Math.max(bt.maxY,_e[De+1])}function Pr(bt,_e,De,We){if(!_e.geometry)return;const vt=_e.geometry.coordinates;if(vt&&vt.length===0)return;const gt=_e.geometry.type,Ct=Math.pow(De.tolerance/((1<0&&(Ct+=We?(vt*mr-Ut*gt)/2:Math.sqrt(Math.pow(Ut-vt,2)+Math.pow(mr-gt,2))),vt=Ut,gt=mr}const Bt=_e.length-3;_e[2]=1,Ot(_e,0,Bt,De),_e[Bt+2]=1,_e.size=Math.abs(Ct),_e.start=0,_e.end=_e.size}function pn(bt,_e,De,We){for(let vt=0;vt1?1:De}function _r(bt,_e,De,We,vt,gt,Ct,Bt){if(We/=_e,gt>=(De/=_e)&&Ct=We)return null;const At=[];for(const Ut of bt){const mr=Ut.geometry;let ar=Ut.type;const Gr=vt===0?Ut.minX:Ut.minY,en=vt===0?Ut.maxX:Ut.maxY;if(Gr>=De&&en=We)continue;let $r=[];if(ar==="Point"||ar==="MultiPoint")js(mr,$r,De,We,vt);else if(ar==="LineString")Ii(mr,$r,De,We,vt,!1,Bt.lineMetrics);else if(ar==="MultiLineString")Aa(mr,$r,De,We,vt,!1);else if(ar==="Polygon")Aa(mr,$r,De,We,vt,!0);else if(ar==="MultiPolygon")for(const Qn of mr){const Zn=[];Aa(Qn,Zn,De,We,vt,!0),Zn.length&&$r.push(Zn)}if($r.length){if(Bt.lineMetrics&&ar==="LineString"){for(const Qn of $r)At.push(kt(Ut.id,ar,Qn,Ut.tags));continue}ar!=="LineString"&&ar!=="MultiLineString"||($r.length===1?(ar="LineString",$r=$r[0]):ar="MultiLineString"),ar!=="Point"&&ar!=="MultiPoint"||(ar=$r.length===3?"Point":"MultiPoint"),At.push(kt(Ut.id,ar,$r,Ut.tags))}}return At.length?At:null}function js(bt,_e,De,We,vt){for(let gt=0;gt=De&&Ct<=We&&ca(_e,bt[gt],bt[gt+1],bt[gt+2])}}function Ii(bt,_e,De,We,vt,gt,Ct){let Bt=fi(bt);const At=vt===0?Yo:Xo;let Ut,mr,ar=bt.start;for(let Zn=0;ZnDe&&(mr=At(Bt,Yn,Os,Va,Ea,De),Ct&&(Bt.start=ar+Ut*mr)):oo>We?va=De&&(mr=At(Bt,Yn,Os,Va,Ea,De),Ws=!0),va>We&&oo<=We&&(mr=At(Bt,Yn,Os,Va,Ea,We),Ws=!0),!gt&&Ws&&(Ct&&(Bt.end=ar+Ut*mr),_e.push(Bt),Bt=fi(bt)),Ct&&(ar+=Ut)}let Gr=bt.length-3;const en=bt[Gr],$r=bt[Gr+1],Qn=vt===0?en:$r;Qn>=De&&Qn<=We&&ca(Bt,en,$r,bt[Gr+2]),Gr=Bt.length-3,gt&&Gr>=3&&(Bt[Gr]!==Bt[0]||Bt[Gr+1]!==Bt[1])&&ca(Bt,Bt[0],Bt[1],Bt[2]),Bt.length&&_e.push(Bt)}function fi(bt){const _e=[];return _e.size=bt.size,_e.start=bt.start,_e.end=bt.end,_e}function Aa(bt,_e,De,We,vt,gt){for(const Ct of bt)Ii(Ct,_e,De,We,vt,gt,!1)}function ca(bt,_e,De,We){bt.push(_e,De,We)}function Yo(bt,_e,De,We,vt,gt){const Ct=(gt-_e)/(We-_e);return ca(bt,gt,De+(vt-De)*Ct,1),Ct}function Xo(bt,_e,De,We,vt,gt){const Ct=(gt-De)/(vt-De);return ca(bt,_e+(We-_e)*Ct,gt,1),Ct}function Hs(bt,_e){const De=[];for(let We=0;We0&&_e.size<(vt?Ct:We))return void(De.numPoints+=_e.length/3);const Bt=[];for(let At=0;At<_e.length;At+=3)(We===0||_e[At+2]>Ct)&&(De.numSimplified++,Bt.push(_e[At],_e[At+1])),De.numPoints++;vt&&function(At,Ut){let mr=0;for(let ar=0,Gr=At.length,en=Gr-2;ar0===Ut)for(let ar=0,Gr=At.length;ar24)throw new Error("maxZoom should be in the 0-24 range");if(De.promoteId&&De.generateId)throw new Error("promoteId and generateId cannot be used together.");let vt=function(gt,Ct){const Bt=[];if(gt.type==="FeatureCollection")for(let At=0;At1&&console.time("creation"),en=this.tiles[Gr]=Mi(_e,De,We,vt,Ut),this.tileCoords.push({z:De,x:We,y:vt}),mr)){mr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",De,We,vt,en.numFeatures,en.numPoints,en.numSimplified),console.timeEnd("creation"));const Ws=`z${De}`;this.stats[Ws]=(this.stats[Ws]||0)+1,this.total++}if(en.source=_e,gt==null){if(De===Ut.indexMaxZoom||en.numPoints<=Ut.indexMaxPoints)continue}else{if(De===Ut.maxZoom||De===gt)continue;if(gt!=null){const Ws=gt-De;if(We!==Ct>>Ws||vt!==Bt>>Ws)continue}}if(en.source=null,_e.length===0)continue;mr>1&&console.time("clipping");const $r=.5*Ut.buffer/Ut.extent,Qn=.5-$r,Zn=.5+$r,Yn=1+$r;let Os=null,ja=null,Va=null,Ea=null,oo=_r(_e,ar,We-$r,We+Zn,0,en.minX,en.maxX,Ut),va=_r(_e,ar,We+Qn,We+Yn,0,en.minX,en.maxX,Ut);_e=null,oo&&(Os=_r(oo,ar,vt-$r,vt+Zn,1,en.minY,en.maxY,Ut),ja=_r(oo,ar,vt+Qn,vt+Yn,1,en.minY,en.maxY,Ut),oo=null),va&&(Va=_r(va,ar,vt-$r,vt+Zn,1,en.minY,en.maxY,Ut),Ea=_r(va,ar,vt+Qn,vt+Yn,1,en.minY,en.maxY,Ut),va=null),mr>1&&console.timeEnd("clipping"),At.push(Os||[],De+1,2*We,2*vt),At.push(ja||[],De+1,2*We,2*vt+1),At.push(Va||[],De+1,2*We+1,2*vt),At.push(Ea||[],De+1,2*We+1,2*vt+1)}}getTile(_e,De,We){_e=+_e,De=+De,We=+We;const vt=this.options,{extent:gt,debug:Ct}=vt;if(_e<0||_e>24)return null;const Bt=1<<_e,At=fo(_e,De=De+Bt&Bt-1,We);if(this.tiles[At])return bs(this.tiles[At],gt);Ct>1&&console.log("drilling down to z%d-%d-%d",_e,De,We);let Ut,mr=_e,ar=De,Gr=We;for(;!Ut&&mr>0;)mr--,ar>>=1,Gr>>=1,Ut=this.tiles[fo(mr,ar,Gr)];return Ut&&Ut.source?(Ct>1&&(console.log("found parent tile z%d-%d-%d",mr,ar,Gr),console.time("drilling down")),this.splitTile(Ut.source,mr,ar,Gr,_e,De,We),Ct>1&&console.timeEnd("drilling down"),this.tiles[At]?bs(this.tiles[At],gt):null):null}}function fo(bt,_e,De){return 32*((1<Ut.tags&&"3d_elevation_id"in Ut.tags&&"source"in Ut.tags&&Ut.tags.source==="elevation",gt=We.features.filter(Ut=>vt(Ut));let Ct={_geojsonTileLayer:We.features};gt.length>0&&(Ct={_geojsonTileLayer:We.features.filter(Ut=>!vt(Ut)),hd_road_elevation:gt});const Bt=new ne(Ct),At=function(Ut){const mr=new a.bt;for(const ar of Object.keys(Ut))mr.writeMessage(3,Be,{name:ar,features:Ut[ar]});return mr.finish()}(Ct).buffer;_e(null,{vectorTile:Bt,rawData:At})}class po extends W{constructor(_e,De,We,vt,gt,Ct,Bt){super(_e,De,We,vt,gt,rs,Bt),Ct&&(this.loadGeoJSON=Ct),this._dynamicIndex=new me}loadData(_e,De){const We=_e&&_e.request,vt=We&&We.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(_e,(gt,Ct)=>{if(gt||!Ct)return De(gt);if(typeof Ct!="object")return De(new Error(`Input data given to '${_e.source}' is not a valid GeoJSON object.`));{try{if(_e.filter){const At=a.U(_e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(At.result==="error")throw new Error(At.value.map(Ut=>`${Ut.key}: ${Ut.message}`).join(", "));Ct.features=Ct.features.filter(Ut=>At.value.evaluate({zoom:0},Ut))}_e.dynamic?(Ct.type==="Feature"&&(Ct={type:"FeatureCollection",features:[Ct]}),_e.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Ct.features,this.loaded),_e.cluster&&(Ct.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=_e.cluster?new rt(function({superclusterOptions:At,clusterProperties:Ut}){if(!Ut||!At)return At;const mr={},ar={},Gr={accumulated:null,zoom:0},en={properties:null},$r=Object.keys(Ut);for(const Qn of $r){const[Zn,Yn]=Ut[Qn],Os=a.U(Yn),ja=a.U(typeof Zn=="string"?[Zn,["accumulated"],["get",Qn]]:Zn);mr[Qn]=Os.value,ar[Qn]=ja.value}return At.map=Qn=>{en.properties=Qn;const Zn={};for(const Yn of $r)Zn[Yn]=mr[Yn].evaluate(Gr,en);return Zn},At.reduce=(Qn,Zn)=>{en.properties=Zn;for(const Yn of $r)Gr.accumulated=Qn[Yn],Qn[Yn]=ar[Yn].evaluate(Gr,en)},At}(_e)).load(Ct.features):_e.dynamic?this._dynamicIndex:function(At,Ut){return new Nc(At,Ut)}(Ct,_e.geojsonVtOptions)}catch(At){return De(At)}const Bt={};if(vt){const At=h(We);At&&(Bt.resourceTiming={},Bt.resourceTiming[_e.source]=JSON.parse(JSON.stringify(At)))}De(null,Bt)}})}reloadTile(_e,De){const We=this.loaded;return We&&We[_e.uid]?_e.partial?De(null,void 0):super.reloadTile(_e,De):this.loadTile(_e,De)}loadGeoJSON(_e,De){if(_e.request)a.m(_e.request,De);else{if(typeof _e.data!="string")return De(new Error(`Input data given to '${_e.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return De(null,JSON.parse(_e.data))}catch{return De(new Error(`Input data given to '${_e.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(_e,De){try{De(null,this._geoJSONIndex.getClusterExpansionZoom(_e.clusterId))}catch(We){De(We)}}getClusterChildren(_e,De){try{De(null,this._geoJSONIndex.getChildren(_e.clusterId))}catch(We){De(We)}}getClusterLeaves(_e,De){try{De(null,this._geoJSONIndex.getLeaves(_e.clusterId,_e.limit,_e.offset))}catch(We){De(We)}}}class Od{constructor(_e,De,We){this.tileID=new a.aQ(_e.tileID.overscaledZ,_e.tileID.wrap,_e.tileID.canonical.z,_e.tileID.canonical.x,_e.tileID.canonical.y),this.tileZoom=_e.tileZoom,this.uid=_e.uid,this.zoom=_e.zoom,this.canonical=_e.tileID.canonical,this.pixelRatio=_e.pixelRatio,this.tileSize=_e.tileSize,this.source=_e.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=_e.projection,this.brightness=De,this.worldview=We}parse(_e,De,We,vt){this.status="parsing";const gt=new a.aQ(We.tileID.overscaledZ,We.tileID.wrap,We.tileID.canonical.z,We.tileID.canonical.x,We.tileID.canonical.y),Ct=[],Bt=De.familiesBySource[We.source],At=new a.fn(gt,We.promoteId);At.bucketLayerIDs=[],At.is3DTile=!0,a.fC(_e).then(Ut=>{if(!Ut)return vt(new Error("Could not parse tile"));const mr=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ut.json.asset.extras&&Ut.json.asset.extras.MAPBOX_mesh_features,ar=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("EXT_meshopt_compression"),Gr=new a.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const en in Bt)for(const $r of Bt[en]){const Qn=$r[0];At.bucketLayerIDs.push($r.map(Os=>a.B(Os.id,Os.scope))),Qn.recalculate(Gr,[]);const Zn=a.fD(Ut,1/a.d7(We.tileID.canonical)),Yn=new a.fE($r,Zn,gt,mr,ar,this.brightness,At,this.worldview);mr||(Yn.needsUpload=!0),Ct.push(Yn),Yn.evaluate(Qn)}this.status="done",vt(null,{buckets:Ct,featureIndex:At,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ut=>vt(new Error(Ut.message)))}}class vr{constructor(_e,De,We,vt,gt,Ct,Bt,At){this.actor=_e,this.layerIndex=De,this.availableImages=We,this.availableModels=vt,this.brightness=Bt,this.loading={},this.loaded={},this.worldview=At}loadTile(_e,De){const We=_e.uid,vt=this.loading[We]=new Od(_e,this.brightness,this.worldview);a.bu(_e.request,(gt,Ct)=>{const Bt=!this.loading[We];return delete this.loading[We],Bt||gt?(vt.status="done",Bt||(this.loaded[We]=vt),De(gt)):Ct&&Ct.byteLength!==0?void vt.parse(Ct,this.layerIndex,_e,(At,Ut)=>{vt.status="done",this.loaded=this.loaded||{},this.loaded[We]=vt,At||!Ut?De(At):De(null,Ut)}):(vt.status="done",this.loaded[We]=vt,De())})}reloadTile(_e,De){const We=this.loaded,vt=_e.uid;if(We&&We[vt]){const gt=We[vt];gt.projection=_e.projection,gt.brightness=_e.brightness;const Ct=(Bt,At)=>{gt.reloadCallback&&(delete gt.reloadCallback,this.loadTile(_e,De)),De(Bt,At)};gt.status==="parsing"?gt.reloadCallback=Ct:gt.status==="done"&&this.loadTile(_e,De)}}abortTile(_e,De){const We=_e.uid;this.loading[We]&&delete this.loading[We],De()}removeTile(_e,De){const We=this.loaded,vt=_e.uid;We&&We[vt]&&delete We[vt],De()}}class Vn{constructor(_e){this.self=_e,this.actor=new a.fG(_e,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new a.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=a.cm({name:"mercator"}),this.workerSourceTypes={vector:W,geojson:po,"raster-dem":K,"raster-array":re,"batched-model":vr},this.workerSources={},this.self.registerWorkerSource=(De,We)=>{if(this.workerSourceTypes[De])throw new Error(`Worker source with name "${De}" already registered.`);this.workerSourceTypes[De]=We},this.self.registerRTLTextPlugin=De=>{if(a.fH.isParsed())throw new Error("RTL text plugin already registered.");a.fH.setState({pluginStatus:a.fI.parsed,pluginURL:a.fH.getPluginURL()}),a.fH.applyArabicShaping=De.applyArabicShaping,a.fH.processBidirectionalText=De.processBidirectionalText,a.fH.processStyledBidirectionalText=De.processStyledBidirectionalText;for(const We of this.rtlPluginParsingListeners)We(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(_e,De,We){delete this.layerIndexes[_e],delete this.availableImages[_e],delete this.availableModels[_e],delete this.workerSources[_e],We()}checkIfReady(_e,De,We){We()}setReferrer(_e,De){this.referrer=De}spriteLoaded(_e,De){this.isSpriteLoaded[_e]||(this.isSpriteLoaded[_e]={});const{scope:We,isLoaded:vt}=De;if(this.isSpriteLoaded[_e][We]=vt,this.workerSources[_e]&&this.workerSources[_e][We])for(const gt in this.workerSources[_e][We]){const Ct=this.workerSources[_e][We][gt];for(const Bt in Ct){const At=Ct[Bt];At instanceof W&&(At.isSpriteLoaded=vt,At.fire(new a.z("isSpriteLoaded")))}}}setImages(_e,De,We){this.availableImages[_e]||(this.availableImages[_e]={});const{scope:vt,images:gt}=De;if(this.availableImages[_e][vt]=gt,this.workerSources[_e]&&this.workerSources[_e][vt]){for(const Ct in this.workerSources[_e][vt]){const Bt=this.workerSources[_e][vt][Ct];for(const At in Bt)Bt[At].availableImages=gt}We()}else We()}setModels(_e,{scope:De,models:We},vt){if(this.availableModels[_e]||(this.availableModels[_e]={}),this.availableModels[_e][De]=We,this.workerSources[_e]&&this.workerSources[_e][De]){for(const gt in this.workerSources[_e][De]){const Ct=this.workerSources[_e][De][gt];for(const Bt in Ct)Ct[Bt].availableModels=We}vt()}else vt()}setProjection(_e,De){this.projections[_e]=a.cm(De)}setBrightness(_e,De,We){this.brightness=De,We()}setWorldview(_e,De,We){this.worldview=De,We()}setLayers(_e,De,We){this.getLayerIndex(_e,De.scope).replace(De.layers,De.options),We()}updateLayers(_e,De,We){this.getLayerIndex(_e,De.scope).update(De.layers,De.removedIds,De.options),We()}loadTile(_e,De,We){De.projection=this.projections[_e]||this.defaultProjection,this.getWorkerSource(_e,De.type,De.source,De.scope).loadTile(De,We)}decodeRasterArray(_e,De,We){this.getWorkerSource(_e,De.type,De.source,De.scope).decodeRasterArray(De,We)}reloadTile(_e,De,We){De.projection=this.projections[_e]||this.defaultProjection,this.getWorkerSource(_e,De.type,De.source,De.scope).reloadTile(De,We)}abortTile(_e,De,We){this.getWorkerSource(_e,De.type,De.source,De.scope).abortTile(De,We)}removeTile(_e,De,We){this.getWorkerSource(_e,De.type,De.source,De.scope).removeTile(De,We)}removeSource(_e,De,We){if(!(this.workerSources[_e]&&this.workerSources[_e][De.scope]&&this.workerSources[_e][De.scope][De.type]&&this.workerSources[_e][De.scope][De.type][De.source]))return;const vt=this.workerSources[_e][De.scope][De.type][De.source];delete this.workerSources[_e][De.scope][De.type][De.source],vt.removeSource!==void 0?vt.removeSource(De,We):We()}loadWorkerSource(_e,De,We){try{this.self.importScripts(De.url),We()}catch(vt){We(vt)}}syncRTLPluginState(_e,De,We){if(a.fH.isParsed())We(null,!0);else if(a.fH.isParsing())this.rtlPluginParsingListeners.push(We);else try{a.fH.setState(De);const vt=a.fH.getPluginURL();!a.fH.isLoaded()||a.fH.isParsed()||a.fH.isParsing()||vt==null||(a.fH.setState({pluginStatus:a.fI.parsing,pluginURL:a.fH.getPluginURL()}),this.self.importScripts(vt),a.fH.isParsed()?We(null,!0):this.rtlPluginParsingListeners.push(We))}catch(vt){We(vt)}}setDracoUrl(_e,De){this.dracoUrl=De}getAvailableImages(_e,De){this.availableImages[_e]||(this.availableImages[_e]={});let We=this.availableImages[_e][De];return We||(We=[]),We}getAvailableModels(_e,De){this.availableModels[_e]||(this.availableModels[_e]={});let We=this.availableModels[_e][De];return We||(We={}),We}getLayerIndex(_e,De){this.layerIndexes[_e]||(this.layerIndexes[_e]={});let We=this.layerIndexes[_e][De];return We||(We=this.layerIndexes[_e][De]=new v,We.scope=De),We}getWorkerSource(_e,De,We,vt){const gt=this.workerSources;return gt[_e]||(gt[_e]={}),gt[_e][vt]||(gt[_e][vt]={}),gt[_e][vt][De]||(gt[_e][vt][De]={}),this.isSpriteLoaded[_e]||(this.isSpriteLoaded[_e]={}),gt[_e][vt][De][We]||(gt[_e][vt][De][We]=new this.workerSourceTypes[De]({send:(Ct,Bt,At,Ut,mr,ar)=>this.actor.send(Ct,Bt,At,_e,mr,ar),scheduler:this.actor.scheduler},this.getLayerIndex(_e,vt),this.getAvailableImages(_e,vt),this.getAvailableModels(_e,vt),this.isSpriteLoaded[_e][vt],void 0,this.brightness,this.worldview)),gt[_e][vt][De][We]}rasterizeImagesWorker(_e,De,We){const vt=new Map;for(const[gt,{image:Ct,imageVariant:Bt}]of De.tasks.entries()){const At=this.imageRasterizer.rasterize(Bt,Ct,De.scope,_e);vt.set(gt,At)}We(void 0,vt)}removeRasterizedImages(_e,De,We){this.imageRasterizer.removeImagesFromCacheByIds(De.imageIds,De.scope,_e),We()}enforceCacheSizeLimit(_e,De){a.fJ(De)}getWorkerPerformanceMetrics(_e,De,We){We(void 0,void 0)}}return a.fF(self)&&(self.worker=new Vn(self)),Vn}),o(["./shared"],function(a){var h="3.17.0";const m={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(_){performance.mark(_)},measure(_,d,p){performance.measure(_,d,p)}};function v(_){const d=_.name.split("?")[0];return a.a(d)&&d.includes("mapbox-gl.js")?"javascript":a.a(d)&&d.includes("mapbox-gl.css")?"css":a.b(d)?"fontRange":a.c(d)?"sprite":a.i(d)?"style":a.d(d)?"tilejson":"other"}var w,k={},C=function(){if(w)return k;function _(b){return!d(b)}function d(b){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var L,O,z=new Blob([""],{type:"text/javascript"}),V=URL.createObjectURL(z);try{O=new Worker(V),L=!0}catch{L=!1}return O&&O.terminate(),URL.revokeObjectURL(V),L}()?function(){var L=document.createElement("canvas");L.width=L.height=1;var O=L.getContext("2d");if(!O)return!1;var z=O.getImageData(0,0,1,1);return z&&z.width===L.width}()?(p[M=b&&b.failIfMajorPerformanceCaveat]===void 0&&(p[M]=function(L){var O,z=function(V){var Y=document.createElement("canvas"),Q=Object.create(_.webGLContextAttributes);return Q.failIfMajorPerformanceCaveat=V,Y.getContext("webgl2",Q)}(L);if(!z)return!1;try{O=z.createShader(z.VERTEX_SHADER)}catch{return!1}return!(!O||z.isContextLost())&&(z.shaderSource(O,"void main() {}"),z.compileShader(O),z.getShaderParameter(O,z.COMPILE_STATUS)===!0)}(M)),p[M]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var M}w=1,k.supported=_,k.notSupportedReason=d;var p={};return _.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},k}();function S(_,d,p){const b=document.createElement(_);return d!=null&&(b.className=d),p&&p.appendChild(b),b}function T(_,d,p){const b=document.createElementNS("http://www.w3.org/2000/svg",_);for(const M of Object.keys(d))b.setAttributeNS(null,M,String(d[M]));return p&&p.appendChild(b),b}const I=typeof document<"u"?document.documentElement&&document.documentElement.style:null,A=I&&I.userSelect!==void 0?"userSelect":"WebkitUserSelect";let D;function $(){I&&A&&(D=I[A],I[A]="none")}function F(){I&&A&&(I[A]=D)}function q(_){_.preventDefault(),_.stopPropagation(),window.removeEventListener("click",q,!0)}function W(){window.addEventListener("click",q,!0),window.setTimeout(()=>{window.removeEventListener("click",q,!0)},0)}function K(_,d){const p=_.getBoundingClientRect();return he(_,p,d)}function Z(_,d){const p=_.getBoundingClientRect(),b=[];for(let M=0;Mthis._skuTokenExpiresAt}transformRequest(d,p){return this._transformRequestFn&&this._transformRequestFn(d,p)||{url:d}}normalizeStyleURL(d,p){if(!a.h(d))return d;const b=ie(d);return b.params.push(`sdk=js-${h}`),b.path=`/styles/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||p)}normalizeGlyphsURL(d,p){if(!a.h(d))return d;const b=ie(d);return b.path=`/fonts/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||p)}normalizeModelURL(d,p){if(!a.h(d))return d;const b=ie(d);return b.path=`/models/v1${b.path}`,this._makeAPIURL(b,this._customAccessToken||p)}normalizeSourceURL(d,p,b,M){if(!a.h(d))return d;const L=ie(d);return L.path=`/v4/${L.authority}.json`,L.params.push("secure"),b&&L.params.push(`language=${b}`),M&&L.params.push(`worldview=${M}`),this._makeAPIURL(L,this._customAccessToken||p)}normalizeIconsetURL(d,p){const b=ie(d);return a.h(d)?(b.path=`/styles/v1${b.path}/iconset.pbf`,this._makeAPIURL(b,this._customAccessToken||p)):me(b)}normalizeSpriteURL(d,p,b,M){const L=ie(d);return a.h(d)?(L.path=`/styles/v1${L.path}/sprite${p}${b}`,this._makeAPIURL(L,this._customAccessToken||M)):(L.path+=`${p}${b}`,me(L))}normalizeTileURL(d,p,b){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!a.h(d))return d;const M=ie(d);M.path=M.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${p||b&&M.authority!=="raster"&&b===512?"@2x":""}${a.k.supported?".webp":"$1"}`),M.authority==="raster"?M.path=`/${a.e.RASTER_URL_PREFIX}${M.path}`:M.authority==="rasterarrays"?M.path=`/${a.e.RASTERARRAYS_URL_PREFIX}${M.path}`:M.authority==="3dtiles"?M.path=`/${a.e.TILES3D_URL_PREFIX}${M.path}`:(M.path=M.path.replace(/^.+\/v4\//,"/"),M.path=`/${a.e.TILE_URL_VERSION}${M.path}`);const L=this._customAccessToken||function(O){for(const z of O){const V=z.match(/^access_token=(.*)$/);if(V)return V[1]}return null}(M.params)||a.e.ACCESS_TOKEN;return a.e.REQUIRE_ACCESS_TOKEN&&L&&this._skuToken&&M.params.push(`sku=${this._skuToken}`),this._makeAPIURL(M,L)}canonicalizeTileURL(d,p){const b=ie(d);if(!b.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!b.path.match(/\.[\w]+$/))return d;let M="mapbox://";b.path.match(/^\/raster\/v1\//)?M+=`raster/${b.path.replace(`/${a.e.RASTER_URL_PREFIX}/`,"")}`:b.path.match(/^\/rasterarrays\/v1\//)?M+=`rasterarrays/${b.path.replace(`/${a.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:M+=`tiles/${b.path.replace(`/${a.e.TILE_URL_VERSION}/`,"")}`;let L=b.params;return p&&(L=L.filter(O=>!O.match(/^access_token=/))),L.length&&(M+=`?${L.join("&")}`),M}canonicalizeTileset(d,p){const b=!!p&&a.h(p),M=[];for(const L of d.tiles||[])a.j(L)?M.push(this.canonicalizeTileURL(L,b)):M.push(L);return M}_makeAPIURL(d,p){const b="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",M=ie(a.e.API_URL);if(d.protocol=M.protocol,d.authority=M.authority,d.protocol==="http"){const L=d.params.indexOf("secure");L>=0&&d.params.splice(L,1)}if(M.path!=="/"&&(d.path=`${M.path}${d.path}`),!a.e.REQUIRE_ACCESS_TOKEN)return me(d);if(p=p||a.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!p)throw new Error(`An API access token is required to use Mapbox GL. ${b}`);if(p[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${b}`)}return d.params=d.params.filter(L=>L.indexOf("access_token")===-1),d.params.push(`access_token=${p||""}`),me(d)}}const ye=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ie(_){const d=_.match(ye);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function me(_){const d=_.params.length?`?${_.params.join("&")}`:"";return`${_.protocol}://${_.authority}${_.path}${d}`}const fe="mapbox.eventData";function ve(_){if(!_)return null;const d=_.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(a.l(d[1]))}catch{return null}}class Ie{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const p=ve(a.e.ACCESS_TOKEN);let b="";return b=p&&p.u?a.f(p.u):a.e.ACCESS_TOKEN||"",d?`${fe}.${d}:${b}`:`${fe}:${b}`}fetchEventData(){const d=a.s("localStorage"),p=this.getStorageKey(),b=this.getStorageKey("uuid"),M=this.getStorageKey("uuidTimestamp");if(d)try{const L=localStorage.getItem(p);L&&(this.eventData=JSON.parse(L));const O=localStorage.getItem(b);O&&(this.anonId=O);const z=localStorage.getItem(M);z&&(this.anonIdTimestamp=Number(z));const V=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(p,JSON.stringify(this.eventData)),O&&localStorage.setItem(M,O.toString())}catch{a.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,p,b,M){if(!a.e.EVENTS_URL)return;const L=ie(a.e.EVENTS_URL);L.params.push(`access_token=${M||a.e.ACCESS_TOKEN||""}`);const O={event:this.type,created:new Date(d).toISOString()},z=p?Object.assign(O,p):O,V={url:me(L),headers:{"Content-Type":"text/plain"},body:JSON.stringify([z])};this.pendingRequest=a.p(V,Y=>{this.pendingRequest=null,b(Y),this.saveEventData(),this.processRequests(M)})}queueRequest(d,p){this.queue.push(d),this.processRequests(p)}}class Se extends Ie{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!a.e.EVENTS_URL||!d&&!a.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID();const p=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:p},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:p,payload:b}=this.queue.shift();this.postEvent(p,b,()=>{},d)}}const oe=new class extends Ie{constructor(_){super("appUserTurnstile"),this._customAccessToken=_}postTurnstileEvent(_,d){a.e.EVENTS_URL&&a.e.ACCESS_TOKEN&&Array.isArray(_)&&_.some(p=>a.h(p)||a.j(p))&&this.queueRequest(Date.now(),d)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=ve(a.e.ACCESS_TOKEN),p=d?d.u:a.e.ACCESS_TOKEN;let b=p!==this.eventData.tokenU;a.v(this.anonId)||(this.refreshUUID(),b=!0);const M=this.queue.shift();if(this.eventData.lastSuccess){const L=new Date(this.eventData.lastSuccess),O=new Date(M),z=(M-this.eventData.lastSuccess)/864e5;b=b||z>=1||z<-1||L.getDate()!==O.getDate()}else b=!0;b?this.postEvent(M,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:ue,"enabled.telemetry":!1,userId:this.anonId},L=>{L||(this.eventData.lastSuccess=M,this.eventData.tokenU=p)},_):this.processRequests()}},ae=oe.postTurnstileEvent.bind(oe),Ne=new class extends Ie{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(_,d,p,b){this.skuToken=d,this.errorCb=b,a.e.EVENTS_URL&&(p||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},p):this.errorCb(new Error(je)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:p}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID(),this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:ue,skuToken:this.skuToken,userId:this.anonId},b=>{b?this.errorCb(b):d&&(this.success[d]=!0)},_))}remove(){this.errorCb=null}},Te=Ne.postMapLoadEvent.bind(Ne),Be=new class extends Ie{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(_){let d=this.mapInstanceIdMap.get(_);return d||(d=a.u(),this.mapInstanceIdMap.set(_,d)),d}getEventId(_){const d=this.eventIdPerMapInstanceMap.get(_)||0;return this.eventIdPerMapInstanceMap.set(_,d+1),d}postStyleLoadEvent(_,d){const{map:p,style:b,importedStyles:M}=d;if(!a.e.EVENTS_URL||!_&&!a.e.ACCESS_TOKEN)return;const L=this.getMapInstanceId(p),O={mapInstanceId:L,eventId:this.getEventId(L),style:b};M.length&&(O.importedStyles=M),this.queueRequest({timestamp:Date.now(),payload:O},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:p}=this.queue.shift();this.postEvent(d,p,()=>{},_)}},Le=Be.postStyleLoadEvent.bind(Be),Qe=new Se({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Fe=Qe.postMetricsEvent.bind(Qe),Ce=new Se({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Je=Ce.postMetricsEvent.bind(Ce),Ae=new class extends Ie{constructor(){super("gljs.performance")}postPerformanceEvent(_,d){a.e.EVENTS_URL&&(_||a.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:p}=this.queue.shift(),b=function(M){const L=performance.getEntriesByType("resource"),O=performance.getEntriesByType("mark"),z=function(de){const be={};if(de){for(const xe in de)if(xe!=="other")for(const Pe of de[xe]){const Ee=`${xe}ResolveRangeMin`,$e=`${xe}ResolveRangeMax`,Ke=`${xe}RequestCount`,Ue=`${xe}RequestCachedCount`;be[Ee]=Math.min(be[Ee]||1/0,Pe.startTime),be[$e]=Math.max(be[$e]||-1/0,Pe.responseEnd);const mt=ct=>{be[ct]===void 0&&(be[ct]=0),++be[ct]};Pe.transferSize!==void 0&&Pe.transferSize===0&&mt(Ue),mt(Ke)}}return be}(function(de,be){const xe={};if(de)for(const Pe of de){const Ee=be(Pe);xe[Ee]===void 0&&(xe[Ee]=[]),xe[Ee].push(Pe)}return xe}(L,v)),V=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,Q=Y?Y.effectiveType:void 0,ce={counters:[],metadata:[],attributes:[]},le=(de,be,xe)=>{xe!=null&&de.push({name:be,value:xe.toString()})};for(const de in z)le(ce.counters,de,z[de]);if(M.interactionRange[0]!==1/0&&M.interactionRange[1]!==-1/0&&(le(ce.counters,"interactionRangeMin",M.interactionRange[0]),le(ce.counters,"interactionRangeMax",M.interactionRange[1])),O)for(const de of Object.values(m)){const be=O.find(xe=>xe.name===de);be&&le(ce.counters,de,be.startTime)}return le(ce.counters,"visibilityHidden",M.visibilityHidden),le(ce.attributes,"style",function(de){if(de)for(const be of de){const xe=be.name.split("?")[0];if(a.i(xe)){const Pe=xe.split("/").slice(-2);if(Pe.length===2)return`mapbox://styles/${Pe[0]}/${Pe[1]}`}}}(L)),le(ce.attributes,"terrainEnabled",M.terrainEnabled?"true":"false"),le(ce.attributes,"fogEnabled",M.fogEnabled?"true":"false"),le(ce.attributes,"projection",M.projection),le(ce.attributes,"zoom",M.zoom),le(ce.metadata,"devicePixelRatio",V),le(ce.metadata,"connectionEffectiveType",Q),le(ce.metadata,"navigatorUserAgent",navigator.userAgent),le(ce.metadata,"screenWidth",window.screen.width),le(ce.metadata,"screenHeight",window.screen.height),le(ce.metadata,"windowWidth",window.innerWidth),le(ce.metadata,"windowHeight",window.innerHeight),le(ce.metadata,"mapWidth",M.width/V),le(ce.metadata,"mapHeight",M.height/V),le(ce.metadata,"webglRenderer",M.renderer),le(ce.metadata,"webglVendor",M.vendor),le(ce.metadata,"sdkVersion",h),le(ce.metadata,"sdkIdentifier","mapbox-gl-js"),ce}(p);for(const M of b.metadata);for(const M of b.counters);for(const M of b.attributes);this.postEvent(d,b,()=>{},_)}},Ye=Ae.postPerformanceEvent.bind(Ae),ge=new class extends Ie{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(_,d,p,b){if(!a.e.API_URL||!a.e.SESSION_PATH)return;const M=ie(a.e.API_URL+a.e.SESSION_PATH);M.params.push(`sku=${d||""}`),M.params.push(`access_token=${b||a.e.ACCESS_TOKEN||""}`);const L={url:me(M),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a.g(L,O=>{this.pendingRequest=null,p(O),this.saveEventData(),this.processRequests(b)})}getSessionAPI(_,d,p,b){this.skuToken=d,this.errorCb=b,a.e.SESSION_PATH&&a.e.API_URL&&(p||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},p):this.errorCb(new Error(je)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:p}=this.queue.shift();d&&this.success[d]||this.getSession(p,this.skuToken,b=>{b?this.errorCb(b):d&&(this.success[d]=!0)},_)}remove(){this.errorCb=null}},ft=ge.getSessionAPI.bind(ge),nt=new Set;function Ve(_,d){d?nt.add(_):nt.delete(_)}class Me{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(d,p){this._updatedSourceCaches[d]=p,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const p=d.scope;this._updatedLayers[p]=this._updatedLayers[p]||new Set,this._updatedLayers[p].add(d.id),this.setDirty()}removeLayer(d){const p=d.scope;this._removedLayers[p]=this._removedLayers[p]||{},this._updatedLayers[p]=this._updatedLayers[p]||new Set,this._removedLayers[p][d.id]=d,this._updatedLayers[p].delete(d.id),this._updatedPaintProps.delete(d.fqid),this.setDirty()}getRemovedLayer(d){return this._removedLayers[d.scope]?this._removedLayers[d.scope][d.id]:null}discardLayerRemoval(d){this._removedLayers[d.scope]&&delete this._removedLayers[d.scope][d.id]}getLayerUpdatesByScope(){const d={};for(const p in this._updatedLayers)d[p]=d[p]||{},d[p].updatedIds=Array.from(this._updatedLayers[p].values());for(const p in this._removedLayers)d[p]=d[p]||{},d[p].removedIds=Object.keys(this._removedLayers[p]);return d}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(d){this._updatedPaintProps.add(d.fqid),this.setDirty()}getUpdatedImages(d){return this._updatedImages[d]?Array.from(this._updatedImages[d].values()):[]}updateImage(d,p){this._updatedImages[p]=this._updatedImages[p]||new Set,this._updatedImages[p].add(a.I.toString(d)),this.setDirty()}resetUpdatedImages(d){this._updatedImages[d]&&this._updatedImages[d].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function rt(_){const{userImage:d}=_;return!!(d&&d.render&&d.render())&&(_.data.replace(new Uint8Array(d.data.buffer)),!0)}class Re extends a.E{constructor(d){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=d,d!=="raster"&&a.r()&&(this.imageRasterizerDispatcher=new a.D(a.t(),this,"Image Rasterizer Worker",1))}addScope(d){this.loaded.set(d,!1),this.imageProviders.set(d,new Map),this.images.set(d,new Map),this.updatedImages.set(d,new Set),this.callbackDispatchedThisFrame.set(d,new Set),this.patterns.set(d,new Map),this.atlasImage.set(d,new a.q({width:1,height:1}))}removeScope(d){this.loaded.delete(d),this.imageProviders.delete(d),this.images.delete(d),this.updatedImages.delete(d),this.callbackDispatchedThisFrame.delete(d),this.patterns.delete(d),this.atlasImage.delete(d);const p=this.atlasTexture.get(d);p&&(p.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,p){this.imageProviders.has(p)||this.imageProviders.set(p,new Map),this.imageProviders.get(p).set(d.id,d)}removeImageProvider(d,p){this.imageProviders.has(p)&&this.imageProviders.get(p).delete(d)}getPendingImageProviders(){const d=[];for(const p of this.imageProviders.values())for(const b of p.values())b.hasPendingRequests()&&d.push(b);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new a.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,p){if(this.loaded.get(p)!==d&&(this.loaded.set(p,d),d)){for(const{ids:b,callback:M}of this.requestors)this._notify(b,p,M);this.requestors=[]}}hasImage(d,p){return!!this.getImage(d,p)}getImage(d,p){return this.images.get(p).get(d.toString())}addImage(d,p,b){this._validate(d,b)&&this.images.get(p).set(d.toString(),b)}_validate(d,p){let b=!0;return this._validateStretch(p.stretchX,p.data&&p.data.width)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),b=!1),this._validateStretch(p.stretchY,p.data&&p.data.height)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),b=!1),this._validateContent(p.content,p)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "content" value`))),b=!1),b}_validateStretch(d,p){if(!d)return!0;let b=0;for(const M of d){if(M[0]a.I.from(p))}getImages(d,p,b){const M=[],L=[],O=this.imageProviders.get(p);for(const Q of d){if(!Q.iconsetId){M.push(Q);continue}const ce=O.get(Q.iconsetId);ce&&(this.getImage(Q,p)?L.push(Q):ce.addPendingRequest(Q))}if(M.length===0)return void this._notify(L,p,b);let z=!0;const V=!!this.loaded.get(p),Y=this.images.get(p);if(!V)for(const Q of M)Y.has(Q.toString())||(z=!1);V||z?this._notify(M,p,b):this.requestors.push({ids:M,scope:p,callback:b})}rasterizeImages(d,p){const b=new Map,{tasks:M,scope:L}=d;for(const[O,z]of M.entries()){const V=this.getImage(z.id,L);V&&b.set(O,{image:V,imageVariant:z})}this._rasterizeImages(L,b,p)}_rasterizeImages(d,p,b){if(a.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:p,scope:d},b);else{const M=new Map;for(const[L,{image:O,imageVariant:z}]of p.entries())M.set(L,this.imageRasterizer.rasterize(z,O,d,0));b(void 0,M)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,p,b){const M=this.images.get(p),L=new Map;for(const O of d){if(!M.get(O.toString())){if(O.iconsetId)continue;this.fire(new a.z("styleimagemissing",{id:O.name}))}const z=M.get(O.toString());if(!z){a.w(`Image "${O.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const V={data:z.usvg?null:z.data.clone(),pixelRatio:z.pixelRatio,sdf:z.sdf,usvg:z.usvg,version:z.version,stretchX:z.stretchX,stretchY:z.stretchY,content:z.content,hasRenderCallback:!!(z.userImage&&z.userImage.render)};z.usvg&&Object.assign(V,{width:z.icon.usvg_tree.width,height:z.icon.usvg_tree.height}),L.set(a.I.toString(O),V)}b(null,L)}getPixelSize(d){const{width:p,height:b}=this.atlasImage.get(d);return{width:p,height:b}}getPattern(d,p,b){const M=d.toString(),L=this.patterns.get(p),O=L.get(M),z=this.getImage(d,p);if(!z)return null;if(O){if(O.position.version===z.version)return O.position;O.position.version=z.version}else{if(z.usvg&&!z.data){const V=this.getPatternInFlightId(M,p);if(this.patternsInFlight.has(V))return null;this.patternsInFlight.add(V);const Y=new a.A(d).scaleSelf(a.o.devicePixelRatio),Q=new Map([[Y.toString(),{image:z,imageVariant:Y}]]);return this._rasterizeImages(p,Q,(ce,le)=>this.storePatternImage(Y,p,z,b,le)),null}this.storePattern(d,p,z)}return this._updatePatternAtlas(p,b),L.get(M).position}getPatternInFlightId(d,p){return a.B(d,p)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,p,b,M,L){const O=d.toString(),z=L?L.get(O):void 0;z&&(b.data=z,this.storePattern(d.id,p,b),this._updatePatternAtlas(p,M),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),p)))}storePattern(d,p,b){const M={w:b.data.width+2*a.C,h:b.data.height+2*a.C,x:0,y:0},L=new a.F(M,b,a.C);this.patterns.get(p).set(d.toString(),{bin:M,position:L})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,p){const b=d.gl;let M=this.atlasTexture.get(p);M?this.dirty&&(M.update(this.atlasImage.get(p)),this.dirty=!1):(M=new a.T(d,this.atlasImage.get(p),b.RGBA8),this.atlasTexture.set(p,M)),M.bind(b.LINEAR,b.CLAMP_TO_EDGE)}_updatePatternAtlas(d,p){const b=this.patterns.get(d),M=Array.from(b.values()).map(({bin:Y})=>Y),{w:L,h:O}=a.G(M),z=this.atlasImage.get(d);z.resize({width:L||1,height:O||1});const V=this.images.get(d);for(const[Y,{bin:Q,position:ce}]of b.entries()){let le=ce.padding;const de=Q.x+le,be=Q.y+le,xe=V.get(Y).data,Pe=xe.width,Ee=xe.height;le=le>1?le-1:le,a.q.copy(xe,z,{x:0,y:0},{x:de,y:be},{width:Pe,height:Ee},p),a.q.copy(xe,z,{x:0,y:Ee-le},{x:de,y:be-le},{width:Pe,height:le},p),a.q.copy(xe,z,{x:0,y:0},{x:de,y:be+Ee},{width:Pe,height:le},p),a.q.copy(xe,z,{x:Pe-le,y:0},{x:de-le,y:be},{width:le,height:Ee},p),a.q.copy(xe,z,{x:0,y:0},{x:de+Pe,y:be},{width:le,height:Ee},p),a.q.copy(xe,z,{x:Pe-le,y:Ee-le},{x:de-le,y:be-le},{width:le,height:le},p),a.q.copy(xe,z,{x:0,y:Ee-le},{x:de+Pe,y:be-le},{width:le,height:le},p),a.q.copy(xe,z,{x:0,y:0},{x:de+Pe,y:be+Ee},{width:le,height:le},p),a.q.copy(xe,z,{x:Pe-le,y:0},{x:de-le,y:be+Ee},{width:le,height:le},p)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,p){const b=this.images.get(p);for(const M of d){if(this.callbackDispatchedThisFrame.get(p).has(M.toString()))continue;this.callbackDispatchedThisFrame.get(p).add(M.toString());const L=b.get(M.toString());rt(L)&&this.updateImage(M,p,L)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ge(_){const d=_.value,p=_.valueSpec,b=_.style,M=_.styleSpec,L=_.key,O=_.arrayElementValidator||Hs;if(!Array.isArray(d))return[new a.V(L,d,`array expected, ${a.K(d)} found`)];if(p.length&&d.length!==p.length)return[new a.V(L,d,`array length ${p.length} expected, length ${d.length} found`)];if(p["min-length"]&&d.lengthM)return[new a.V(d,p,`${p} is greater than the maximum value ${M}`)]}return[]}function Et(_){const d=_.key,p=_.value;if(!a.H(p))return[new a.V(d,p,`object expected, ${a.K(p)} found`)];const b=_.valueSpec,M=a.J(p.type);let L,O,z,V={};const Y=M!=="categorical"&&p.property===void 0,Q=!Y,ce=function(xe){const Pe=xe.stops;return Array.isArray(Pe)&&Array.isArray(Pe[0])&&a.H(Pe[0][0])}(p),le=Ki({key:_.key,value:_.value,valueSpec:_.styleSpec.function,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{stops:function(xe){if(M==="identity")return[new a.V(xe.key,xe.value,'identity function may not have a "stops" property')];let Pe=[];const Ee=xe.value;return Pe=Pe.concat(Ge({key:xe.key,value:Ee,valueSpec:xe.valueSpec,style:xe.style,styleSpec:xe.styleSpec,arrayElementValidator:de})),Array.isArray(Ee)&&Ee.length===0&&Pe.push(new a.V(xe.key,Ee,"array must have at least one stop")),Pe},default:function(xe){return Hs({key:xe.key,value:xe.value,valueSpec:b,style:xe.style,styleSpec:xe.styleSpec})}}});return M==="identity"&&Y&&le.push(new a.V(_.key,_.value,'missing required property "property"')),M==="identity"||p.stops||le.push(new a.V(_.key,_.value,'missing required property "stops"')),M==="exponential"&&b.expression&&!a.M(b)&&le.push(new a.V(_.key,_.value,"exponential functions not supported")),_.styleSpec.$version>=8&&(Q&&!a.N(b)?le.push(new a.V(_.key,_.value,"property functions not supported")):Y&&!a.O(b)&&le.push(new a.V(_.key,_.value,"zoom functions not supported"))),M!=="categorical"&&!ce||p.property!==void 0||le.push(new a.V(_.key,_.value,'"property" property is required')),le;function de(xe){let Pe=[];const Ee=xe.value,$e=xe.key;if(!Array.isArray(Ee))return[new a.V($e,Ee,`array expected, ${a.K(Ee)} found`)];if(Ee.length!==2)return[new a.V($e,Ee,`array length 2 expected, length ${Ee.length} found`)];if(ce){if(!a.H(Ee[0]))return[new a.V($e,Ee,`object expected, ${a.K(Ee[0])} found`)];const Ke=Ee[0];if(Ke.zoom===void 0)return[new a.V($e,Ee,"object stop key must have zoom")];if(Ke.value===void 0)return[new a.V($e,Ee,"object stop key must have value")];const Ue=a.J(Ke.zoom);if(typeof Ue!="number")return[new a.V($e,Ke.zoom,"stop zoom values must be numbers")];if(z&&z>Ue)return[new a.V($e,Ke.zoom,"stop zoom values must appear in ascending order")];Ue!==z&&(z=Ue,O=void 0,V={}),Pe=Pe.concat(Ki({key:`${$e}[0]`,value:Ee[0],valueSpec:{zoom:{}},style:xe.style,styleSpec:xe.styleSpec,objectElementValidators:{zoom:tt,value:be}}))}else Pe=Pe.concat(be({key:`${$e}[0]`,value:Ee[0],style:xe.style,styleSpec:xe.styleSpec},Ee));return a.Q(a.S(Ee[1]))?Pe.concat([new a.V(`${$e}[1]`,Ee[1],"expressions are not allowed in function stops.")]):Pe.concat(Hs({key:`${$e}[1]`,value:Ee[1],valueSpec:b,style:xe.style,styleSpec:xe.styleSpec}))}function be(xe,Pe){const Ee=a.K(xe.value),$e=a.J(xe.value),Ke=xe.value!==null?xe.value:Pe;if(L){if(Ee!==L)return[new a.V(xe.key,Ke,`${Ee} stop domain type must match previous stop domain type ${L}`)]}else L=Ee;if(Ee!=="number"&&Ee!=="string"&&Ee!=="boolean"&&typeof $e!="number"&&typeof $e!="string"&&typeof $e!="boolean")return[new a.V(xe.key,Ke,"stop domain value must be a number, string, or boolean")];if(Ee!=="number"&&M!=="categorical"){let Ue=`number expected, ${Ee} found`;return a.N(b)&&M===void 0&&(Ue+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new a.V(xe.key,Ke,Ue)]}return M!=="categorical"||Ee!=="number"||typeof $e=="number"&&isFinite($e)&&Math.floor($e)===$e?M!=="categorical"&&Ee==="number"&&typeof $e=="number"&&typeof O=="number"&&O!==void 0&&$enew a.V(`${_.key}${b.key}`,_.value,b.message));const p=d.value.expression||d.value._styleExpression.expression;if(_.expressionContext==="property"&&_.propertyKey==="text-font"&&!p.outputDefined())return[new a.V(_.key,_.value,`Invalid data expression for "${_.propertyKey}". Output values must be contained as literals within the expression.`)];if(_.expressionContext==="property"&&_.propertyType==="layout"&&!a.Z(p))return[new a.V(_.key,_.value,'"feature-state" data expressions are not supported with layout properties.')];if(_.expressionContext==="filter")return Ot(p,_);if(_.expressionContext==="appearance")return Dt(p,_);if(_.expressionContext&&_.expressionContext.indexOf("cluster")===0){if(!a.X(p,["zoom","feature-state"]))return[new a.V(_.key,_.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(_.expressionContext==="cluster-initial"&&!a.Y(p))return[new a.V(_.key,_.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ot(_,d){const p=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)p.delete(M);if(p.size===0)return[];const b=[];return _ instanceof a._&&p.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(_.eachChild(M=>{b.push(...Ot(M,d))}),b)}function Dt(_,d){const p=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)p.add(M);if(p.size===0)return[];const b=[];return _ instanceof a._&&!p.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] is not an allowed parameter`)]:(_.eachChild(M=>{b.push(...Dt(M,d))}),b)}function kt(_){const d=_.key,p=_.value,b=_.valueSpec,M=[];return Array.isArray(b.values)?b.values.indexOf(a.J(p))===-1&&M.push(new a.V(d,p,`expected one of [${b.values.join(", ")}], ${JSON.stringify(p)} found`)):Object.keys(b.values).indexOf(a.J(p))===-1&&M.push(new a.V(d,p,`expected one of [${Object.keys(b.values).join(", ")}], ${JSON.stringify(p)} found`)),M}function sr(_){return a.a2(a.S(_.value))?Lt(Object.assign({},_,{expressionContext:"filter",valueSpec:_.styleSpec[`filter_${_.layerType||"fill"}`]})):Pr(_)}function Pr(_){const d=_.value,p=_.key;if(!Array.isArray(d))return[new a.V(p,d,`array expected, ${a.K(d)} found`)];if(d.length<1)return[new a.V(p,d,"filter array must have at least 1 element")];const b=_.styleSpec;let M=kt({key:`${p}[0]`,value:d[0],valueSpec:b.filter_operator});const L=()=>{d.length>=2&&(a.a0(d[1])||M.push(new a.V(`${p}[1]`,d[1],`string expected, ${a.K(d[1])} found`)));for(let O=2;O":case">=":d.length>=2&&a.J(d[1])==="$type"&&M.push(new a.V(p,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&M.push(new a.V(p,d,`filter array for operator "${d[0]}" must have 3 elements`)),L();break;case"==":case"!=":d.length!==3&&M.push(new a.V(p,d,`filter array for operator "${d[0]}" must have 3 elements`)),L();break;case"in":case"!in":L();break;case"any":case"all":case"none":for(let O=1;O{Y in p&&d.push(new a.V(b,p[Y],`"${Y}" is prohibited for ref layers`))}),M.layers.forEach(Y=>{a.J(Y.id)===z&&(V=Y)}),V?V.ref?d.push(new a.V(b,p.ref,"ref cannot reference another ref layer")):O=a.J(V.type):typeof z=="string"&&d.push(new a.V(b,p.ref,`ref layer "${z}" not found`))}else if(O!=="background"&&O!=="sky"&&O!=="slot")if(p.source)if(a.a0(p.source)){const V=M.sources&&M.sources[p.source],Y=V&&a.J(V.type);V?Y==="vector"&&O==="raster"?d.push(new a.V(b,p.source,`layer "${p.id}" requires a raster source`)):Y==="raster"&&O!=="raster"?d.push(new a.V(b,p.source,`layer "${p.id}" requires a vector source`)):Y!=="vector"||p["source-layer"]?Y==="raster-dem"&&O!=="hillshade"?d.push(new a.V(b,p.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(O)?O==="line"&&p.paint&&(p.paint["line-gradient"]||p.paint["line-trim-offset"])&&Y==="geojson"&&!V.lineMetrics?d.push(new a.V(b,p,`layer "${p.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):O==="raster-particle"&&Y!=="raster-array"&&d.push(new a.V(b,p.source,`layer "${p.id}" requires a 'raster-array' source.`)):d.push(new a.V(b,p.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new a.V(b,p,`layer "${p.id}" must specify a "source-layer"`)):d.push(new a.V(b,p.source,`source "${p.source}" not found`))}else d.push(new a.V(`${b}.source`,p.source,'"source" must be a string'));else d.push(new a.V(b,p,'missing required property "source"'));return d=d.concat(Ki({key:b,value:p,valueSpec:L.layer,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Hs({key:`${b}.type`,value:p.type,valueSpec:L.layer.type,style:_.style,styleSpec:_.styleSpec,object:p,objectKey:"type"}),filter:V=>sr(Object.assign({layerType:O},V)),layout:V=>Ki({layer:p,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>pn(Object.assign({layerType:O},Y))}}),paint:V=>Ki({layer:p,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>kn(Object.assign({layerType:O,layer:p},Y))}}),appearances(V){const Y=Ge({key:V.key,value:V.value,valueSpec:V.valueSpec,style:V.style,styleSpec:V.styleSpec,arrayElementValidator:le=>function(de){const{key:be,layer:xe,layerType:Pe}=de,Ee=a.J(de.value),$e=a.J(Ee.name),Ke=a.J(Ee.condition),Ue=Ki({key:be,value:Ee,valueSpec:de.styleSpec.appearance,style:de.style,styleSpec:de.styleSpec,objectElementValidators:{condition:mt=>function(ct){const ht=[];return ht.push(...Lt({key:ct.key,value:ct.object.condition,valueSpec:a.a6.appearance.condition,expressionContext:"appearance"})),ht}(Object.assign({layer:xe,layerType:Pe},mt)),properties:mt=>function(ct){const ht=[],{styleSpec:ot,layer:st,layerType:_t}=ct,It=ot[`paint_${_t}`],Tt=ot[`layout_${_t}`],Vt=ct.object[ct.objectKey];for(const Ht in Vt){const nr=Ht in It?"paint":Ht in Tt?"layout":void 0;if(!nr){ht.push(new a.V(ct.key,Ht,`unknown property "${Ht}" for layer type "${_t}"`));continue}const br=Object.assign({},ct,{key:`${ct.key}.${Ht}`,object:Vt,objectKey:Ht,layer:st,layerType:_t,value:Vt[Ht],valueSpec:nr==="paint"?It[Ht]:Tt[Ht]});ht.push(...wn(br,nr))}return ht}(Object.assign({layer:xe,layerType:Pe},mt))}});return $e!=="hidden"&&Ke===void 0&&Ue.push(new a.V(de.key,"name",'Appearance with name different than "hidden" must have a condition')),Ue}(Object.assign({layerType:O,layer:p},le))}),Q=Array.isArray(V.value)?V.value:[],ce=new Set;return Q.forEach((le,de)=>{const be=a.J(le.name);if(be)if(ce.has(be)){const xe=a.J(p.id);Y.push(new a.V(V.key,be,`Duplicated appearance name "${be}" for layer "${xe}"`))}else ce.add(be)}),Y}}})),d}function Fs({key:_,value:d}){return a.a0(d)?[]:[new a.V(_,d,`string expected, ${a.K(d)} found`)]}const _r={promoteId:function _({key:d,value:p}){if(a.a0(p))return Fs({key:d,value:p});if(Array.isArray(p)){const M=[],L=a.S(p),O=a.U(L);return O.result==="error"&&O.value.forEach(z=>{M.push(new a.V(`${d}${z.key}`,null,`${z.message}`))}),a.X(O.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||M.push(new a.V(`${d}`,null,"promoteId expression should be only feature dependent")),M}if(!a.H(p))return[new a.V(d,p,`string, expression or object expected, "${a.K(p)}" found`)];const b=[];for(const M in p)b.push(..._({key:`${d}.${M}`,value:p[M]}));return b}};function js(_){const d=_.value,p=_.key,b=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(p,d,`object expected, ${a.K(d)} found`)];if(!("type"in d))return[new a.V(p,d,'"type" is required')];const L=a.J(d.type);let O=[];switch(["vector","raster","raster-dem","raster-array"].includes(L)&&("url"in d||"tiles"in d||O.push(new a.a3(p,d,'Either "url" or "tiles" is required.'))),L){case"vector":case"raster":case"raster-dem":case"raster-array":return O=O.concat(Ki({key:p,value:d,valueSpec:b[`source_${L.replace("-","_")}`],style:_.style,styleSpec:b,objectElementValidators:_r})),O;case"geojson":if(O=Ki({key:p,value:d,valueSpec:b.source_geojson,style:M,styleSpec:b,objectElementValidators:_r}),"cluster"in d&&"clusterProperties"in d){if(!a.H(d.clusterProperties))return[new a.V(`${p}.clusterProperties`,d,`object expected, ${a.K(d)} found`)];for(const z in d.clusterProperties){const V=d.clusterProperties[z];if(!Array.isArray(V))return[new a.V(`${p}.clusterProperties.${z}`,V,"array expected")];const[Y,Q]=V,ce=typeof Y=="string"?[Y,["accumulated"],["get",z]]:Y;O.push(...Lt({key:`${p}.${z}.map`,value:Q,expressionContext:"cluster-map"})),O.push(...Lt({key:`${p}.${z}.reduce`,value:ce,expressionContext:"cluster-reduce"}))}}return O;case"video":return Ki({key:p,value:d,valueSpec:b.source_video,style:M,styleSpec:b});case"image":return Ki({key:p,value:d,valueSpec:b.source_image,style:M,styleSpec:b});case"canvas":return[new a.V(p,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return kt({key:`${p}.type`,value:d.type,valueSpec:{values:Ii(b)}})}}function Ii(_){return _.source.reduce((d,p)=>{const b=_[p];return b.type.type==="enum"&&(d=d.concat(Object.keys(b.type.values||{}))),d},[])}function fi(_){const d=_.value,p=_.styleSpec,b=p.light,M=_.style;if(d===void 0)return[];if(!a.H(d))return[new a.V("light",d,`object expected, ${a.K(d)} found`)];let L=[];for(const O in d){const z=O.match(/^(.*)-transition$/),V=O.match(/^(.*)-use-theme$/);L=L.concat(V&&b[V[1]]?Hs({key:O,value:d[O],valueSpec:{type:"string"},style:M,styleSpec:p}):z&&b[z[1]]&&b[z[1]].transition?Hs({key:O,value:d[O],valueSpec:p.transition,style:M,styleSpec:p}):b[O]?Hs({key:O,value:d[O],valueSpec:b[O],style:M,styleSpec:p}):[new a.V(O,d[O],`unknown property "${O}"`)])}return L}function Aa(_){const d=_.value;if(!d)return[];const p=_.key;if(!a.H(d))return[new a.V(p,d,`object expected, ${a.K(d)} found`)];let b=[];const M=_.styleSpec,L=M["light-3d"],O=_.style,z=_.style.lights;for(const Q of["type","id"])if(!(Q in d))return b=b.concat([new a.V(p,d,`missing property "${Q}"`)]),b;if(!a.a0(d.type))return b=b.concat([new a.V(`${p}.type`,d.type,"string expected")]),b;if(z)for(let Q=0;Q<_.arrayIndex;Q++){const ce=a.J(d.type),le=z[Q];a.J(le.type)===ce&&b.push(new a.V(p,d.id,`duplicate light type "${d.type}", previously defined at line ${le.id.__line__}`))}const V=`properties_light_${d.type}`;if(!(V in M))return b=b.concat([new a.V(`${p}.type`,d,`Invalid light type ${d.type}`)]),b;const Y=M[V];for(const Q in d)if(Q==="properties"){const ce=d[Q];if(!a.H(ce))return b=b.concat([new a.V("properties",ce,`object expected, ${a.K(ce)} found`)]),b;for(const le in ce){const de=le.match(/^(.*)-transition$/),be=le.match(/^(.*)-use-theme$/);b=b.concat(be&&Y[be[1]]?Hs({key:Q,value:ce[le],valueSpec:{type:"string"},style:O,styleSpec:M}):de&&Y[de[1]]&&Y[de[1]].transition?Hs({key:Q,value:d[Q],valueSpec:M.transition,style:O,styleSpec:M}):Y[le]?Hs({key:le,value:ce[le],valueSpec:Y[le],style:O,styleSpec:M}):[new a.a3(_.key,ce[le],`unknown property "${le}"`)])}}else b=b.concat(L[Q]?Hs({key:Q,value:d[Q],valueSpec:L[Q],style:O,styleSpec:M}):[new a.a3(Q,d[Q],`unknown property "${Q}"`)]);return b}function ca(_){const d=_.value,p=_.key,b=_.style,M=_.styleSpec,L=M.terrain;if(d==null)return[];if(!a.H(d))return[new a.V("terrain",d,`object expected, ${a.K(d)} found`)];let O=[];for(const z in d){const V=z.match(/^(.*)-transition$/),Y=z.match(/^(.*)-use-theme$/);O=O.concat(Y&&L[Y[1]]?Hs({key:z,value:d[z],valueSpec:{type:"string"},style:b,styleSpec:M}):V&&L[V[1]]&&L[V[1]].transition?Hs({key:z,value:d[z],valueSpec:M.transition,style:b,styleSpec:M}):L[z]?Hs({key:z,value:d[z],valueSpec:L[z],style:b,styleSpec:M}):[new a.a3(z,d[z],`unknown property "${z}"`)])}if(d.source)if(a.a0(d.source)){const z=b.sources&&b.sources[d.source],V=z&&a.J(z.type);z?V!=="raster-dem"&&O.push(new a.V(`${p}.source`,d.source,`terrain cannot be used with a source of type ${V}, it only be used with a "raster-dem" source type`)):O.push(new a.V(`${p}.source`,d.source,`source "${d.source}" not found`))}else O.push(new a.V(`${p}.source`,d.source,"source must be a string"));else O.push(new a.V(p,d,'terrain is missing required property "source"'));return O}function Yo(_){const d=_.value,p=_.style,b=_.styleSpec,M=b.fog;if(d===void 0)return[];if(!a.H(d))return[new a.V("fog",d,`object expected, ${a.K(d)} found`)];let L=[];for(const O in d){const z=O.match(/^(.*)-transition$/),V=O.match(/^(.*)-use-theme$/);L=L.concat(V&&M[V[1]]?Hs({key:O,value:d[O],valueSpec:{type:"string"},style:p,styleSpec:b}):z&&M[z[1]]&&M[z[1]].transition?Hs({key:O,value:d[O],valueSpec:b.transition,style:p,styleSpec:b}):M[O]?Hs({key:O,value:d[O],valueSpec:M[O],style:p,styleSpec:b}):[new a.a3(O,d[O],`unknown property "${O}"`)])}return L}const Xo={"*":()=>[],array:Ge,boolean:function(_){const d=_.value,p=_.key;return a.$(d)?[]:[new a.V(p,d,`boolean expected, ${a.K(d)} found`)]},number:tt,color:function({key:_,value:d}){return a.a0(d)?a.a1.parseCSSColor(d)===null?[new a.V(_,d,`color expected, "${d}" found`)]:[]:[new a.V(_,d,`color expected, ${a.K(d)} found`)]},enum:kt,filter:sr,function:Et,layer:qn,object:Ki,source:js,model:a.a7,light:fi,"light-3d":Aa,terrain:ca,fog:Yo,string:Fs,formatted:function(_){return Fs(_).length===0?[]:Lt(_)},resolvedImage:function(_){return Fs(_).length===0?[]:Lt(_)},projection:function(_){const d=_.value,p=_.styleSpec,b=p.projection,M=_.style;if(a.H(d)){let L=[];for(const O in d)L=L.concat(Hs({key:O,value:d[O],valueSpec:b[O],style:M,styleSpec:p}));return L}return a.a0(d)?[]:[new a.V("projection",d,`object or string expected, ${a.K(d)} found`)]},import:function(_){const d=_.key,{value:p,styleSpec:b}=_;if(!a.H(p))return[new a.V(d,p,"import must be an object")];const{data:M,...L}=p;Object.defineProperty(L,"__line__",{value:p.__line__,enumerable:!1});let O=Ki(Object.assign({},_,{value:L,valueSpec:b.import}));return a.J(L.id)===""&&O.push(new a.V(`${_.key}.id`,L,"import id can't be an empty string")),M&&(O=O.concat(Ci(M,b,{key:`${_.key}.data`}))),O},iconset:function(_){const d=_.value,p=_.key,b=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(p,d,"object expected")];if(!d.type)return[new a.V(p,d,'"type" is required')];const L=a.J(d.type);let O=[];if(O=O.concat(Ki({key:p,value:d,valueSpec:b[`iconset_${L}`],style:M,styleSpec:b})),function(z,V){return!(z!=="source"||!V.source)}(L,d)){const z=M.sources&&M.sources[d.source],V=z&&a.J(z.type);z?V!=="raster-array"&&O.push(new a.V(p,d.source,`iconset cannot be used with a source of type ${String(V)}, it only be used with a "raster-array" source type`)):O.push(new a.V(p,d.source,`source "${d.source}" not found`))}return O}};function Hs(_,d=!1){const p=_.value,b=_.valueSpec,M=_.styleSpec;if(b.expression){if(a.a4(a.J(p)))return Et(_);if(a.Q(a.S(p)))return Lt(_)}if(b.type&&Xo[b.type]){const L=Xo[b.type](_);return d===!0&&L.length>0&&Array.isArray(_.value)?Lt(_):L}return Ki(Object.assign({},_,{valueSpec:b.type?M[b.type]:b}))}function Ki(_){const d=_.key,p=_.value,b=_.valueSpec||{},M=_.objectElementValidators||{},L=_.style,O=_.styleSpec;if(!a.H(p))return[new a.V(d,p,`object expected, ${a.K(p)} found`)];let z=[];for(const V in p){const Y=V.split(".")[0];let Q;M[Y]?Q=M[Y]:b[Y]?Q=Hs:M["*"]?Q=M["*"]:b["*"]&&(Q=Hs),Q?z=z.concat(Q({key:(d&&`${d}.`)+V,value:p[V],valueSpec:b[Y]||b["*"],style:L,styleSpec:O,object:p,objectKey:V},p)):z.push(new a.a3(d,p[V],`unknown property "${V}"`))}for(const V in b){if(M[V])continue;const Y=b[V];Y.required&&Y.default===void 0&&p[V]===void 0&&z.push(new a.V(d,p,`missing required property "${V}"`))}return z}function bs({key:_,value:d}){const p=Fs({key:_,value:d});if(p.length)return p;const b=d;return b.indexOf("{fontstack}")===-1&&p.push(new a.V(_,d,'"glyphs" url must include a "{fontstack}" token')),b.indexOf("{range}")===-1&&p.push(new a.V(_,d,'"glyphs" url must include a "{range}" token')),p}function Ci(_,d=a.a6,p={}){return Ki({key:p.key||"",value:_,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:_,objectElementValidators:{glyphs:bs}})}function Mi(_,d=a.a6){return De(Ci(_,d))}const Eo=_=>De(js(_)),ir=_=>De(fi(_)),ho=_=>De(Aa(_)),Nc=_=>De(ca(_)),fo=_=>De(Yo(_)),rs=_=>De(function(d){const p=d.value,b=d.style,M=d.styleSpec,L=M.snow;if(p===void 0)return[];if(!a.H(p))return[new a.V("snow",p,`object expected, ${a.K(p)} found`)];let O=[];for(const z in p){const V=z.match(/^(.*)-transition$/);O=O.concat(V&&L[V[1]]&&L[V[1]].transition?Hs({key:z,value:p[z],valueSpec:M.transition,style:b,styleSpec:M}):L[z]?Hs({key:z,value:p[z],valueSpec:L[z],style:b,styleSpec:M}):[new a.a3(z,p[z],`unknown property "${z}"`)])}return O}(_)),po=_=>De(function(d){const p=d.value,b=d.style,M=d.styleSpec,L=M.rain;if(p===void 0)return[];if(!a.H(p))return[new a.V("rain",p,`object expected, ${a.K(p)} found`)];let O=[];for(const z in p){const V=z.match(/^(.*)-transition$/);O=O.concat(V&&L[V[1]]&&L[V[1]].transition?Hs({key:z,value:p[z],valueSpec:M.transition,style:b,styleSpec:M}):L[z]?Hs({key:z,value:p[z],valueSpec:L[z],style:b,styleSpec:M}):[new a.a3(z,p[z],`unknown property "${z}"`)])}return O}(_)),Od=_=>De(qn(_)),vr=_=>De(sr(_)),Vn=_=>De(kn(_)),bt=_=>De(pn(_)),_e=_=>De(a.a7(_));function De(_){return _.slice().sort((d,p)=>d.line&&p.line?d.line-p.line:0)}function We(_,d){let p=!1;if(d&&d.length)for(const b of d)b instanceof a.a3?a.w(b.message):(_.fire(new a.y(new Error(b.message))),p=!0);return p}const vt=a.a6.light;let gt;class Ct extends a.E{constructor(d,p="flat"){super(),this._transitionable=new a.a8(gt||(gt=new a.a9({anchor:new a.aa(vt.anchor),position:new a.ab(vt.position),color:new a.aa(vt.color),intensity:new a.aa(vt.intensity)}))),this.setLight(d,p),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,p,b={}){this._validate(ir,d,b)||(this._transitionable.setTransitionOrValue(d),this.id=p)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,p,b){return(!b||b.validate!==!1)&&We(this,d.call(Mi,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}const Bt=a.a6.terrain;let At=class extends a.E{constructor(_,d,p,b,M){super(),this.scope=p,this._transitionable=new a.a8(new a.a9({source:new a.aa(Bt.source),exaggeration:new a.aa(Bt.exaggeration)}),p,b),this._transitionable.setTransitionOrValue(_,b),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=M}get(){return this._transitionable.serialize()}set(_,d){this._transitionable.setTransitionOrValue(_,d)}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}getExaggeration(_){return this._transitioning.possiblyEvaluate(new a.ac(_,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const _=this._transitionable._values.exaggeration;if(!_)return null;const d=_.value.expression;if(!d)return null;let p=-1,b=-1,M=1;for(const L of d.zoomStops)M=d.evaluate(new a.ac(L,{worldview:this.worldview})),M>.01?(p=L,b=-1):b=L;return M<.01&&p>0&&b>p?[p,b]:null}isZoomDependent(){const _=this._transitionable._values.exaggeration;return _!=null&&_.value!=null&&_.value.expression!=null&&_.value.expression instanceof a.ad}};const Ut=45,mr=65,ar=.05;function Gr(_,d,p,b){const M=a.ah(Ut,mr,p),[L,O]=en(_,b);let z=1-Math.min(1,Math.exp((d-L)/(O-L)*-6));return z*=z*z,z=Math.min(1,1.00747*z),z*M*_.alpha}function en(_,d){const p=.5/Math.tan(.5*d);return[_.range[0]+p,_.range[1]+p]}function $r(_,d,p,b,M){const L=a.af([],[d,p,b],M.mercatorFogMatrix);return Gr(_,a.ag(L),M.pitch,M._fov)}function Qn(_,d,p,b,M,L,O){const z=[[p,b,0],[M,b,0],[M,L,0],[p,L,0]];let V=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const Q of z){const ce=a.af([],Q,d),le=a.ag(ce);V=Math.min(V,le),Y=Math.max(Y,le)}return[Gr(_,V,O.pitch,O._fov),Gr(_,Y,O.pitch,O._fov)]}const Zn=a.a6.fog;class Yn extends a.E{constructor(d,p,b,M){super();const L=new a.a9({range:new a.aa(Zn.range),color:new a.aa(Zn.color),"color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new a.aa(Zn["high-color"]),"high-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new a.aa(Zn["space-color"]),"space-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new a.aa(Zn["horizon-blend"]),"star-intensity":new a.aa(Zn["star-intensity"]),"vertical-range":new a.aa(Zn["vertical-range"])});this._transitionable=new a.a8(L,b,new Map(M)),this.set(d,M),this._transitioning=this._transitionable.untransitioned(),this._transform=p,this.properties=new a.ai(L),this.scope=b}get state(){const d=this._transform,p=d.projection.name==="globe",b=a.aj(d.zoom),M=this.properties.get("range"),L=[.5,3];return{range:p?[a.ak(L[0],M[0],b),a.ak(L[1],M[1],b)]:M,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,p,b={}){if(this._validate(fo,d,b))return;const M=Object.assign({},d);for(const L of Object.keys(Zn))M[L]===void 0&&(M[L]=Zn[L].default);this._options=M,this._transitionable.setTransitionOrValue(this._options,p)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const p=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.ah(Ut,mr,d))*p.a}getOpacityAtLatLng(d,p){return this._transform.projection.supportsFog?function(b,M,L){const O=a.ae.fromLngLat(M),z=L.elevation?L.elevation.getAtPointOrZero(O):0;return $r(b,O.x,O.y,z,L)}(this.state,d,p):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const p=this._transform.calculateFogTileMatrix(d.toUnwrapped());return Qn(this.state,p,0,0,a.al,a.al,this._transform)}getOpacityForBounds(d,p,b,M,L){return this._transform.projection.supportsFog?Qn(this.state,d,p,b,M,L,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?en(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const p=[4,5,6,7];for(const b of p){const M=d.points[b];let L;if(M[2]>=0)L=M;else{const O=d.points[b-4];L=a.am(O,M,O[2]/(O[2]-M[2]))}if($r(this.state,L[0],L[1],0,this._transform)>=ar)return!0}return!1}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,p,b){return(!b||b.validate!==!1)&&We(this,d.call(Mi,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}let Os,ja,Va,Ea,oo=class extends a.E{constructor(_,d,p,b){super();const M=Os||(Os=new a.a9({density:new a.aa(a.a6.snow.density),intensity:new a.aa(a.a6.snow.intensity),color:new a.aa(a.a6.snow.color),opacity:new a.aa(a.a6.snow.opacity),vignette:new a.aa(a.a6.snow.vignette),"vignette-color":new a.aa(a.a6.snow["vignette-color"]),"center-thinning":new a.aa(a.a6.snow["center-thinning"]),direction:new a.aa(a.a6.snow.direction),"flake-size":new a.aa(a.a6.snow["flake-size"])}));this._transitionable=new a.a8(M,p,new Map(b)),this.set(_,b),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=p}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),p=this.properties.get("direction"),b=a.an(p[0]),M=-Math.max(a.an(p[1]),.01),L=[Math.cos(b)*Math.cos(M),Math.sin(b)*Math.cos(M),Math.sin(M)],O=this.properties.get("vignette"),z=this.properties.get("vignette-color");return z.a=O,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:L,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:z}}get(){return this._transitionable.serialize()}set(_,d,p={}){if(this._validate(rs,_,p))return;const b=Object.assign({},_),M=a.a6.snow;for(const L of Object.keys(M))b[L]===void 0&&(b[L]=M[L].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,p){return(!p||p.validate!==!1)&&We(this,_.call(Mi,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}},va=class extends a.E{constructor(_,d,p,b){super();const M=ja||(ja=new a.a9({density:new a.aa(a.a6.rain.density),intensity:new a.aa(a.a6.rain.intensity),color:new a.aa(a.a6.rain.color),opacity:new a.aa(a.a6.rain.opacity),vignette:new a.aa(a.a6.rain.vignette),"vignette-color":new a.aa(a.a6.rain["vignette-color"]),"center-thinning":new a.aa(a.a6.rain["center-thinning"]),direction:new a.aa(a.a6.rain.direction),"droplet-size":new a.aa(a.a6.rain["droplet-size"]),"distortion-strength":new a.aa(a.a6.rain["distortion-strength"])}));this._transitionable=new a.a8(M,p,new Map(b)),this.set(_,b),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=p}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),p=this.properties.get("direction"),b=a.an(p[0]),M=-Math.max(a.an(p[1]),.01),L=[Math.cos(b)*Math.cos(M),Math.sin(b)*Math.cos(M),Math.sin(M)],O=this.properties.get("vignette-color");return O.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:L,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:O}}get(){return this._transitionable.serialize()}set(_,d,p={}){if(this._validate(po,_,p))return;const b=Object.assign({},_),M=a.a6.rain;for(const L of Object.keys(M))b[L]===void 0&&(b[L]=M[L].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,p){return(!p||p.validate!==!1)&&We(this,_.call(Mi,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}};class Ws extends a.E{constructor(d,p,b,M){super(),this.scope=b,this._options=d,this.properties=new a.ai(p),this._transitionable=new a.a8(p,b,new Map(M)),this._transitionable.setTransitionOrValue(d.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(d){this._transitionable.setTransitionOrValue(this._options.properties,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(d,p){this._options=d,this._transitionable.setTransitionOrValue(d.properties,p)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ha{constructor(d,p,b){this.screenBounds=d,this.cameraPoint=b.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=p,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,b)}static createFromScreenPoints(d,p){let b,M;if(d instanceof a.P||typeof d[0]=="number"){const L=a.P.convert(d);b=[L],M=p.isPointAboveHorizon(L)}else{const L=a.P.convert(d[0]),O=a.P.convert(d[1]),z=L.add(O)._div(2);b=[L,O],M=a.aq(L,O).every(V=>p.isPointAboveHorizon(V))&&p.isPointAboveHorizon(z)}return new ha(b,M,p)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return a.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const p=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(p,b,0,!1);return this.cameraPoint.y>b.y&&(this.cameraPoint.x>p.x&&this.cameraPoint.x=b.x?M[2]=this.cameraPoint:this.cameraPoint.x<=p.x&&(M[3]=this.cameraPoint)),a.ar(M,d)}bufferedCameraGeometryGlobe(d){const p=this.screenBounds[0],b=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(p,b,d),L=this.cameraPoint.clone();switch(3*((L.y>p.y)+(L.y>b.y))+((L.x>p.x)+(L.x>b.x))){case 0:M[0]=L,M[4]=L.clone();break;case 1:M.splice(1,0,L);break;case 2:M[1]=L;break;case 3:M.splice(4,0,L);break;case 5:M.splice(2,0,L);break;case 6:M[3]=L;break;case 7:M.splice(3,0,L);break;case 8:M[2]=L}return M}containsTile(d,p,b,M=0){const L=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/p._pixelsPerMercatorPixel+1,O=b?this._bufferedCameraMercator(L,p):this._bufferedScreenMercator(L,p);let z=d.tileID.wrap+(O.unwrapped?M:0);const V=O.polygon.map(Pe=>a.as(d.tileTransform,Pe,z));if(!a.at(V,0,0,a.al,a.al))return;z=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?M:0);const Y=this.screenGeometryMercator.polygon.map(Pe=>a.au(d.tileTransform,Pe,z)),Q=Y.map(Pe=>new a.P(Pe[0],Pe[1])),ce=p.getFreeCameraOptions().position||new a.ae(0,0,0),le=a.au(d.tileTransform,ce,z),de=Y.map(Pe=>{const Ee=a.av(Pe,Pe,le);return a.aw(Ee,Ee),new a.ax(le,Ee)}),be=a.ay(d,1,p.zoom)*p._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:Q,tilespaceRays:de,bufferedTilespaceGeometry:V,bufferedTilespaceBounds:(xe=a.az(V),xe.min.x=a.aA(xe.min.x,0,a.al),xe.min.y=a.aA(xe.min.y,0,a.al),xe.max.x=a.aA(xe.max.x,0,a.al),xe.max.y=a.aA(xe.max.y,0,a.al),xe),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:be};var xe}_bufferedScreenMercator(d,p){const b=Ra(d);if(this._screenRaycastCache[b])return this._screenRaycastCache[b];{let M;return M=p.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),p):{polygon:this.bufferedScreenGeometry(d).map(L=>p.pointCoordinate3D(L)),unwrapped:!0},this._screenRaycastCache[b]=M,M}}_bufferedCameraMercator(d,p){const b=Ra(d);if(this._cameraRaycastCache[b])return this._cameraRaycastCache[b];{let M;return M=p.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),p):{polygon:this.bufferedCameraGeometry(d).map(L=>p.pointCoordinate3D(L)),unwrapped:!0},this._cameraRaycastCache[b]=M,M}}_projectAndResample(d,p){const b=function(L,O){const z=a.aB([],O.pixelMatrix,O.globeMatrix),V=[0,-a.aD,0,1],Y=[0,a.aD,0,1],Q=[0,0,0,1];a.aC(V,V,z),a.aC(Y,Y,z),a.aC(Q,Q,z);const ce=new a.P(V[0]/V[3],V[1]/V[3]),le=new a.P(Y[0]/Y[3],Y[1]/Y[3]),de=a.aE(L,ce)&&V[3]1?Fi(L.slice(0,Pe),O):[],Ke=Penew a.P(ks(ht.x),ht.y)),Ke=Ke.map(ht=>new a.P(ks(ht.x),ht.y));const Ue=[...$e];Ue.length===0&&Ue.push(Ke[Ke.length-1]);const mt=a.ak(Ue[Ue.length-1].y,(Ke.length===0?$e[0]:Ke[0]).y,Ee);let ct;return ct=de?[new a.P(0,mt),new a.P(0,0),new a.P(1,0),new a.P(1,mt)]:[new a.P(1,mt),new a.P(1,1),new a.P(0,1),new a.P(0,mt)],Ue.push(...ct),Ke.length===0?Ue.push($e[0]):Ue.push(...Ke),{polygon:Ue.map(ht=>new a.ae(ht.x,ht.y)),unwrapped:!1}}(d,p);if(b)return b;const M=function(L,O){let z=!1,V=-1/0,Y=0;for(let ce=0;ceV&&(V=L[ce].x,Y=ce);for(let ce=0;ce.5&&(de.x{ce.x-=1}),{polygon:L,unwrapped:z}}(Fi(d,p).map(L=>new a.P(ks(L.x),L.y)),p);return{polygon:M.polygon.map(L=>new a.ae(L.x,L.y)),unwrapped:M.unwrapped}}}function Fi(_,d){return a.aG(_,p=>{const b=d.pointCoordinate3D(p);p.x=b.x,p.y=b.y},1/256)}function ks(_){return _<0?1+_%1:_%1}function Ra(_){return 100*_|0}function bl(_,d,p,b,M){const L=function(z,V){if(z)return M(z);if(V){if(_.url&&V.tiles&&_.tiles&&delete _.tiles,V.variants){if(!Array.isArray(V.variants))return M(new Error("variants must be an array"));for(const Q of V.variants){if(Q==null||typeof Q!="object"||Q.constructor!==Object)return M(new Error("variant must be an object"));if(!Array.isArray(Q.capabilities))return M(new Error("capabilities must be an array"));if(Q.capabilities.length===1&&Q.capabilities[0]==="meshopt"){V=Object.assign(V,Q);break}}}const Y=a.aH(Object.assign({},V,_),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);Y.tiles=d.canonicalizeTileset(Y,_.url),M(null,Y)}},O=function(z,V,Y){if(!z)return null;if(!V&&!Y)return z;Y=Y||z.worldview_default;const Q=Object.values(z.language||{});if(Q.length===0)return null;const ce=Object.values(z.worldview||{});if(ce.length===0)return null;const le=Q.every(be=>be===V),de=ce.every(be=>be===Y);return le&&de?z:V in(z.language_options||{})||Y in(z.worldview_options||{})?null:z.language_options&&z.worldview_options?z:null}(_.data,p,b);return O?a.o.frame(()=>L(null,O)):_.url?a.m(d.transformRequest(d.normalizeSourceURL(_.url,null,p,b),a.R.Source),L):a.o.frame(()=>{const{data:z,...V}=_;L(null,V)})}function Pl(_,d){const p=Math.pow(2,d.z),b=Math.floor(a.aF(_.getWest())*p),M=Math.floor(a.aJ(_.getNorth())*p),L=Math.ceil(a.aF(_.getEast())*p),O=Math.ceil(a.aJ(_.getSouth())*p);return d.x>=b&&d.x=M&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,M)p&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${p}`),b&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${b}`),this.fire(new a.y(M));else if(L){if(Object.assign(this,L),this.hasWorldviews=!!L.worldview_options,L.worldview_default&&(this.worldviewDefault=L.worldview_default),L.vector_layers){this.vectorLayers=L.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const O of L.vector_layers)this.vectorLayerIds.push(O.id),L.worldview&&L.worldview[O.source]&&this.localizableLayerIds.add(O.id)}this.tileBounds=Sc.fromTileJSON(L),ae(L.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}d&&d(M)})}loaded(){return this._loaded}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(d,p){const b=d.tileID.canonical.url(this.tiles,this.scheme),M=this.map._requestManager.normalizeTileURL(b),L=this.map._requestManager.transformRequest(M,a.R.Tile),O=this.map.style?this.map.style.getLut(this.scope):null,z=O?{image:O.image.clone()}:null,V={request:L,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:z,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&a.h(b)&&(V.localizableLayerIds=this.localizableLayerIds),V.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=p:d.request=d.actor.send("reloadTile",V,Y.bind(this));else if(d.actor=this._tileWorkers[M]=this._tileWorkers[M]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",V,Y.bind(this),void 0,!0);else{const Q=a.aL.call({deduped:this._deduped},V,(ce,le)=>{if(ce||!le)Y.call(this,ce);else{const de=a.aM(le.responseHeaders);V.data={rawData:le.rawData.slice(0),expires:de.expires,cacheControl:de.cacheControl},d.actor&&d.actor.send("loadTile",V,Y.bind(this),void 0,!0)}},!0);d.request={cancel:Q}}function Y(Q,ce){return delete d.request,d.aborted?p(null):Q&&Q instanceof a.aN&&Q.status!==404?p(Q):(ce&&ce.resourceTiming&&(d.resourceTiming=ce.resourceTiming),this.map._refreshExpiredTiles&&ce&&d.setExpiryData(ce),d.loadVectorData(ce,this.map.painter),a.aO(this.dispatcher),p(null,ce),void(d.reloadCallback&&(this.loadTile(d,d.reloadCallback),d.reloadCallback=null)))}}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,p){d.actor&&d.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Qo extends a.E{constructor(d,p,b,M){super(),this.id=d,this.dispatcher=b,this.setEventedParent(M),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},p),Object.assign(this,a.aH(p,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const p=this.map.getWorldview();this._tileJSONRequest=bl(this._options,this.map._requestManager,null,p,(b,M)=>{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.y(b)):M&&(Object.assign(this,M),M.raster_layers&&(this.rasterLayers=M.raster_layers,this.rasterLayerIds=this.rasterLayers.map(L=>L.id)),this.tileBounds=Sc.fromTileJSON(M),ae(M.tiles),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(b)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,p){const b=a.o.devicePixelRatio>=2,M=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),b,this.tileSize);d.request=a.n(this.map._requestManager.transformRequest(M,a.R.Tile),(L,O,z)=>{if(delete d.request,d.aborted)return d.state="unloaded",p(null);if(L)return d.state="errored",p(L);if(!O)return p(null);const V=a.aM(z);this.map._refreshExpiredTiles&&d.setExpiryData(V),d.setTexture(O,this.map.painter),d.state="loaded",a.aO(this.dispatcher),p(null)})}abortTile(d,p){d.request&&(d.request.cancel(),delete d.request),p&&p()}unloadTile(d,p){d.texture&&d.texture instanceof a.T?(d.destroy(!1),d.texture&&d.texture instanceof a.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),p&&p()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function pd([_,d],p,b,{scaled:M=!0}={}){const{tileSize:L,buffer:O}=b,{x:z,y:V,z:Y}=p;if(!isFinite(z)||!isFinite(V)||!isFinite(Y))throw new Error("Invalid MRT header");const Q=2**Y,ce=Q*a.aF(_),le=Q*a.aJ(d);return function([de,be],xe,{scaled:Pe=!0}={}){if(!xe)throw new Error("bandView is undefined");const{data:Ee,tileSize:$e,buffer:Ke,offset:Ue,scale:mt,dimension:ct}=xe;if(de<-Ke||de>$e+Ke||be<-Ke||be>$e+Ke)throw new Error(`Point (${de}, ${be}) out of bounds for tileSize=${$e}, buffer=${Ke}`);const ht=(be+Ke)*($e+2*Ke)+(de+Ke);if(new Uint32Array(Ee.buffer)[ht]===4294967295)return null;let ot=[];ot=Pe?[]:new xe.data.constructor(ct);for(let st=0;st{if(delete d.request,d.aborted)return d.state="unloaded",p(null);if(z)return z.name==="AbortError"?void 0:(d.state="errored",p(z));if(this.map._refreshExpiredTiles&&V){const Q=a.aM(Y);d.setExpiryData(Q)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!V)return p(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=V}p(null)};d.request=this.partial?d.fetchHeader(void 0,O.bind(this)):d.actor.send("loadTile",L,O.bind(this),void 0,!0)}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,p){const b=d.texturePerLayer;if(d.flushAllQueues(),b.size){d.destroy(!1);for(const M of b.values())this.map.painter.saveTileTexture(M)}else d.destroy()}prepareTile(d,p,b,M){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(p,b,M,(L,O)=>{if(L)return d.state="errored",this.fire(new a.y(L)),void this.triggerRepaint(d);O&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(b,O,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const p=this.rasterLayers.find(({id:L})=>L===d),b=p&&p.fields,M=b&&b.bands&&b.bands;return M?M[0]:0}getTextureDescriptor(d,p,b){if(!d)return;const M=p.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!M)return;let L=null;p instanceof a.aR?L=p.paint.get("raster-array-band"):p instanceof a.aS&&(L=p.paint.get("raster-particle-array-band"));const O=L||this.getInitialBand(M);if(O==null)return;if(!d.textureDescriptorPerLayer.get(p.id))return void this.prepareTile(d,M,p.id,O);if(d.updateNeeded(p.id,O)&&!b)return;const z=d.textureDescriptorPerLayer.get(p.id);return Object.assign({},z,{texture:d.texturePerLayer.get(p.id)})}getImages(d,p){const b=new Map;for(const M of d)for(const L of p){const[O,z]=L.split("/"),V=M.getLayer(O);if(!V||!V.hasBand(z)||!V.hasDataForBand(z))continue;const{bytes:Y,tileSize:Q,buffer:ce}=V.getBandView(z),le=Q+2*ce,de={data:new a.q({width:le,height:le},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};b.set(L,de)}return b}queryRasterArrayValueByBandId(d,p,b){const M=p._mrt;return new Promise(L=>{const O={},z=new Set;for(const[V,Y]of Object.entries(M.layers)){if(b.layerName&&V!==b.layerName)continue;const Q={};O[V]=Q;for(const{bands:ce}of Y.dataIndex)for(const le of ce)b.bands&&!b.bands.includes(le)||(z.add(a.B(V,le)),p.fetchBand(V,null,le,de=>{a.o.frame(()=>{Q[le]=de?null:pd([d.lng,d.lat],M,Y.getBandView(le)),z.delete(a.B(V,le)),z.size===0&&L(O)})},!1))}z.size===0&&L(O)})}_loadTileForQuery(d,p){if(this._loadTileLoaded[d.uid])return void p(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(p);this._loadTilePending[d.uid]=[p];const b=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),M=this.map._requestManager.transformRequest(b,a.R.Tile);d.actor.send("loadTile",{request:M,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(L,O,z)=>{if(L)return this._loadTilePending[d.uid].forEach(V=>V(L,null)),void delete this._loadTilePending[d.uid];if(!O)return this._loadTilePending[d.uid].forEach(V=>V(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&O){const V=a.aM(z);d.setExpiryData(V)}d._mrt=O,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(V=>V(null,O)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,p,b){return new Promise((M,L)=>{this._loadTileForQuery(p,(O,z)=>{O?L(O):M(z?this.queryRasterArrayValueByBandId(d,p,b):null)})})}queryRasterArrayValue(d,p){const b=a.aT.convert(d),M=this.findLoadedParent(b);return M&&M._mrt?p.bands||!this.partial?this.queryRasterArrayValueByBandId(b,M,p):this.queryRasterArrayValueByAllBands(b,M,p):Promise.resolve(null)}findLoadedParent(d){const p=a.ae.fromLngLat(d,this.map.transform.tileSize),b=this.maxzoom+1,M=1<0&&(z[new a.aQ(_.overscaledZ,M,d.z,b,d.y-1).key]={backfilled:!1},z[new a.aQ(_.overscaledZ,_.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},z[new a.aQ(_.overscaledZ,O,d.z,L,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,b)this.fire(new a.y(b));else{const L={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&M&&M.resourceTiming&&M.resourceTiming[this.id]&&(L.resourceTiming=M.resourceTiming[this.id]),_&&(this._partialReload=!0),this.fire(new a.z("data",L)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(_),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_),this._updateWorkerData()}loadTile(_,d){const p=_.actor?"reloadTile":"loadTile";_.actor=this.actor;const b=this.map.style?this.map.style.getLut(this.scope):null,M=b?{image:b.image.clone()}:null,L=this._partialReload,O={type:this.type,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:M,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:_.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:L,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};_.request=this.actor.send(p,O,(z,V)=>L&&!V?(_.state="loaded",d(null)):(delete _.request,_.destroy(!1),_.aborted?d(null):z?d(z):(_.loadVectorData(V,this.map.painter,p==="reloadTile"),d(null))),void 0,p==="loadTile")}abortTile(_){_.request&&(_.request.cancel(),delete _.request),_.aborted=!0}unloadTile(_,d){this.actor.send("removeTile",{uid:_.uid,type:this.type,source:this.id,scope:this.scope}),_.destroy()}onRemove(_){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.aU{constructor(_,d,p,b){super(_,d,p,b),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const _=this.options;this.urls=[];for(const d of _.urls)this.urls.push(this.map._requestManager.transformRequest(d,a.R.Source).url);a.aV(this.urls,(d,p)=>{this._loaded=!0,d?this.fire(new a.y(d)):p&&(this.video=p,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(_){if(this.video){const d=this.video.seekable;_d.end(0)?this.fire(new a.y(new a.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=_}}getVideo(){return this.video}onAdd(_){this.map||(this.map=_,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const _=this.map.painter.context,d=_.gl;this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(_,this.video,d.RGBA8),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(_)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.aU,model:a.aX,"batched-model":class extends a.E{constructor(_,d,p,b){super(),this.type="batched-model",this.id=_,this.tileSize=512,this._options=d,this.tiles=this._options.tiles,this.maxzoom=d.maxzoom||19,this.minzoom=d.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=p,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(b)}onAdd(_){this.map=_,this.load()}reload(){this.cancelTileJSONRequest();const _=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(_))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(_){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const d=Array.isArray(this.map._language)?this.map._language.join():this.map._language,p=this.map.getWorldview();this._tileJSONRequest=bl(this._options,this.map._requestManager,d,p,(b,M)=>{this._tileJSONRequest=null,this._loaded=!0,b?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),p&&p.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${p}`),this.fire(new a.y(b))):M&&(Object.assign(this,M),M.bounds&&(this.tileBounds=new Sc(M.bounds,this.minzoom,this.maxzoom)),ae(M.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),_&&_(b)})}hasTransition(){return!1}hasTile(_){return!this.tileBounds||this.tileBounds.contains(_.canonical)}loaded(){return this._loaded}loadTile(_,d){const p=this.map._requestManager.normalizeTileURL(_.tileID.canonical.url(this.tiles,this.scheme)),b={request:this.map._requestManager.transformRequest(p,a.R.Tile),data:void 0,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,tileSize:this.tileSize*_.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:_.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:a.o.devicePixelRatio,promoteId:this.promoteId};if(_.actor&&_.state!=="expired")if(_.state==="loading")_.reloadCallback=d;else{if(_.buckets){const L=Object.values(_.buckets);for(const O of L)O.dirty=!0;return void(_.state="loaded")}_.request=_.actor.send("reloadTile",b,M.bind(this))}else _.actor=this.dispatcher.getActor(),_.request=_.actor.send("loadTile",b,M.bind(this),void 0,!0);function M(L,O){return _.aborted?d(null):L&&L.status!==404?d(L):(this.map._refreshExpiredTiles&&O&&_.setExpiryData(O),_.loadModelData(O,this.map.painter),_.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends a.aU{constructor(_,d,p,b){super(_,d,p,b),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(L=>typeof L!="number"))||this.fire(new a.y(new a.V(`sources.${_}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new a.y(new a.V(`sources.${_}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new a.y(new a.V(`sources.${_}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(_){this.map=_,this.load(),this.canvas&&this.animate&&this.play()}onRemove(_){this.pause()}prepare(){let _=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,_=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,_=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!_&&!this._playing||this.texture instanceof a.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(d,this.canvas,d.gl.RGBA8,{premultiply:!0}),this._prepareData(d)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const _ of[this.canvas.width,this.canvas.height])if(isNaN(_)||_<=0)return!0;return!1}},custom:class extends a.E{constructor(_,d,p,b){super(),this.id=_,this.type="custom",this._dataType="raster",this._dispatcher=p,this._implementation=d,this.setEventedParent(b),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Sc(this._implementation.bounds,this.minzoom,this.maxzoom)),d.update=this._update.bind(this),d.clearTiles=this._clearTiles.bind(this),d.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,a.aH(d,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(_){this.map=_,this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(_),this.load()}onRemove(_){this._implementation.onRemove&&this._implementation.onRemove(_)}hasTile(_){if(this._implementation.hasTile){const{x:d,y:p,z:b}=_.canonical;return this._implementation.hasTile({x:d,y:p,z:b})}return!this.tileBounds||this.tileBounds.contains(_.canonical)}loadTile(_,d){const{x:p,y:b,z:M}=_.tileID.canonical,L=new AbortController;_.request=Promise.resolve(this._implementation.loadTile({x:p,y:b,z:M},{signal:L.signal})).then((function(O){return delete _.request,_.aborted?(_.state="unloaded",d(null)):O===void 0?(_.state="errored",d(null)):O===null?(this.loadTileData(_,{width:this.tileSize,height:this.tileSize,data:null}),_.state="loaded",d(null)):function(z){return z instanceof ImageData||z instanceof HTMLCanvasElement||z instanceof ImageBitmap||z instanceof HTMLImageElement}(O)?(this.loadTileData(_,O),_.state="loaded",void d(null)):(_.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(O=>{O.name!=="AbortError"&&(_.state="errored",d(O))}),_.request.cancel=()=>L.abort()}loadTileData(_,d){_.setTexture(d,this.map.painter)}unloadTile(_,d){if(_.texture&&_.texture instanceof a.T?(_.destroy(!1),_.texture&&_.texture instanceof a.T&&this.map.painter.saveTileTexture(_.texture)):_.destroy(),this._implementation.unloadTile){const{x:p,y:b,z:M}=_.tileID.canonical;this._implementation.unloadTile({x:p,y:b,z:M})}d&&d()}abortTile(_,d){_.request&&_.request.cancel&&(_.request.cancel(),delete _.request),d&&d()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(_=>({x:_.canonical.x,y:_.canonical.y,z:_.canonical.z}))}_clearTiles(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_)}_update(){this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}}},Do=function(_,d,p,b){const M=new ru[d.type](_,d,p,b);if(M.id!==_)throw new Error(`Expected Source id to be ${_} instead of ${M.id}`);return a.aY(["load","abort","unload","serialize","prepare"],M),M};function sf(_,d,p=""){return`${p}:${d.id||""}:${d.layer.id}:${function(b){if("layerId"in b)return`layer:${b.layerId}`;{const{featuresetId:M,importId:L}=b;return`featureset:${M}${L?`:import:${L}`:""}`}}(_.target)}`}function Fu(_,d,p,b=""){if(_.uniqueFeatureID){const M=sf(_,d,b);if(p.has(M))return!0;p.add(M)}return!1}function Yl(_,d,p,b,M=!1){const L=d.sourceCache.transform,O=d.sourceCache.tilesIn(_,d.has3DLayers,M);O.sort(Uc);const z=[];for(const V of O){const Y=V.tile.queryRenderedFeatures(d,V,p,b,L,M);Object.keys(Y).length&&z.push({wrappedTileID:V.tile.tileID.wrapped().key,queryResults:Y})}for(const V in d.layers){const Y=d.layers[V];if(Y.styleLayer){const Q=Y.styleLayer.queryRenderedFeatures(_,d.sourceCache,b);Object.keys(Q).length&&z.push({wrappedTileID:0,queryResults:Q})}}return z.length===0?{}:function(V){const Y={},Q={};for(const ce of V){const le=ce.queryResults,de=ce.wrappedTileID,be=Q[de]=Q[de]||{};for(const xe in le){const Pe=le[xe],Ee=be[xe]=be[xe]||{},$e=Y[xe]=Y[xe]||[];for(const Ke of Pe)Ee[Ke.featureIndex]||(Ee[Ke.featureIndex]=!0,$e.push(Ke))}}return Y}(z)}function sp(_,d,p,b,M,L){const O={},z=b.queryRenderedSymbols(_),V=[];for(const Y of Object.keys(z).map(Number))V.push(M[Y]);V.sort(Uc);for(const Y of V){const Q=Y.featureIndex.lookupSymbolFeatures(z[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,p,L);for(const ce in Q){const le=O[ce]=O[ce]||[],de=Q[ce];de.sort((be,xe)=>{const Pe=Y.featureSortOrder;if(Pe){const Ee=Pe.indexOf(be.featureIndex);return Pe.indexOf(xe.featureIndex)-Ee}return xe.featureIndex-be.featureIndex});for(const be of de)le.push(be)}}return O}function wm(_,d){const p=_.getRenderableIds().map(L=>_.getTileByID(L)),b=[],M={};for(let L=0;Ld.getLayer(L)).filter(Boolean);if(M.length!==0){b.layers=M,b.stateDependentLayerIds&&(b.stateDependentLayers=b.stateDependentLayerIds.map(L=>M.filter(O=>O.id===L)[0]));for(const L of M)p[L.fqid]=b}}return p}const Cc=32,qc=33,md=new Uint16Array(8184);for(let _=0;_<2046;_++){let d=_+2,p=0,b=0,M=0,L=0,O=0,z=0;for(1&d?M=L=O=Cc:p=b=z=Cc;(d>>=1)>1;){const Y=p+M>>1,Q=b+L>>1;1&d?(M=p,L=b,p=O,b=z):(p=M,b=L,M=O,L=z),O=Y,z=Q}const V=4*_;md[V+0]=p,md[V+1]=b,md[V+2]=M,md[V+3]=L}const Dd=new Uint16Array(2178),nu=new Uint8Array(1089),Bu=new Uint16Array(1089);function ip(_){return _===0?-.03125:_===32?.03125:0}const dy={type:2,extent:a.al,loadGeometry:()=>[[new a.P(0,0),new a.P(a.al+1,0),new a.P(a.al+1,a.al+1),new a.P(0,a.al+1),new a.P(0,0)]]};class ap{constructor(d,p,b,M,L,O){this.tileID=d,this.uid=a.b2(),this.uses=0,this.tileSize=p,this.tileZoom=b,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=L,M&&M.style&&(this._lastUpdatedBrightness=M.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",M&&M.transform&&(this.projection=M.transform.projection),this.worldview=O,this._hasAppearances=null}registerFadeDuration(d){const p=d+this.timeAdded;pb)M=!1;else if(p)if(this.expirationTimeb.appearances&&b.appearances.length>0))return!0;return!1}updateBuckets(d,p){if(!this.latestFeatureIndex||!d.style)return;const b=d.style.listImages(),M=d.style.getBrightness();for(const L in this.buckets){if(!d.style.hasLayer(L))continue;const O=this.buckets[L],z=O.layers[0],V=z.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(z);let Q={};Y&&(Q=Y._state.getState(V,void 0));const ce=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},le=Object.keys(Q).length>0&&!p;O.hasAppearances=O.layers.some(xe=>xe.appearances&&xe.appearances.length>0);const de=le?O.stateDependentLayers:O.layers;if(le&&O.stateDependentLayers.length!==0||p){const xe=this.latestFeatureIndex.loadVTLayers();O.update(Q,xe[V],b,ce,de,p,M)}if(le&&O.stateDependentLayers.length!==0||p||O.hasAppearances){const xe={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};O.updateAppearances(this.tileID.canonical,Q,b,xe)}(O instanceof a.ba||O instanceof a.bb)&&d._terrain&&d._terrain.enabled&&Y&&O.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const be=d&&d.style&&d.style.getOwnLayer(L);be&&(this.queryPadding=Math.max(this.queryPadding,be.queryRadius(O)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Pe--){const Ee=4*Pe,$e=md[Ee+0],Ke=md[Ee+1],Ue=md[Ee+2],mt=md[Ee+3],ct=$e+Ue>>1,ht=Ke+mt>>1,ot=ct+ht-Ke,st=ht+$e-ct,_t=Ke*qc+$e,It=mt*qc+Ue,Tt=ht*qc+ct,Vt=Math.hypot((Dd[2*_t+0]+Dd[2*It+0])/2-Dd[2*Tt+0],(Dd[2*_t+1]+Dd[2*It+1])/2-Dd[2*Tt+1])>=16;nu[Tt]=nu[Tt]||(Vt?1:0),Pe<1022&&(nu[Tt]=nu[Tt]||nu[(Ke+st>>1)*qc+($e+ot>>1)]||nu[(mt+st>>1)*qc+(Ue+ot>>1)])}const ce=new a.b1,le=new a.b0;let de=0;function be(Pe,Ee){const $e=Ee*qc+Pe;return Bu[$e]===0&&(ce.emplaceBack(Dd[2*$e+0],Dd[2*$e+1],Pe*a.al/Cc,Ee*a.al/Cc),Bu[$e]=++de),Bu[$e]-1}function xe(Pe,Ee,$e,Ke,Ue,mt){const ct=Pe+$e>>1,ht=Ee+Ke>>1;if(Math.abs(Pe-Ue)+Math.abs(Ee-mt)>1&&nu[ht*qc+ct])xe(Ue,mt,Pe,Ee,ct,ht),xe($e,Ke,Ue,mt,ct,ht);else{const ot=be(Pe,Ee),st=be($e,Ke),_t=be(Ue,mt);le.emplaceBack(ot,st,_t)}}return xe(0,0,Cc,Cc,Cc,0),xe(Cc,Cc,0,0,0,Cc),{vertices:ce,indices:le}}(this.tileID.canonical,p);M=O.vertices,L=O.indices}else{M=new a.b1,L=new a.b0;for(const{x:z,y:V}of b)M.emplaceBack(z,V,0,0);const O=a.bh(M.int16.subarray(0,4*M.length),void 0,4);for(let z=0;z0&&(V=a.bl(new Float64Array(16),p.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,M,p,O,V,z),this._makeGlobeTileDebugTextBuffer(d,M,p,O,V,z)}_globePoint(d,p,b,M,L,O,z){let V=a.bm(d,p,b);if(O){const Y=1<.5?de=-1:le<-.5&&(de=1);let be=(d/a.al+b.x)/Y+de,xe=(p/a.al+b.y)/Y;be=(be-Q)*M._pixelsPerMercatorPixel+Q,xe=(xe-ce)*M._pixelsPerMercatorPixel+ce;const Pe=[be*M.worldSize,xe*M.worldSize,0];a.af(Pe,Pe,O),V=a.bn(V,Pe,z)}return a.af(V,V,L)}_makeGlobeTileDebugBorderBuffer(d,p,b,M,L,O){const z=new a.bd,V=new a.be,Y=new a.bo,Q=(le,de,be,xe,Pe)=>{const Ee=(be-le)/(Pe-1),$e=(xe-de)/(Pe-1),Ke=z.length;for(let Ue=0;Uece*de+be;for(let de=0;de{if(L)p(L);else try{const V=b.getHeaderLength(O);if(V>d)return void(this.request=this.fetchHeader(V,p));b.parseHeader(O),this._isHeaderLoaded=!0;let Y=0;for(const Q of Object.values(b.layers))Y=Math.max(Y,Q.dataIndex[Q.dataIndex.length-1].lastByte);O.byteLength>=Y&&(this.entireBuffer=O),p(null,this.entireBuffer||O,z)}catch(V){p(V)}}),this.request}fetchBandForRender(d,p,b,M){this.fetchBand(d,p,b,L=>{if(L)return void M(L);this.updateTextureDescriptor(d,p,b);const O=this.textureDescriptorPerLayer.get(p);M(null,O?O.img:null)})}fetchBand(d,p,b,M,L=!0){const O=this._mrt;if(!this._isHeaderLoaded||!O)return void M(new Error("Tile header is not ready"));const z=this.actor;if(!z)return void M(new Error("Can't fetch tile band without an actor"));let V;const Y=a.B(String(b),a.B(this.tileID.key,d));let Q=this._taskQueue.get(Y);Q?Q.add(M):(Q=new Set,Q.add(M),this._taskQueue.set(Y,Q));const ce=(xe,Pe)=>{V.complete(xe,Pe),xe?M(xe):(Q.forEach(Ee=>Ee(null,Pe)),this._taskQueue.delete(Y))},le=(xe,Pe)=>{if(xe)return M(xe);const Ee=z.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Pe,task:V},ce,void 0,!0);if(p!==null){const $e=this._workQueuePerLayer.get(p)||[];$e.push(()=>{Ee&&Ee.cancel(),V.cancel()}),this._workQueuePerLayer.has(p)||this._workQueuePerLayer.set(p,$e)}};let de;try{de=O.getLayer(d)}catch(xe){if(this.state==="reloading")return;throw xe}if(!de)return void M(new Error(`Unknown sourceLayer "${d}"`));if(de.hasDataForBand(b))return Q.forEach(xe=>xe(null,null)),void this._taskQueue.delete(Y);const be=de.getDataRange([b]);if(V=O.createDecodingTask(be),!V||V.tasks.length)if(p!==null&&this.flushQueues(p),this.entireBuffer)le(null,this.entireBuffer.slice(be.firstByte,be.lastByte+1));else{const xe=Object.assign({},this.requestParams,{headers:{Range:`bytes=${be.firstByte}-${be.lastByte}`}}),Pe=a.bu(xe,le);if(p!==null){const Ee=this._fetchQueuePerLayer.get(p)||[];Ee.push(()=>{Pe.cancel(),V.cancel()}),this._fetchQueuePerLayer.has(p)||this._fetchQueuePerLayer.set(p,Ee)}}}updateNeeded(d,p){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==p||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,p,b){if(!this._mrt)return;const M=this._mrt.getLayer(d);if(!M||!M.hasBand(b)||!M.hasDataForBand(b))return;const{bytes:L,tileSize:O,buffer:z,offset:V,scale:Y}=M.getBandView(b),Q=O+2*z,ce=new a.q({width:Q,height:Q},L),le=this.texturePerLayer.get(p);le&&le instanceof a.T&&le.update(ce,{premultiply:!1}),this.textureDescriptorPerLayer.set(p,{layer:d,band:b,img:ce,buffer:z,offset:V,tileSize:O,format:M.pixelFormat,mix:[Y,256*Y,65536*Y,16777216*Y]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const p of this.texturePerLayer.values())p&&p instanceof a.T&&p.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 sk{constructor(d,p){this.max=d,this.onRemove=p,this.reset()}reset(){for(const d in this.data)for(const p of this.data[d])p.timeout&&clearTimeout(p.timeout),this.onRemove(p.value);return this.data={},this.order=[],this}add(d,p,b){const M=d.wrapped().key;this.data[M]===void 0&&(this.data[M]=[]);const L={value:p,timeout:void 0};if(b!==void 0&&(L.timeout=setTimeout(()=>{this.remove(d,L)},b)),this.data[M].push(L),this.order.push(M),this.order.length>this.max){const O=this._getAndRemoveByKey(this.order[0]);O&&this.onRemove(O)}return this}has(d){return d.wrapped().key in this.data}getAndRemove(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null}_getAndRemoveByKey(d){const p=this.data[d].shift();return p.timeout&&clearTimeout(p.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),p.value}getByKey(d){const p=this.data[d];return p?p[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,p){if(!this.has(d))return this;const b=d.wrapped().key,M=p===void 0?0:this.data[b].indexOf(p),L=this.data[b][M];return this.data[b].splice(M,1),L.timeout&&clearTimeout(L.timeout),this.data[b].length===0&&delete this.data[b],this.onRemove(L.value),this.order.splice(this.order.indexOf(b),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const p=this._getAndRemoveByKey(this.order[0]);p&&this.onRemove(p)}return this}filter(d){const p=[];for(const b in this.data)for(const M of this.data[b])d(M.value)||p.push(M);for(const b of p)this.remove(b.value.tileID,b)}}class Og{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,p,b){const M=String(p);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][M]=this.stateChanges[d][M]||{},Object.assign(this.stateChanges[d][M],b),this.deletedStates[d]===null){this.deletedStates[d]={};for(const L in this.state[d])L!==M&&(this.deletedStates[d][L]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][M]===null){this.deletedStates[d][M]={};for(const L in this.state[d][M])b[L]||(this.deletedStates[d][M][L]=null)}else for(const L in b)this.deletedStates[d]&&this.deletedStates[d][M]&&this.deletedStates[d][M][L]===null&&delete this.deletedStates[d][M][L]}removeFeatureState(d,p,b){if(this.deletedStates[d]===null)return;const M=String(p);if(this.deletedStates[d]=this.deletedStates[d]||{},b&&p!==void 0)this.deletedStates[d][M]!==null&&(this.deletedStates[d][M]=this.deletedStates[d][M]||{},this.deletedStates[d][M][b]=null);else if(p!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][M])for(b in this.deletedStates[d][M]={},this.stateChanges[d][M])this.deletedStates[d][M][b]=null;else this.deletedStates[d][M]=null;else this.deletedStates[d]=null}getState(d,p){const b=this.state[d]||{},M=this.stateChanges[d]||{},L=this.deletedStates[d];if(L===null)return{};if(p!==void 0){const z=String(p),V=Object.assign({},b[z],M[z]);if(L){const Y=L[p];if(Y===null)return{};for(const Q in Y)delete V[Q]}return V}const O=Object.assign({},b,M);if(L)for(const z in L)delete O[z];return O}initializeTileState(d,p){d.refreshFeatureState(p)}coalesceChanges(d,p){const b={};for(const M in this.stateChanges){this.state[M]=this.state[M]||{};const L={};for(const O in this.stateChanges[M])this.state[M][O]||(this.state[M][O]={}),Object.assign(this.state[M][O],this.stateChanges[M][O]),L[O]=this.state[M][O];b[M]=L}for(const M in this.deletedStates){this.state[M]=this.state[M]||{};const L={};if(this.deletedStates[M]===null)for(const O in this.state[M])L[O]={},this.state[M][O]={};else for(const O in this.deletedStates[M]){if(this.deletedStates[M][O]===null)this.state[M][O]={};else if(this.state[M][O])for(const z of Object.keys(this.deletedStates[M][O]))delete this.state[M][O][z];L[O]=this.state[M][O]}b[M]=b[M]||{},Object.assign(b[M],L)}if(this.stateChanges={},this.deletedStates={},Object.keys(b).length!==0)for(const M in d)d[M].refreshFeatureState(p)}}class Vc extends a.E{constructor(d,p,b){super(),this.id=d,this._onlySymbols=b,p.on("data",M=>{M.dataType==="source"&&M.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&M.dataType==="source"&&M.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),p.on("error",()=>{this._sourceErrored=!0}),this._source=p,this._tiles={},this._cache=new sk(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=p.minTileCacheSize,this._maxTileCacheSize=p.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Og,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(d){this.map=d,this._minTileCacheSize=this._minTileCacheSize===void 0&&d?d._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&d?d._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const d in this._tiles)if(!this._tiles[d].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const d=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,d&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(d,p){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,p)}_unloadTile(d){if(this._source.unloadTile)return this._source.unloadTile(d)}_abortTile(d){if(this._source.abortTile)return this._source.abortTile(d)}serialize(){return this._source.serialize()}prepare(d){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const p in this._tiles){const b=this._tiles[p];b.upload(d,this.map?this.map.painter:void 0),b.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(d=>d.tileID).sort(uy).map(d=>d.key)}getRenderableIds(d,p){const b=[];for(const M in this._tiles)this._isIdRenderable(+M,d,p)&&b.push(this._tiles[M]);return d?b.sort((M,L)=>{const O=M.tileID,z=L.tileID,V=new a.P(O.canonical.x,O.canonical.y)._rotate(this.transform.angle),Y=new a.P(z.canonical.x,z.canonical.y)._rotate(this.transform.angle);return O.overscaledZ-z.overscaledZ||Y.y-V.y||Y.x-V.x}).map(M=>M.tileID.key):b.map(M=>M.tileID).sort(uy).map(M=>M.key)}hasRenderableParent(d){const p=this.findLoadedParent(d,0);return!!p&&this._isIdRenderable(p.tileID.key)}_isIdRenderable(d,p,b){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(p||!this._tiles[d].holdingForFade())&&(b||!this._shadowCasterTiles[d])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const d in this._tiles)this._tiles[d].state!=="errored"&&this._reloadTile(+d,"reloading")}}_reloadTile(d,p){const b=this._tiles[d];b&&(b.state!=="loading"&&(b.state=p),this._loadTile(b,this._tileLoaded.bind(this,b,d,p)))}_tileLoaded(d,p,b,M,L){if(M){if(d.state="errored",M.status!==404)this._source.fire(new a.y(M,{tile:d}));else{if(this._source.fire(new a.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:d})),!(d.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const z=this.map.painter.terrain;this.update(this.transform,z.getScaledDemTileSize(),!0),z.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=a.o.now(),b==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(p,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let O=new Map;L&&L.responseHeaders&&(O=L.responseHeaders),this._source.fire(new a.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:O}))}_backfillDEM(d){const p=this.getRenderableIds();for(let M=0;M1||(Math.abs(O)>1&&(Math.abs(O+V)===1?O+=V:Math.abs(O-V)===1&&(O-=V)),L.dem&&M.dem&&(M.dem.backfillBorder(L.dem,O,z),M.neighboringTiles&&M.neighboringTiles[Y]&&(M.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,p,b,M){for(const L in this._tiles){let O=this._tiles[L];if(M[L]||!O.hasData()||O.tileID.overscaledZ<=p||O.tileID.overscaledZ>b)continue;let z=O.tileID;for(;O&&O.tileID.overscaledZ>p+1;){const Y=O.tileID.scaledTo(O.tileID.overscaledZ-1);O=this._tiles[Y.key],O&&O.hasData()&&(z=Y)}let V=z;for(;V.overscaledZ>p;)if(V=V.scaledTo(V.overscaledZ-1),d[V.key]){M[z.key]=z;break}}}findLoadedParent(d,p){if(d.key in this._loadedParentTiles){const b=this._loadedParentTiles[d.key];return b&&b.tileID.overscaledZ>=p?b:null}for(let b=d.overscaledZ-1;b>=p;b--){const M=d.scaledTo(b),L=this._getLoadedTile(M);if(L)return L}}_getLoadedTile(d){const p=this._tiles[d.key];return p&&p.hasData()?p:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,p){p=p||this._source.tileSize;const b=Math.ceil(d.width/p)+1,M=Math.ceil(d.height/p)+1,L=Math.floor(b*M*5),O=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,L):L,z=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,O):O;this._cache.setMaxSize(z)}handleWrapJump(d){const p=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,p){const b={};for(const M in this._tiles){const L=this._tiles[M];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+p),b[L.tileID.key]=L}this._tiles=b;for(const M in this._timers)clearTimeout(this._timers[M]),delete this._timers[M];for(const M in this._tiles)this._setTileReloadTimer(+M,this._tiles[M])}}update(d,p,b,M,L){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!b)return;this.updateCacheSize(d,p),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const O=this._source.type==="batched-model";let z,V=this._source.maxzoom;const Y=this.map&&this.map.painter?this.map.painter._terrain:null;if(Y&&Y.sourceCache===this&&Y.attenuationRange()){const le=Y.attenuationRange()[0],de=Math.floor(le)-Math.log2(Y.getDemUpscale());V>de&&(V=de)}if(this.used||this.usedForTerrain){if(this._source.tileID)z=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(le=>new a.aQ(le.canonical.z,le.wrap,le.canonical.z,le.canonical.x,le.canonical.y));else if(this.tileCoverLift!==0){const le=d.clone();le.tileCoverLift=this.tileCoverLift,z=le.coveringTiles({tileSize:p||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!b,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:O}),this._source.minzoom<=1&&d.projection.name==="globe"&&(z.push(new a.aQ(1,0,1,0,0)),z.push(new a.aQ(1,0,1,1,0)),z.push(new a.aQ(1,0,1,0,1)),z.push(new a.aQ(1,0,1,1,1)))}else if(z=d.coveringTiles({tileSize:p||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!b,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:O}),this._source.hasTile){const le=this._source.hasTile.bind(this._source);z=z.filter(de=>le(de))}}else z=[];if(z.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!lp(this._source.type)){const le=d.coveringZoomLevel({tileSize:p||this._source.tileSize,roundZoom:this._source.roundZoom&&!b}),de=Math.min(le,this._source.maxzoom);if(O){const be=d.extendTileCover(z,de);for(const xe of be)z.push(xe)}else if(L){const be=d.extendTileCoverToNearPlane(z,this.transform.getFrustum(de),de);for(const xe of be)z.push(xe)}else if(this.castsShadows&&M){const be=d.extendTileCover(z,de,M,16);for(const xe of be)this._shadowCasterTiles[xe.key]=!0,z.push(xe)}}const Q=this._updateRetainedTiles(z);if(lp(this._source.type)&&z.length!==0){const le={},de={},be=Object.keys(Q);for(const Pe of be){const Ee=Q[Pe],$e=this._tiles[Pe];if(!$e||$e.fadeEndTime&&$e.fadeEndTime<=a.o.now())continue;const Ke=this.findLoadedParent(Ee,Math.max(Ee.overscaledZ-Vc.maxOverzooming,this._source.minzoom));Ke&&(this._addTile(Ke.tileID),le[Ke.tileID.key]=Ke.tileID),de[Pe]=Ee}const xe=z[z.length-1].overscaledZ;for(const Pe in this._tiles){const Ee=this._tiles[Pe];if(Q[Pe]||!Ee.hasData())continue;let $e=Ee.tileID;for(;$e.overscaledZ>xe;){$e=$e.scaledTo($e.overscaledZ-1);const Ke=this._tiles[$e.key];if(Ke&&Ke.hasData()&&de[$e.key]){Q[Pe]=Ee.tileID;break}}}for(const Pe in le)Q[Pe]||(this._coveredTiles[Pe]=!0,Q[Pe]=le[Pe])}for(const le in Q)this._tiles[le].clearFadeHold();const ce=a.bv(this._tiles,Q);for(const le of ce){const de=this._tiles[le];de.hasSymbolBuckets&&!de.holdingForFade()?de.setHoldDuration(this.map._fadeDuration):de.hasSymbolBuckets&&!de.symbolFadeFinished()||this._removeTile(+le)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const d in this._tiles)this._tiles[d].holdingForFade()&&this._removeTile(+d)}_updateRetainedTiles(d){const p={};if(d.length===0)return p;const b={},M=d.reduce((Y,Q)=>Math.min(Y,Q.overscaledZ),1/0),L=d[0].overscaledZ,O=Math.max(L-Vc.maxOverzooming,this._source.minzoom),z=Math.max(L+Vc.maxUnderzooming,this._source.minzoom),V={};for(const Y of d){const Q=this._addTile(Y);p[Y.key]=Y,Q.hasData()||M=this._source.maxzoom){const le=Y.children(this._source.maxzoom)[0],de=this.getTile(le);if(de&&de.hasData()){p[le.key]=le;continue}}else{const le=Y.children(this._source.maxzoom);if(p[le[0].key]&&p[le[1].key]&&p[le[2].key]&&p[le[3].key])continue}let ce=Q.wasRequested();for(let le=Y.overscaledZ-1;le>=O;--le){const de=Y.scaledTo(le);if(b[de.key]||(b[de.key]=!0,Q=this.getTile(de),!Q&&ce&&(Q=this._addTile(de)),Q&&(p[de.key]=de,ce=Q.wasRequested(),Q.hasData())))break}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const p=[];let b,M=this._tiles[d].tileID;for(;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){b=this._loadedParentTiles[M.key];break}p.push(M.key);const L=M.scaledTo(M.overscaledZ-1);if(b=this._getLoadedTile(L),b)break;M=L}for(const L of p)this._loadedParentTiles[L]=b}}_addTile(d){let p=this._tiles[d.key];if(p)return p.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),p;p=this._cache.getAndRemove(d),p&&(this._setTileReloadTimer(d.key,p),p.tileID=d,this._state.initializeTileState(p,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,p)));const b=!!p;if(!b){const M=this.map?this.map.painter:null,L=this._source.tileSize*d.overscaleFactor();p=this._source.type==="raster-array"?new op(d,L,this.transform.tileZoom,M,this._isRaster):new ap(d,L,this.transform.tileZoom,M,this._isRaster,this._source.worldview),this._loadTile(p,this._tileLoaded.bind(this,p,d.key,p.state))}return p.uses++,this._tiles[d.key]=p,b||this._source.fire(new a.z("dataloading",{tile:p,coord:p.tileID,dataType:"source"})),p}_setTileReloadTimer(d,p){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const b=p.getExpiryTimeout();b&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},b))}_removeTile(d){const p=this._tiles[d];p&&(p.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),p.uses>0||(p.hasData()&&p.state!=="reloading"||p.state==="empty"?this._cache.add(p.tileID,p,p.getExpiryTimeout()):(p.aborted=!0,this._abortTile(p),this._unloadTile(p))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const d in this._tiles)this._removeTile(+d);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(d,p,b){const M=[],L=this.transform;if(!L)return M;const O=L.projection.name==="globe",z=a.aF(L.center.lng);for(const V in this._tiles){const Y=this._tiles[V];if(b&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let Q;if(O){const ce=Y.tileID.canonical;if(ce.z===0){const le=[Math.abs(a.aA(z,...$u(ce,-1))-z),Math.abs(a.aA(z,...$u(ce,1))-z)];Q=[0,2*le.indexOf(Math.min(...le))-1]}else{const le=[Math.abs(a.aA(z,...$u(ce,-1))-z),Math.abs(a.aA(z,...$u(ce,0))-z),Math.abs(a.aA(z,...$u(ce,1))-z)];Q=[le.indexOf(Math.min(...le))-1]}}else Q=[0];for(const ce of Q){const le=d.containsTile(Y,L,p,ce);le&&M.push(le)}}return M}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,p){const b=this.getRenderableIds(d,p).map(L=>this._tiles[L].tileID),M=this.transform.projection.name==="globe";for(const L of b)L.projMatrix=this.transform.calculateProjMatrix(L.toUnwrapped()),L.expandedProjMatrix=M?this.transform.calculateProjMatrix(L.toUnwrapped(),!1,!0):L.projMatrix;return b}sortCoordinatesByDistance(d){const p=d.slice(),b=this.transform._camera.position,M=this.transform._camera.forward(),L={};for(const O of p){const z=1/(1<L[O.key]-L[z.key]),p}hasTransition(){if(this._source.hasTransition())return!0;if(lp(this._source.type))for(const d in this._tiles){const p=this._tiles[d];if(p.fadeEndTime!==void 0&&p.fadeEndTime>=a.o.now())return!0}return!1}setFeatureState(d,p,b){this._state.updateState(d=d||"_geojsonTileLayer",p,b)}removeFeatureState(d,p,b){this._state.removeFeatureState(d=d||"_geojsonTileLayer",p,b)}getFeatureState(d,p){return this._state.getState(d=d||"_geojsonTileLayer",p)}setDependencies(d,p,b){const M=this._tiles[d];M&&M.setDependencies(p,b)}reloadTilesForDependencies(d,p){for(const b in this._tiles)this._tiles[b].hasDependency(d,p)&&this._reloadTile(+b,"reloading");this._cache.filter(b=>!b.hasDependency(d,p))}_preloadTiles(d,p){if(!this._sourceLoaded){const V=()=>{this._sourceLoaded&&(this._source.off("data",V),this._preloadTiles(d,p))};return void this._source.on("data",V)}const b=new Map,M=Array.isArray(d)?d:[d],L=this.map.painter.terrain,O=this.usedForTerrain&&L?L.getScaledDemTileSize():this._source.tileSize;for(const V of M){const Y=V.coveringTiles({tileSize:O,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const Q of Y)b.set(Q.key,Q);this.usedForTerrain&&V.updateElevation(!1)}const z=Array.from(b.values());a.bw(z,(V,Y)=>{const Q=new ap(V,this._source.tileSize*V.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(Q,ce=>{this._source.type==="raster-dem"&&Q.dem&&this._backfillDEM(Q),Y(ce,Q)})},p)}}function uy(_,d){const p=Math.abs(2*_.wrap)-+(_.wrap<0),b=Math.abs(2*d.wrap)-+(d.wrap<0);return _.overscaledZ-d.overscaledZ||b-p||d.canonical.y-_.canonical.y||d.canonical.x-_.canonical.x}function lp(_){return _==="raster"||_==="image"||_==="video"||_==="custom"}function $u(_,d){const p=1<<_.z;return[_.x/p+d,(_.x+1)/p+d]}Vc.maxOverzooming=10,Vc.maxUnderzooming=3;class w5{constructor(d){this.style=d,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const d=!1,p=!1;for(const b in this.style._mergedLayers){const M=this.style._mergedLayers[b];if(M.type==="fill-extrusion"||M.type==="building")this.layers.push({layer:M,visible:d,visibilityChanged:p});else if(M.type==="model"){const L=this.style.getLayerSource(M);L&&L.type==="batched-model"&&this.layers.push({layer:M,visible:d,visibilityChanged:p})}}}onNewFrame(d){this.layersGotHidden=!1;for(const p of this.layers){const b=p.layer;let M=!1;b.type==="fill-extrusion"?M=!b.isHidden(d)&&b.paint.get("fill-extrusion-opacity")>0:b.type==="building"?M=!b.isHidden(d)&&b.paint.get("building-opacity")>0:b.type==="model"&&(M=!b.isHidden(d)&&b.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!M&&p.visible,p.visible=M}}updateZOffset(d,p){this.currentBuildingBuckets=[];for(const M of this.layers){const L=M.layer,O=this.style.getLayerSourceCache(L);let z=1;L.type==="fill-extrusion"?z=M.visible?L.paint.get("fill-extrusion-vertical-scale"):0:L.type==="building"&&(z=M.visible?L.paint.get("building-vertical-scale"):0);let V=O?O.getTile(p):null;if(!V&&O)for(const Y in O._tiles){const Q=O._tiles[Y];if(p.canonical.isChildOf(Q.tileID.canonical)){V=Q;break}}this.currentBuildingBuckets.push({bucket:V?V.getBucket(L):null,tileID:V?V.tileID:p,verticalScale:z})}d.hasAnyZOffset=!1;let b=!1;for(let M=0;M{b in d&&(p[b]=d[b])}),p}function Cr(_){_=_.slice();const d=Object.create(null);for(let p=0;p<_.length;p++)d[_[p].id]=_[p];for(let p=0;p<_.length;p++)"ref"in _[p]&&(_[p]=jt(_[p],d[_[p].ref]));return _}const cr={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function vs(_,d,p){p.push({command:cr.addSource,args:[_,d[_]]})}function Ds(_,d,p){d.push({command:cr.removeSource,args:[_]}),p[_]=!0}function jo(_,d,p,b){Ds(_,p,b),vs(_,d,p)}function eo(_,d,p){let b;for(b in _[p])if(_[p].hasOwnProperty(b)&&b!=="data"&&!a.by(_[p][b],d[p][b]))return!1;for(b in d[p])if(d[p].hasOwnProperty(b)&&b!=="data"&&!a.by(_[p][b],d[p][b]))return!1;return!0}function to(_,d,p,b,M,L){let O;for(O in d=d||{},_=_||{})_.hasOwnProperty(O)&&(a.by(_[O],d[O])||p.push({command:L,args:[b,O,d[O],M]}));for(O in d)d.hasOwnProperty(O)&&!_.hasOwnProperty(O)&&(a.by(_[O],d[O])||p.push({command:L,args:[b,O,d[O],M]}))}function Dg(_){return _.id}function X1(_,d){return _[d.id]=d,_}function j5(_,d,p){const b=d.createTileMatrix(_,_.worldSize,p.toUnwrapped());return a.aB(new Float32Array(16),_.projMatrix,b)}function ik(_,d,p){if(d.projection.name===p.projection.name)return _.projMatrix;const b=p.clone();return b.setProjection(d.projection),j5(b,d.getProjection(),_)}function af(_,d,p){return d.name===p.projection.name?_.projMatrix:j5(p,d,_)}class Q1{constructor(d,p){this.reset(d,p)}reset(d,p){this.points=d||[],this._distances=[0];for(let b=1;b0?(M-O)/z:0;return this.points[L].mult(1-V).add(this.points[p].mult(V))}}class k5{constructor(d,p,b){const M=this.boxCells=[],L=this.circleCells=[];this.xCellCount=Math.ceil(d/b),this.yCellCount=Math.ceil(p/b);for(let O=0;Othis.width||M<0||p>this.height)return!L&&[];const z=[];if(d<=0&&p<=0&&this.width<=b&&this.height<=M){if(L)return!0;for(let V=0;V0:z}_queryCircle(d,p,b,M,L){const O=d-b,z=d+b,V=p-b,Y=p+b;if(z<0||O>this.width||Y<0||V>this.height)return!M&&[];const Q=[];return this._forEachCell(O,V,z,Y,this._queryCellCircle,Q,{hitTest:M,circle:{x:d,y:p,radius:b},seenUids:{box:{},circle:{}}},L),M?Q.length>0:Q}query(d,p,b,M,L){return this._query(d,p,b,M,!1,L)}hitTest(d,p,b,M,L){return this._query(d,p,b,M,!0,L)}hitTestCircle(d,p,b,M){return this._queryCircle(d,p,b,!0,M)}_queryCell(d,p,b,M,L,O,z,V){const Y=z.seenUids,Q=this.boxCells[L];if(Q!==null){const le=this.bboxes;for(const de of Q)if(!Y.box[de]){Y.box[de]=!0;const be=4*de;if(d<=le[be+2]&&p<=le[be+3]&&b>=le[be+0]&&M>=le[be+1]&&(!V||V(this.boxKeys[de]))){if(z.hitTest)return O.push(!0),!0;O.push({key:this.boxKeys[de],x1:le[be],y1:le[be+1],x2:le[be+2],y2:le[be+3]})}}}const ce=this.circleCells[L];if(ce!==null){const le=this.circles;for(const de of ce)if(!Y.circle[de]){Y.circle[de]=!0;const be=3*de;if(this._circleAndRectCollide(le[be],le[be+1],le[be+2],d,p,b,M)&&(!V||V(this.circleKeys[de]))){if(z.hitTest)return O.push(!0),!0;{const xe=le[be],Pe=le[be+1],Ee=le[be+2];O.push({key:this.circleKeys[de],x1:xe-Ee,y1:Pe-Ee,x2:xe+Ee,y2:Pe+Ee})}}}}}_queryCellCircle(d,p,b,M,L,O,z,V){const Y=z.circle,Q=z.seenUids,ce=this.boxCells[L];if(ce!==null){const de=this.bboxes;for(const be of ce)if(!Q.box[be]){Q.box[be]=!0;const xe=4*be;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,de[xe+0],de[xe+1],de[xe+2],de[xe+3])&&(!V||V(this.boxKeys[be])))return O.push(!0),!0}}const le=this.circleCells[L];if(le!==null){const de=this.circles;for(const be of le)if(!Q.circle[be]){Q.circle[be]=!0;const xe=3*be;if(this._circlesCollide(de[xe],de[xe+1],de[xe+2],Y.x,Y.y,Y.radius)&&(!V||V(this.circleKeys[be])))return O.push(!0),!0}}}_forEachCell(d,p,b,M,L,O,z,V){const Y=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(p),ce=this._convertToXCellCoord(b),le=this._convertToYCellCoord(M);for(let de=Y;de<=ce;de++)for(let be=Q;be<=le;be++)if(L.call(this,d,p,b,M,this.xCellCount*be+de,O,z,V))return}_convertToXCellCoord(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))}_convertToYCellCoord(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))}_circlesCollide(d,p,b,M,L,O){const z=M-d,V=L-p,Y=b+O;return Y*Y>z*z+V*V}_circleAndRectCollide(d,p,b,M,L,O,z){const V=(O-M)/2,Y=Math.abs(d-(M+V));if(Y>V+b)return!1;const Q=(z-L)/2,ce=Math.abs(p-(L+Q));if(ce>Q+b)return!1;if(Y<=V||ce<=Q)return!0;const le=Y-V,de=ce-Q;return le*le+de*de<=b*b}}const jm={unknown:0,flipRequired:1,flipNotRequired:2},Rg=Math.tan(85*Math.PI/180);function Mc(_,d,p,b,M,L,O){const z=a.bC();if(p)if(L.name==="globe"){const V=a.bD(M,d);a.aB(z,z,V)}else{const V=a.bE([],O);z[0]=V[0],z[1]=V[1],z[4]=V[2],z[5]=V[3],b||a.bB(z,z,M.angle)}else a.aB(z,M.labelPlaneMatrix,_);return z}function ak(_,d,p,b,M,L,O){const z=Mc(_,d,p,b,M,L,O);return L.name==="globe"&&p||(z[2]=z[6]=z[10]=z[14]=0),z}function J1(_,d,p,b,M,L,O){if(p){if(L.name==="globe"){const z=Mc(_,d,p,b,M,L,O);return a.bl(z,z),a.aB(z,_,z),z}{const z=a.bz(_),V=a.bA([]);return V[0]=O[0],V[1]=O[1],V[4]=O[2],V[5]=O[3],a.aB(z,z,V),b||a.bB(z,z,-M.angle),z}}return M.glCoordMatrix}function Uu(_,d,p,b){const M=[_,d,p,1];p?a.aC(M,M,b):fn(M,M,b);const L=M[3];return M[0]/=L,M[1]/=L,M[2]/=L,M}function vi(_,d){return Math.min(.5+_/d*.5,1.5)}function OI(_,d){const p=_[0]/_[3],b=_[1]/_[3];return p>=-d[0]&&p<=d[0]&&b>=-d[1]&&b<=d[1]}function DI(_,d,p,b,M,L,O,z,V,Y,Q=1){const ce=p.transform,le=b?_.textSizeData:_.iconSizeData,de=a.bK(le,p.transform.zoom,Q),be=ce.projection.name==="globe",xe=[256/p.width*2+1,256/p.height*2+1],Pe=b?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;Pe.clear();let Ee=null;be&&(Ee=b?_.text.globeExtVertexArray:_.icon.globeExtVertexArray);const $e=_.lineVertexArray,Ke=b?_.text.placedSymbolArray:_.icon.placedSymbolArray,Ue=p.transform.width/p.transform.height;let mt,ct=!1;for(let ht=0;htMath.abs(p)?{useVertical:!0}:_===a.bL.vertical?b>0?{needsFlipping:!0}:null:d!==jm.unknown&&function(M,L){return M===0||Math.abs(L/M)>Rg}(p,b)?d===jm.flipRequired?{needsFlipping:!0}:null:p<0?{needsFlipping:!0}:null}function N5(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee,$e,Ke){const Ue=d/24,mt=_.lineOffsetX*Ue,ct=_.lineOffsetY*Ue,{lineStartIndex:ht,glyphStartIndex:ot,numGlyphs:st,segment:_t,writingMode:It,flipState:Tt}=_,Vt=ht+_.lineLength,Ht=nr=>{if(Q){const[Zt,qt,ur]=nr.up,Ar=Y.length;a.bN(Q,Ar+0,Zt,qt,ur),a.bN(Q,Ar+1,Zt,qt,ur),a.bN(Q,Ar+2,Zt,qt,ur),a.bN(Q,Ar+3,Zt,qt,ur)}const[br,zt,Nt]=nr.point;a.bO(Y,br,zt,Nt,nr.angle)};if(st>1){const nr=RI(Ue,z,mt,ct,p,ce,le,_,V,L,de,xe,!1,Pe,Ee,$e,Ke);if(!nr)return{notEnoughRoom:!0};if(b&&!p){let[br,zt,Nt]=nr.first.point,[Zt,qt,ur]=nr.last.point;[br,zt]=Uu(br,zt,Nt,O),[Zt,qt]=Uu(Zt,qt,ur,O);const Ar=Rn(It,Tt,(Zt-br)*be,qt-zt);if(_.flipState=Ar&&Ar.needsFlipping?jm.flipRequired:jm.flipNotRequired,Ar)return Ar}Ht(nr.first);for(let br=ot+1;br0?Zt:qu(le,Nt,br,1,M,void 0,Pe,Ee.canonical),ur=Rn(It,Tt,(qt[0]-br[0])*be,qt[1]-br[1]);if(_.flipState=ur&&ur.needsFlipping?jm.flipRequired:jm.flipNotRequired,ur)return ur}const nr=hy(Ue*z.getoffsetX(ot),mt,ct,p,ce,le,_t,ht,Vt,V,L,de,xe,!1,!1,Pe,Ee,$e,Ke);if(!nr)return{notEnoughRoom:!0};Ht(nr)}return{}}function ev(_,d,p,b,M){const{x:L,y:O,z}=b.projectTilePoint(_.x,_.y,d);if(!M)return Uu(L,O,z,p);const[V,Y,Q]=M.getElevation(_,M.elevation,M.elevationFeature);return Uu(L+V,O+Y,z+Q,p)}function qu(_,d,p,b,M,L,O,z){const V=ev(_.sub(d)._unit()._add(_),z,M,O,L);return a.av(V,p,V),a.aw(V,V),a.bH(V,p,V,b)}function hy(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee,$e){const Ke=b?_-d:_+d;let Ue=Ke>0?1:-1,mt=0;b&&(Ue*=-1,mt=Math.PI),Ue<0&&(mt+=Math.PI);let ct=z+O+(Ue>0?0:1)|0,ht=M,ot=M,st=0,_t=0;const It=Math.abs(Ke),Tt=[],Vt=[];let Ht=L,nr=Ht,br=a.bF([]);const zt=()=>qu(nr,Ht,ot,It-st+1,Q,le,xe,Pe.canonical);for(;st+_t<=It;){if(ct+=Ue,ct=V)return null;if(ot=ht,nr=Ht,Tt.push(ot),de&&Vt.push(nr),Ht=new a.P(Y.getx(ct),Y.gety(ct)),ht=ce[ct],!ht){const Jr=ev(Ht,Pe.canonical,Q,xe,le);ht=Jr[3]>0?ce[ct]=Jr:zt()}st+=_t;const wr=a.av([],ht,ot),nn=a.bG(ot,ht);if(p&&nn>0&&_t>0&&a.bJ(br,wr)/(_t*nn)<$e)return null;_t=nn,br=wr}be&&le&&(ce[ct]&&(ht=zt(),_t=a.bG(ot,ht),br=a.av([],ht,ot)),ce[ct]=ht);const Nt=(It-st)/_t,Zt=Ht.sub(nr)._mult(Nt)._add(nr),qt=a.bH([],ot,br,Nt);let ur=[0,0,1],Ar=br[0],qr=br[1];if(Ee&&(ur=xe.upVector(Pe.canonical,Zt.x,Zt.y),ur[0]!==0||ur[1]!==0||ur[2]!==1)){const wr=[ur[2],0,-ur[0]],nn=a.bI([],ur,wr);a.aw(wr,wr),a.aw(nn,nn),Ar=a.bJ(br,wr),qr=a.bJ(br,nn)}if(p){const wr=a.bI([],ur,br);a.aw(wr,wr),a.bH(qt,qt,wr,p*Ue)}const Sr=mt+Math.atan2(qr,Ar);return Tt.push(qt),de&&Vt.push(Zt),{point:qt,angle:Sr,path:Tt,tilePath:Vt,up:ur}}function vh(_,d){const p=d.length,b=p+4*_;d.resize(b),d.float32.fill(-1/0,4*p,4*b)}function fn(_,d,p){const b=d[0],M=d[1];return _[0]=p[0]*b+p[4]*M+p[12],_[1]=p[1]*b+p[5]*M+p[13],_[3]=p[3]*b+p[7]*M+p[15],_}const Gs=100;class Ti{constructor(d,p,b=new k5(d.width+200,d.height+200,25),M=new k5(d.width+200,d.height+200,25)){this.transform=d,this.grid=b,this.ignoredGrid=M,this.pitchfactor=Math.cos(d._pitch)*d.cameraToCenterDistance,this.screenRightBoundary=d.width+Gs,this.screenBottomBoundary=d.height+Gs,this.gridRightBoundary=d.width+200,this.gridBottomBoundary=d.height+200,this.fogState=p}placeCollisionBox(d,p,b,M,L,O,z,V,Y,Q,ce){let le=b.projectedAnchorX,de=b.projectedAnchorY,be=b.projectedAnchorZ;const xe=b.tileAnchorX,Pe=b.tileAnchorY,Ee=b.elevation,$e=b.tileID,Ke=d.getProjection();if(Ee&&$e){const[Vt,Ht,nr]=Ke.upVector($e.canonical,b.tileAnchorX,b.tileAnchorY),br=Ke.upVectorScale($e.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;le+=Vt*Ee*br,de+=Ht*Ee*br,be+=nr*Ee*br}const Ue=d.projection.name==="globe",mt=d.projection.name==="globe"?a.aj(this.transform.zoom):0;if($e&&Ue&&mt<1&&!O){const Vt=1<<$e.canonical.z,Ht=a.bP(xe,Pe);a.bQ(Ht,Ht,1/a.al),a.bR(Ht,Ht,a.bP($e.canonical.x,$e.canonical.y)),a.bQ(Ht,Ht,1/Vt),a.bS(Ht,Ht,a.bP(M[0],M[1])),Ht[0]=a.bT(Ht[0],-.5,.5),a.bQ(Ht,Ht,a.al);const nr=a.bU(Ht[0],Ht[1],a.al/(2*Math.PI),1);a.aC(nr,nr,L),le=a.ak(le,nr[0],mt),de=a.ak(de,nr[1],mt),be=a.ak(be,nr[2],mt)}const ct=this.projectAndGetPerspectiveRatio(Q,le,de,be,b.tileID,Ke.name==="globe"||!!Ee||this.transform.pitch>0,Ke),ht=Y*ct.perspectiveRatio,ot=(b.x1*p+z.x-b.padding)*ht+ct.point.x,st=(b.y1*p+z.y-b.padding)*ht+ct.point.y,_t=(b.x2*p+z.x+b.padding)*ht+ct.point.x,It=(b.y2*p+z.y+b.padding)*ht+ct.point.y,Tt=ct.perspectiveRatio<=.55||ct.occluded;return!this.isInsideGrid(ot,st,_t,It)||!V&&this.grid.hitTest(ot,st,_t,It,ce)||Tt?{box:[],offscreen:!1,occluded:ct.occluded}:{box:[ot,st,_t,It],offscreen:this.isOffscreen(ot,st,_t,It),occluded:!1}}placeCollisionCircles(d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe){const Ee=[],$e=this.transform.elevation,Ke=d.getProjection(),Ue=d.elevationType==="road",mt=!!$e||Ue,ct=a.bV.getAtTileOffsetFunc(Pe,this.transform.center.lat,this.transform.worldSize,Ke),ht=new a.P(b.tileAnchorX,b.tileAnchorY),ot=new a.P(b.tileAnchorX,b.tileAnchorY);let{x:st,y:_t,z:It}=Ke.projectTilePoint(ot.x,ot.y,Pe.canonical),Tt=null;if(mt){const nn=Ue?d.getElevationFeatureForText(M):null;Tt={getElevation:ct,elevation:$e,elevationFeature:nn};const[Jr,Rr,Vr]=ct(ht,$e,nn);st+=Jr,_t+=Rr,It+=Vr}const Vt=Ke.name==="globe",Ht=this.projectAndGetPerspectiveRatio(V,st,_t,It,Pe,Vt||!!$e||this.transform.pitch>0,Ke),{perspectiveRatio:nr}=Ht,br=(le?z/nr:z*nr)/a.bY,zt=Uu(st,_t,It,Y),Nt=b.lineOffsetX*br,Zt=b.lineOffsetY*br,qt=a.an(d.layers[0].layout.get("text-max-angle")),ur=Math.cos(qt),Ar=Ht.signedDistanceFromCamera>0?RI(br,O,Nt,Zt,Ue&&b.flipState===1,zt,ot,b,L,Y,{},mt&&!le?Tt:null,le&&mt,Ke,Pe,le,ur):null;let qr=!1,Sr=!1,wr=!0;if(Ar&&!Ht.occluded){const nn=.5*be*nr+xe,Jr=new a.P(-100,-100),Rr=new a.P(this.screenRightBoundary,this.screenBottomBoundary),Vr=new Q1,{first:jn,last:Kn}=Ar,Is=jn.path.length;let ci=[];for(let Hn=Is-1;Hn>=1;Hn--)ci.push(jn.path[Hn]);for(let Hn=1;Hn(mt&&!Vt&&(Ai=ct(_iHn[3]<=0)&&(ci=[]));let ri=[];if(ci.length>0){let Hn=1/0,pi=-1/0,Ai=1/0,_i=-1/0;for(const ei of ci)Hn=Math.min(Hn,ei[0]),Ai=Math.min(Ai,ei[1]),pi=Math.max(pi,ei[0]),_i=Math.max(_i,ei[1]);pi>=Jr.x&&Hn<=Rr.x&&_i>=Jr.y&&Ai<=Rr.y&&(ri=[ci.map(ei=>new a.P(ei[0],ei[1]))],(HnRr.x||AiRr.y)&&(ri=a.bW(ri,Jr.x,Jr.y,Rr.x,Rr.y)))}for(const Hn of ri){Vr.reset(Hn,.25*nn);let pi=0;pi=Vr.length<=.5*nn?1:Math.ceil(Vr.paddedLength/on)+1;for(let Ai=0;Ai0?(a.aC(V,V,d),this.fogState&&L&&z.name!=="globe"&&(Y=function(le,de,be,xe,Pe,Ee){const $e=Ee.calculateFogTileMatrix(Pe),Ke=[de,be,xe];return a.af(Ke,Ke,$e),Gr(le,a.ag(Ke),Ee.pitch,Ee._fov)}(this.fogState,p,b,M,L.toUnwrapped(),this.transform)>.9)):fn(V,V,d);const Q=V[3];return{point:new a.P((V[0]/Q+1)/2*this.transform.width+Gs,(-V[1]/Q+1)/2*this.transform.height+Gs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(z)/Q*.5,1.5),signedDistanceFromCamera:Q,occluded:O&&V[2]>Q||Y}}isOffscreen(d,p,b,M){return b=this.screenRightBoundary||Mthis.screenBottomBoundary}isInsideGrid(d,p,b,M){return b>=0&&d=0&&pb.collisionGroupID===p}}return this.collisionGroups[d]}}function cc(_,d,p,b,M){const{horizontalAlign:L,verticalAlign:O}=a.c1(_),z=-(L-.5)*d,V=-(O-.5)*p,Y=a.c2(_,b);return new a.P(z+Y[0]*M,V+Y[1]*M)}function ko(_,d,p,b,M){const L=new a.P(_,d);return p&&L._rotate(b?M:-M),L}class Oie{constructor(d,p,b,M,L,O){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Ti(this.transform,L),this.buildingIndex=O,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new rv(b),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,p,b,M,L=1){const O=b.getBucket(p),z=b.latestFeatureIndex;if(!O||!z||p.fqid!==O.layerIds[0])return;const V=O.layers[0].layout,Y=O.layers[0].paint,Q=b.collisionBoxArray,ce=Math.pow(2,this.transform.zoom-b.tileID.overscaledZ),le=b.tileSize/a.al,de=b.tileID.toUnwrapped();this.transform.setProjection(O.projection);const be=(xe=b.tileID,Pe=O.getProjection(),Ee=this.transform,Pe.name===this.projection?Ee.calculateProjMatrix(xe.toUnwrapped()):j5(Ee,Pe,xe));var xe,Pe,Ee;const $e=V.get("text-pitch-alignment")==="map",Ke=V.get("text-rotation-alignment")==="map";p.compileFilter(p.options);const Ue=p.dynamicFilter(),mt=p.dynamicFilterNeedsFeature(),ct=this.transform.calculatePixelsToTileUnitsMatrix(b),ht=ak(be,b.tileID.canonical,$e,Ke,this.transform,O.getProjection(),ct);let ot=null;const st=O.getProjection().createInversionMatrix(this.transform,b.tileID.canonical);if($e){const Nt=J1(be,b.tileID.canonical,$e,Ke,this.transform,O.getProjection(),ct);ot=a.aB([],this.transform.labelPlaneMatrix,Nt)}let _t=null;Ue&&b.latestFeatureIndex&&(_t={unwrappedTileID:de,dynamicFilter:Ue,dynamicFilterNeedsFeature:mt}),this.retainedQueryData[O.bucketInstanceId]=new tv(O.bucketInstanceId,z,O.sourceLayerIndex,O.index,b.tileID);const[It,Tt]=O.layers[0].layout.get("text-size-scale-range"),Vt=a.aA(L,It,Tt),[Ht,nr]=V.get("icon-size-scale-range"),br=a.aA(L,Ht,nr),zt={bucket:O,layout:V,paint:Y,posMatrix:be,invMatrix:st,mercatorCenter:[a.aF(this.transform.center.lng),a.aJ(this.transform.center.lat)],textLabelPlaneMatrix:ht,labelToScreenMatrix:ot,clippingData:_t,scale:ce,textPixelRatio:le,holdingForFade:b.holdingForFade(),collisionBoxArray:Q,partiallyEvaluatedTextSize:a.bK(O.textSizeData,this.transform.zoom,Vt),partiallyEvaluatedIconSize:a.bK(O.iconSizeData,this.transform.zoom,br),collisionGroup:this.collisionGroups.get(O.sourceID),latestFeatureIndex:b.latestFeatureIndex};if(M)for(const Nt of O.sortKeyRanges){const{sortKey:Zt,symbolInstanceStart:qt,symbolInstanceEnd:ur}=Nt;d.push({sortKey:Zt,symbolInstanceStart:qt,symbolInstanceEnd:ur,parameters:zt})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:O.symbolInstances.length,parameters:zt})}attemptAnchorPlacement(d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee,$e,Ke,Ue,mt){const{textOffset0:ct,textOffset1:ht,crossTileID:ot}=xe,st=[ct,ht],_t=cc(d,O,z,st,V),It=this.collisionIndex.placeCollisionBox(Ee,V,p,b,M,L,ko(_t.x,_t.y,Y,Q,this.transform.angle),be,ce,le,de.predicate);if(Ke){const Tt=Ee.getSymbolInstanceIconSize(mt,this.transform.zoom,xe.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Ee,Tt,Ke,b,M,L,ko(_t.x,_t.y,Y,Q,this.transform.angle),be,ce,le,de.predicate).box.length===0)return}if(It.box.length>0){let Tt;return this.prevPlacement&&this.prevPlacement.variableOffsets[ot]&&this.prevPlacement.placements[ot]&&this.prevPlacement.placements[ot].text&&(Tt=this.prevPlacement.variableOffsets[ot].anchor),this.variableOffsets[ot]={textOffset:st,width:O,height:z,anchor:d,textScale:V,prevAnchor:Tt},this.markUsedJustification(Ee,d,xe,$e),Ee.allowVerticalPlacement&&(this.markUsedOrientation(Ee,$e,xe),this.placedOrientations[ot]=$e),{shift:_t,placedGlyphBoxes:It}}}placeLayerBucketPart(d,p,b,M,L=1){const{bucket:O,layout:z,paint:V,posMatrix:Y,textLabelPlaneMatrix:Q,labelToScreenMatrix:ce,clippingData:le,textPixelRatio:de,mercatorCenter:be,invMatrix:xe,holdingForFade:Pe,collisionBoxArray:Ee,partiallyEvaluatedTextSize:$e,partiallyEvaluatedIconSize:Ke,collisionGroup:Ue,latestFeatureIndex:mt}=d.parameters,ct=z.get("text-optional"),ht=z.get("icon-optional"),ot=z.get("text-allow-overlap"),st=z.get("icon-allow-overlap"),_t=z.get("text-rotation-alignment")==="map",It=z.get("icon-rotation-alignment")==="map",Tt=z.get("text-pitch-alignment")==="map",Vt=V.get("symbol-z-offset"),Ht=z.get("symbol-elevation-reference")==="sea",nr=z.get("symbol-placement"),[br,zt]=z.get("text-size-scale-range"),[Nt,Zt]=z.get("icon-size-scale-range"),qt=a.aA(L,br,zt),ur=a.aA(L,Nt,Zt),Ar=z.get("text-variable-anchor"),qr=_t&&nr!=="point",Sr=It&&nr!=="point",wr=Ar&&O.hasTextData(),nn=O.hasIconTextFit()&&wr&&O.hasIconData();this.transform.setProjection(O.projection);const Jr=wr||qr,Rr=Sr||nn;let Vr=ot&&(st||!O.hasIconData()||ht),jn=st&&(ot||!O.hasTextData()||ct);const Kn=!Vt.isConstant();!O.collisionArrays&&Ee&&O.deserializeCollisionBoxes(Ee),b&&M&&O.updateCollisionDebugBuffers(this.transform.zoom,Ee,qt,ur);const Is=(on,ri,Hn)=>{const{crossTileID:pi,numVerticalGlyphVertices:Ai}=on;let _i=null;if(le&&le.dynamicFilterNeedsFeature||Kn){const za=this.retainedQueryData[O.bucketInstanceId];_i=mt.loadFeature({featureIndex:on.featureIndex,bucketIndex:za.bucketIndex,sourceLayerIndex:za.sourceLayerIndex,layoutVertexArrayOffset:0});const ro=_i.properties?_i.properties.worldview:null;if(O.localizable&&O.worldview&&typeof ro=="string")if(ro==="all")_i.properties.$localized=!0;else{if(!ro.split(",").includes(O.worldview))return;_i.properties.$localized=!0,_i.properties.worldview=O.worldview}}if(le&&!(0,le.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:O.worldview},_i,this.retainedQueryData[O.bucketInstanceId].tileID.canonical,new a.P(on.tileAnchorX,on.tileAnchorY),this.transform.calculateDistanceTileData(le.unwrappedTileID)))return this.placements[pi]=new yi(!1,!1,!1,!0),void p.add(pi);const ei=Vt.evaluate(_i,{});if(p.has(pi))return;if(Pe)return void(this.placements[pi]=new yi(!1,!1,!1));let ss=!1,hi=!1,Ia=!0,pa=!1,mi=!1,Zs=null,is={box:null,offscreen:null,occluded:null},sa={box:null},Ya=null,Na=null,$i=null,Yc=0,Xl=0,zo=0;Hn.textFeatureIndex?Yc=Hn.textFeatureIndex:on.useRuntimeCollisionCircles&&(Yc=on.featureIndex),Hn.verticalTextFeatureIndex&&(Xl=Hn.verticalTextFeatureIndex);const uc=O.elevationFeatures?O.elevationFeatures[on.elevationFeatureIndex]:void 0,hc=za=>{za.tileID=this.retainedQueryData[O.bucketInstanceId].tileID;const ro=this.transform.elevation;za.elevation=Ht?ei:ei+a.bV.getAtTileOffset(za.tileID,new a.P(za.tileAnchorX,za.tileAnchorY),ro,uc),za.elevation+=on.zOffset},Ll=Hn.textBox;if(Ll){hc(Ll);const za=Ui=>{let mo=a.bL.horizontal;if(O.allowVerticalPlacement&&!Ui&&this.prevPlacement){const Pa=this.prevPlacement.placedOrientations[pi];Pa&&(this.placedOrientations[pi]=Pa,mo=Pa,this.markUsedOrientation(O,mo,on))}return mo},ro=(Ui,mo)=>{if(O.allowVerticalPlacement&&Ai>0&&Hn.verticalTextBox){for(const Pa of O.writingModes)if(Pa===a.bL.vertical?(is=mo(),sa=is):is=Ui(),is&&is.box&&is.box.length)break}else is=Ui()};if(Ar){let Ui=Ar;if(this.prevPlacement&&this.prevPlacement.variableOffsets[pi]){const Sa=this.prevPlacement.variableOffsets[pi];Ui.indexOf(Sa.anchor)>0&&(Ui=Ui.filter(Xu=>Xu!==Sa.anchor),Ui.unshift(Sa.anchor))}const mo=(Sa,Xu,Av)=>{const Nh=O.getSymbolInstanceTextSize($e,on,this.transform.zoom,ri),Ev=(Sa.x2-Sa.x1)*Nh+2*Sa.padding,Dy=(Sa.y2-Sa.y1)*Nh+2*Sa.padding,gf=on.hasIconTextFit&&!st?Xu:null;gf&&hc(gf);let wp={box:[],offscreen:!1,occluded:!1};const Ry=ot?2*Ui.length:Ui.length;for(let zm=0;zm=Ui.length,on,ri,O,Av,gf,$e,Ke);if(jp&&(wp=jp.placedGlyphBoxes,wp&&wp.box&&wp.box.length)){ss=!0,Zs=jp.shift;break}}return wp};ro(()=>mo(Ll,Hn.iconBox,a.bL.horizontal),()=>{const Sa=Hn.verticalTextBox;return Sa&&hc(Sa),O.allowVerticalPlacement&&!(is&&is.box&&is.box.length)&&Ai>0&&Sa?mo(Sa,Hn.verticalIconBox,a.bL.vertical):{box:null,offscreen:null,occluded:null}}),is&&(ss=is.box,Ia=is.offscreen,pa=is.occluded);const Pa=za(!(!is||!is.box));if(!ss&&this.prevPlacement){const Sa=this.prevPlacement.variableOffsets[pi];Sa&&(this.variableOffsets[pi]=Sa,this.markUsedJustification(O,Sa.anchor,on,Pa))}}else{const Ui=(mo,Pa)=>{const Sa=O.getSymbolInstanceTextSize($e,on,this.transform.zoom,ri),Xu=this.collisionIndex.placeCollisionBox(O,Sa,mo,be,xe,Jr,new a.P(0,0),ot,de,Y,Ue.predicate);return Xu&&Xu.box&&Xu.box.length&&(this.markUsedOrientation(O,Pa,on),this.placedOrientations[pi]=Pa),Xu};ro(()=>Ui(Ll,a.bL.horizontal),()=>{const mo=Hn.verticalTextBox;return O.allowVerticalPlacement&&Ai>0&&mo?(hc(mo),Ui(mo,a.bL.vertical)):{box:null,offscreen:null,occluded:null}}),za(!!(is&&is.box&&is.box.length))}}if(Ya=is,ss=Ya&&Ya.box&&Ya.box.length>0,Ia=Ya&&Ya.offscreen,pa=Ya&&Ya.occluded,on.useRuntimeCollisionCircles){const za=on.centerJustifiedTextSymbolIndex>=0?on.centerJustifiedTextSymbolIndex:on.verticalPlacedTextSymbolIndex,ro=O.text.placedSymbolArray.get(za),Ui=a.bM(O.textSizeData,$e,ro),mo=z.get("text-padding");Na=this.collisionIndex.placeCollisionCircles(O,ot,ro,za,O.lineVertexArray,O.glyphOffsetArray,Ui,Y,Q,ce,b,Tt,Ue.predicate,on.collisionCircleDiameter*Ui/a.bY,mo,this.retainedQueryData[O.bucketInstanceId].tileID),ss=ot||Na.circles.length>0&&!Na.collisionDetected,Ia=Ia&&Na.offscreen,pa=Na.occluded}if(Hn.iconFeatureIndex&&(zo=Hn.iconFeatureIndex),Hn.iconBox){const za=ro=>{hc(ro);const Ui=on.hasIconTextFit&&Zs?ko(Zs.x,Zs.y,_t,Tt,this.transform.angle):new a.P(0,0),mo=O.getSymbolInstanceIconSize(Ke,this.transform.zoom,on.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(O,mo,ro,be,xe,Rr,Ui,st,de,Y,Ue.predicate)};sa&&sa.box&&sa.box.length&&Hn.verticalIconBox?($i=za(Hn.verticalIconBox),hi=$i.box.length>0):($i=za(Hn.iconBox),hi=$i.box.length>0),Ia=Ia&&$i.offscreen,mi=$i.occluded}const lu=ct||on.numHorizontalGlyphVertices===0&&Ai===0,Yu=ht||on.numIconVertices===0;if(lu||Yu?Yu?lu||(hi=hi&&ss):ss=hi&&ss:hi=ss=hi&&ss,ss&&Ya&&Ya.box&&this.collisionIndex.insertCollisionBox(Ya.box,z.get("text-ignore-placement"),O.bucketInstanceId,sa&&sa.box&&Xl?Xl:Yc,Ue.ID),hi&&$i&&this.collisionIndex.insertCollisionBox($i.box,z.get("icon-ignore-placement"),O.bucketInstanceId,zo,Ue.ID),Na&&(ss&&this.collisionIndex.insertCollisionCircles(Na.circles,z.get("text-ignore-placement"),O.bucketInstanceId,Yc,Ue.ID),b)){const za=O.bucketInstanceId;let ro=this.collisionCircleArrays[za];ro===void 0&&(ro=this.collisionCircleArrays[za]=new ok);for(let Ui=0;Ui=0;--ri){const Hn=on[ri];Is(O.symbolInstances.get(Hn),Hn,O.collisionArrays[Hn])}O.hasAnyZOffset&&a.w(`${O.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(O.hasAnyZOffset){const on=O.getSortedIndexesByZOffset();for(let ri=0;ri=0&&(d.text.placedSymbolArray.get(L).crossTileID=ce>=0&&L!==ce?0:Y),O>=0&&(d.text.placedSymbolArray.get(O).crossTileID=ce>=0&&O!==ce?0:Y),z>=0&&(d.text.placedSymbolArray.get(z).crossTileID=ce>=0&&z!==ce?0:Y),V>=0&&(d.text.placedSymbolArray.get(V).crossTileID=ce>=0&&V!==ce?0:Y)}markUsedOrientation(d,p,b){const M=p===a.bL.horizontal||p===a.bL.horizontalOnly?p:0,L=p===a.bL.vertical?p:0,{leftJustifiedTextSymbolIndex:O,centerJustifiedTextSymbolIndex:z,rightJustifiedTextSymbolIndex:V,verticalPlacedTextSymbolIndex:Y}=b,Q=d.text.placedSymbolArray;O>=0&&(Q.get(O).placedOrientation=M),z>=0&&(Q.get(z).placedOrientation=M),V>=0&&(Q.get(V).placedOrientation=M),Y>=0&&(Q.get(Y).placedOrientation=L)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const p=this.prevPlacement;let b=!1;this.prevZoomAdjustment=p?p.zoomAdjustment(this.transform.zoom):0;const M=p?p.symbolFadeChange(d):1,L=p?p.opacities:{},O=p?p.variableOffsets:{},z=p?p.placedOrientations:{};for(const V in this.placements){const Y=this.placements[V],Q=L[V];Q?(this.opacities[V]=new of(Q,M,Y.text,Y.icon,null,Y.clipped),b=b||Y.text!==Q.text.placed||Y.icon!==Q.icon.placed):(this.opacities[V]=new of(null,M,Y.text,Y.icon,Y.skipFade,Y.clipped),b=b||Y.text||Y.icon)}for(const V in L){const Y=L[V];if(!this.opacities[V]){const Q=new of(Y,M,!1,!1);Q.isHidden()||(this.opacities[V]=Q,b=b||Y.text.placed||Y.icon.placed)}}for(const V in O)this.variableOffsets[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.variableOffsets[V]=O[V]);for(const V in z)this.placedOrientations[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.placedOrientations[V]=z[V]);b?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=p?p.lastPlacementChangeTime:d)}updateLayerOpacities(d,p,b,M){M&&(this.lastReplacementSourceUpdateTime=M.updateTime);const L=new Set;for(const O of p){const z=O.getBucket(d);z&&O.latestFeatureIndex&&d.fqid===z.layerIds[0]&&(this.updateBucketOpacities(z,L,O,O.collisionBoxArray,b,M,O.tileID,d.scope),z.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(z,O.tileID),z.elevationType==="road"&&z.updateRoadElevation(O.tileID.canonical),z.updateZOffset())}}updateBucketOpacities(d,p,b,M,L,O,z,V){d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();const Y=d.layers[0].layout,Q=d.layers[0].paint,ce=!!d.layers[0].dynamicFilter(),le=new of(null,0,!1,!1,!0),de=Y.get("text-allow-overlap"),be=Y.get("icon-allow-overlap"),xe=Y.get("text-variable-anchor"),Pe=Y.get("text-rotation-alignment")==="map",Ee=Y.get("text-pitch-alignment")==="map",$e=Q.get("symbol-z-offset"),Ke=Y.get("symbol-elevation-reference")==="sea",Ue=!$e.isConstant(),mt=new of(null,0,de&&(be||!d.hasIconData()||Y.get("icon-optional")),be&&(de||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&M&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(M);const ct=(ot,st,_t)=>{for(let It=0;It0||It>0,Ar=Vt>0,qr=this.placedOrientations[Tt],Sr=qr===a.bL.vertical,wr=qr===a.bL.horizontal||qr===a.bL.horizontalOnly;!ur&&!Ar||qt.isHidden()||ht++;let nn=!1;if((ur||Ar)&&O)for(const Jr of d.activeReplacements){if(a.bZ(Jr,L,a.b_.Symbol,V)||Jr.min.x>Ht||Ht>Jr.max.x||Jr.min.y>nr||nr>Jr.max.y)continue;const Rr=a.b$(Ht,nr,z.canonical,Jr.footprintTileId.canonical);if(nn=a.c0(Rr,Jr.footprint),nn)break}if(ur){const Jr=nn?Fg:Wc(qt.text);ct(d.text,_t,Sr?Fg:Jr),ct(d.text,It,wr?Fg:Jr);const Rr=qt.text.isHidden(),{leftJustifiedTextSymbolIndex:Vr,centerJustifiedTextSymbolIndex:jn,rightJustifiedTextSymbolIndex:Kn,verticalPlacedTextSymbolIndex:Is}=st,ci=d.text.placedSymbolArray,on=Rr||Sr?1:0;Vr>=0&&(ci.get(Vr).hidden=on),jn>=0&&(ci.get(jn).hidden=on),Kn>=0&&(ci.get(Kn).hidden=on),Is>=0&&(ci.get(Is).hidden=Rr||wr?1:0);const ri=this.variableOffsets[Tt];ri&&this.markUsedJustification(d,ri.anchor,st,qr);const Hn=this.placedOrientations[Tt];Hn&&(this.markUsedJustification(d,"left",st,Hn),this.markUsedOrientation(d,Hn,st))}if(Ar){const Jr=nn?Fg:Wc(qt.icon),{placedIconSymbolIndex:Rr,verticalPlacedIconSymbolIndex:Vr}=st,jn=d.icon.placedSymbolArray,Kn=qt.icon.isHidden()?1:0;Rr>=0&&(ct(d.icon,Vt,Sr?Fg:Jr),jn.get(Rr).hidden=Kn),Vr>=0&&(ct(d.icon,st.numVerticalIconVertices,wr?Fg:Jr),jn.get(Vr).hidden=Kn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const Jr=d.collisionArrays[ot];if(Jr){let Rr=new a.P(0,0),Vr=!0;if(Jr.textBox||Jr.verticalTextBox){if(xe){const Kn=this.variableOffsets[Tt];Kn?(Rr=cc(Kn.anchor,Kn.width,Kn.height,Kn.textOffset,Kn.textScale),Pe&&Rr._rotate(Ee?this.transform.angle:-this.transform.angle)):Vr=!1}ce&&(Vr=!qt.clipped),Jr.textBox&&km(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Vr||Sr,Nt,Ke,Rr.x,Rr.y),Jr.verticalTextBox&&km(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Vr||wr,Nt,Ke,Rr.x,Rr.y)}const jn=Vr&&!!(!wr&&Jr.verticalIconBox);Jr.iconBox&&km(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,jn,Nt,Ke,st.hasIconTextFit?Rr.x:0,st.hasIconTextFit?Rr.y:0),Jr.verticalIconBox&&km(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,!jn,Nt,Ke,st.hasIconTextFit?Rr.x:0,st.hasIconTextFit?Rr.y:0)}}}if(d.fullyClipped=ht===0,d.sortFeatures(this.transform.angle),this.retainedQueryData[d.bucketInstanceId]&&(this.retainedQueryData[d.bucketInstanceId].featureSortOrder=d.featureSortOrder),d.hasTextData()&&d.text.opacityVertexBuffer&&d.text.opacityVertexBuffer.updateData(d.text.opacityVertexArray),d.hasIconData()&&d.icon.opacityVertexBuffer&&d.icon.opacityVertexBuffer.updateData(d.icon.opacityVertexArray),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexBuffer&&d.iconCollisionBox.collisionVertexBuffer.updateData(d.iconCollisionBox.collisionVertexArray),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexBuffer&&d.textCollisionBox.collisionVertexBuffer.updateData(d.textCollisionBox.collisionVertexArray),d.bucketInstanceId in this.collisionCircleArrays){const ot=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ot.invProjMatrix,d.placementViewportMatrix=ot.viewportMatrix,d.collisionCircleArray=ot.circles,delete this.collisionCircleArrays[d.bucketInstanceId]}}symbolFadeChange(d){return this.fadeDuration===0?1:(d-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(d){return Math.max(0,(this.transform.zoom-d)/1.5)}hasTransitions(d){return this.stale||d-this.lastPlacementChangeTimed}isStale(){return this.stale}setStale(){this.stale=!0}}function km(_,d,p,b,M,L,O){_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0),_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0),_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0),_.emplaceBack(d?1:0,p?1:0,L||0,O||0,b,M?1:0)}const S5=Math.pow(2,25),nv=Math.pow(2,24),lk=Math.pow(2,17),C5=Math.pow(2,16),ck=Math.pow(2,9),Hc=Math.pow(2,8),cp=Math.pow(2,1);function Wc(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const d=_.placed?1:0,p=Math.floor(127*_.opacity);return p*S5+d*nv+p*lk+d*C5+p*ck+d*Hc+p*cp+d}const Fg=0;class fy{constructor(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(d,p,b,M,L,O){const z=this._bucketParts;for(;this._currentTileIndexV.sortKey-Y.sortKey));this._currentPartIndex{const V=a.o.now()-O;return!this._forceFullPlacement&&V>2};for(;this._currentPlacementIndex>=0;){const V=p[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&V.visibility!=="none"&&(!V.minzoom||V.minzoom<=Y)&&(!V.maxzoom||V.maxzoom>Y)){const Q=V,ce=Q.layout.get("symbol-z-elevate"),le=Q.layout.get("symbol-sort-key").constantOr(1)!==void 0,de=Q.layout.get("symbol-z-order"),be=de==="viewport-y"||de==="auto"&&!(de!=="viewport-y"&&le),xe=Q.layout.get("text-allow-overlap")||Q.layout.get("icon-allow-overlap")||Q.layout.get("text-ignore-placement")||Q.layout.get("icon-ignore-placement"),Pe=be&&xe,Ee=this._inProgressLayer=this._inProgressLayer||new fy(Q),$e=a.B(V.source,V.scope);if(Ee.continuePlacement(ce||Pe?M[$e]:b[$e],this.placement,this._showCollisionBoxes,V,z,L))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const Vu=512/a.al/2;class dp{constructor(d,p,b){this.tileID=d,this.bucketInstanceId=b,this.index=new a.c4(p.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const M=d.canonical.x*a.al,L=d.canonical.y*a.al;for(let O=0;OPe-Ee);for(const Pe of xe){const Ee=this.crossTileIDs[Pe];if(this.keys[Pe]===Q&&!b.has(Ee)){b.add(Ee),Y.crossTileID=Ee;break}}}}}class el{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class M5{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const p=Math.round((d-this.lng)/360);if(p!==0)for(const b in this.indexes){const M=this.indexes[b],L={};for(const O in M){const z=M[O];z.tileID=z.tileID.unwrapTo(z.tileID.wrap+p),L[z.tileID.key]=z}this.indexes[b]=L}this.lng=d}addBucket(d,p,b){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===p.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let L=0;Ld.overscaledZ)for(const z in O){const V=O[z];V.tileID.isChildOf(d)&&V.findMatches(p.symbolInstances,d,M)}else{const z=O[d.scaledTo(Number(L)).key];z&&z.findMatches(p.symbolInstances,d,M)}}for(let L=0;L{p[b]=!0});for(const b in this.layerIndexes)p[b]||delete this.layerIndexes[b]}}const lf=771;class ns{constructor(d,p,b,M){this.blendFunction=d,this.blendColor=p.toNonPremultipliedRenderColor(null),this.mask=b,this.blendEquation=M}}ns.Replace=[1,0,1,0],ns.disabled=new ns(ns.Replace,a.ao.transparent,[!1,!1,!1,!1]),ns.unblended=new ns(ns.Replace,a.ao.transparent,[!0,!0,!0,!0]),ns.alphaBlended=new ns([1,lf,1,lf],a.ao.transparent,[!0,!0,!0,!0]),ns.alphaBlendedNonPremultiplied=new ns([770,lf,770,lf],a.ao.transparent,[!0,!0,!0,!0]),ns.multiply=new ns([774,0,774,0],a.ao.transparent,[!0,!0,!0,!0]),ns.additive=new ns([1,1,1,1],a.ao.transparent,[!0,!0,!0,!0]);class cn{constructor(d,p,b){this.func=d,this.mask=p,this.range=b}}cn.ReadOnly=!1,cn.ReadWrite=!0,cn.disabled=new cn(519,cn.ReadOnly,[0,1]);const dk=7680;class zn{constructor(d,p,b,M,L,O){this.test=d,this.ref=p,this.mask=b,this.fail=M,this.depthFail=L,this.pass=O}}zn.disabled=new zn({func:519,mask:0},0,0,dk,dk,dk);const py=1029,uk=2305;class Fn{constructor(d,p,b){this.enable=d,this.mode=p,this.frontFace=b}}function cf(_,d){const p=a.ca(_,3);a.cc(_,d),a.cg(_,3,p)}function T5(_,d){const p=a.c7([]);return a.c8(p,p,-d),a.c9(p,p,-_),p}function hk(_,d){const p=[_[0],_[1],0],b=[d[0],d[1],0];if(a.ag(p)>=1e-15){const O=a.aw([],p);a.c5(b,O,a.bJ(b,O)),d[0]=b[0],d[1]=b[1]}const M=a.bI([],d,_);if(a.c6(M)<1e-15)return null;const L=Math.atan2(-M[1],M[0]);return T5(Math.atan2(Math.sqrt(_[0]*_[0]+_[1]*_[1]),-_[2]),L)}Fn.disabled=new Fn(!1,py,uk),Fn.backCCW=new Fn(!0,py,uk),Fn.backCW=new Fn(!0,py,2304),Fn.frontCW=new Fn(!0,1028,2304),Fn.frontCCW=new Fn(!0,1028,uk);class Gc{constructor(d,p){this.position=d,this.orientation=p}get position(){return this._position}set position(d){if(d){const p=d instanceof a.ae?d:new a.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(p.x=a.bT(p.x,0,1)),this._position=p}else this._position=null}lookAtPoint(d,p,b){if(this.orientation=null,!this.position)return;const M=this.position,L=b||(this._elevation?this._elevation.getAtPointOrZero(a.ae.fromLngLat(d)):0),O=a.ae.fromLngLat(d,L),z=[O.x-M.x,O.y-M.y,O.z-M.z];p||(p=[0,0,1]),p[2]=Math.abs(p[2]),this.orientation=hk(z,p)}setPitchBearing(d,p){this.orientation=T5(a.an(d),a.an(-p))}}class fk{constructor(d,p){this._transform=a.bA([]),this.orientation=p,this.position=d}get mercatorPosition(){const d=this.position;return new a.ae(d[0],d[1],d[2])}get position(){const d=a.ca(this._transform,3);return[d[0],d[1],d[2]]}set position(d){var p;d&&a.cg(this._transform,3,[(p=d)[0],p[1],p[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||a.c7([]),d&&cf(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),p=this.right();return{bearing:Math.atan2(-p[1],p[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,p){this._orientation=T5(d,p),cf(this._transform,this._orientation)}forward(){const d=a.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=a.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=a.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,p){const b=new Float64Array(16);return a.bl(b,this.getWorldToCamera(d,p)),b}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,p,b){const M=this.position;a.c5(M,M,-d);const L=new Float64Array(16);return a.bq(L,[b,b,b]),a.br(L,L,M),L[10]*=p,L}getWorldToCamera(d,p){const b=new Float64Array(16),M=new Float64Array(4),L=this.position;return a.cb(M,this._orientation),a.c5(L,L,-d),a.cc(b,M),a.br(b,b,L),b[1]*=-1,b[5]*=-1,b[9]*=-1,b[13]*=-1,b[8]*=p,b[9]*=p,b[10]*=p,b[11]*=p,b}getCameraToClipPerspective(d,p,b,M){const L=new Float64Array(16);return a.cd(L,d,p,b,M),L}getCameraToClipOrthographic(d,p,b,M,L,O){const z=new Float64Array(16);return a.ce(z,d,p,b,M,L,O),z}getDistanceToElevation(d,p=!1){const b=d===0?0:a.cf(d,p?a.a$(this.position[1]):this.position[1]),M=this.forward();return(b-this.position[2])/M[2]}clone(){return new fk([...this.position],[...this.orientation])}}const wl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class pk{constructor(d=0,p=0,b=0,M=0){if(isNaN(d)||d<0||isNaN(p)||p<0||isNaN(b)||b<0||isNaN(M)||M<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=p,this.left=b,this.right=M}interpolate(d,p,b){return p.top!=null&&d.top!=null&&(this.top=a.ak(d.top,p.top,b)),p.bottom!=null&&d.bottom!=null&&(this.bottom=a.ak(d.bottom,p.bottom,b)),p.left!=null&&d.left!=null&&(this.left=a.ak(d.left,p.left,b)),p.right!=null&&d.right!=null&&(this.right=a.ak(d.right,p.right,b)),this}getCenter(d,p){const b=a.aA((this.left+d-this.right)/2,0,d),M=a.aA((this.top+p-this.bottom)/2,0,p);return new a.P(b,M)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new pk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const bh=15;class A5{constructor(d,p,b,M,L,O,z){this.tileSize=512,this._renderWorldCopies=L===void 0||L,this._minZoom=d||0,this._maxZoom=p||22,this._minPitch=b??0,this._maxPitch=M??60,this.setProjection(O),this.setMaxBounds(z),this.width=0,this.height=0,this._center=new a.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 pk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new fk,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const d=new A5(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return d._elevation=this._elevation,d._centerAltitude=this._centerAltitude,d._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,d.tileSize=this.tileSize,d.mercatorFromTransition=this.mercatorFromTransition,d.width=this.width,d.height=this.height,d.cameraElevationReference=this.cameraElevationReference,d._center=this._center,d._setZoom(this.zoom),d._seaLevelZoom=this._seaLevelZoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._nearZ=this._nearZ,d._farZ=this._farZ,d._averageElevation=this._averageElevation,d._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._camera=this._camera.clone(),d._calcMatrices(),d.freezeTileCoverage=this.freezeTileCoverage,d.frustumCorners=this.frustumCorners,d._allowWorldUnderZoom=this._allowWorldUnderZoom,d}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!p||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const b=this._elevation;p||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&b.exaggeration()&&this._centerAltitudeValidForExaggeration!==b.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*b.exaggeration(),this._centerAltitudeValidForExaggeration=b.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=b.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const d=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(d)}sampleAverageElevation(){if(!this._elevation)return 0;const d=this._elevation,p=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],b=this.horizonLineFromTop();let M=0,L=0;for(let O=0;O{const Pe=a.cY(le,ce,de,be,xe);V.has(Pe)||(L.push(new a.aQ(ce,le,de,be,xe)),V.add(Pe))};for(let ce=0;cele.canonical.z)continue;const de=le.canonical,be=le.overscaledZ,xe=le.wrap,Pe=1<0,Ke=de.y+10,mt=le.wrap-($e?0:1),ct=le.wrap+(Ee?0:1),ht=$e?de.x-1:Pe-1,ot=Ee?de.x+1:0;if(O)b[0]<0?(Y(be,ct,de.z,ot,de.y),b[1]<0&&Ke&&(Y(be,xe,de.z,de.x,de.y+1),Y(be,ct,de.z,ot,de.y+1)),b[1]>0&&Ue&&(Y(be,xe,de.z,de.x,de.y-1),Y(be,ct,de.z,ot,de.y-1))):b[0]>0?(Y(be,mt,de.z,ht,de.y),b[1]<0&&Ke&&(Y(be,xe,de.z,de.x,de.y+1),Y(be,mt,de.z,ht,de.y+1)),b[1]>0&&Ue&&(Y(be,xe,de.z,de.x,de.y-1),Y(be,mt,de.z,ht,de.y-1))):b[1]<0&&Ke?Y(be,xe,de.z,de.x,de.y+1):Ue&&Y(be,xe,de.z,de.x,de.y-1);else{const st=le.visibleQuadrants;1&st&&(Y(be,mt,de.z,ht,de.y),Ue&&(Y(be,xe,de.z,de.x,de.y-1),Y(be,mt,de.z,ht,de.y-1))),2&st&&(Y(be,ct,de.z,ot,de.y),Ue&&(Y(be,xe,de.z,de.x,de.y-1),Y(be,ct,de.z,ot,de.y-1))),4&st&&(Y(be,mt,de.z,ht,de.y),Ke&&(Y(be,xe,de.z,de.x,de.y+1),Y(be,mt,de.z,ht,de.y+1))),8&st&&(Y(be,ct,de.z,ot,de.y),Ke&&(Y(be,xe,de.z,de.x,de.y+1),Y(be,ct,de.z,ot,de.y+1)))}}const Q=[];for(const ce of L)L.some(le=>ce.isChildOf(le))||Q.push(ce);if(L=Q.filter(ce=>!d.some(le=>!!(ce.overscaledZ{const Ee=Pe.canonical.x+.5-de[0],$e=Pe.canonical.y+.5-de[1];return Ee*Ee+$e*$e{const ht=a.cY(Ke,$e,Ue,mt,ct);L.has(ht)||(M.push(new a.aQ($e,Ke,Ue,mt,ct)),L.add(ht))},z=d.reduce(($e,Ke)=>Math.max($e,Ke.overscaledZ),b),V=1<{const Ue=Math.floor($e[0]),mt=Math.floor($e[1]),ct=($e[0]-Ue)*a.al,ht=($e[1]-mt)*a.al,ot=Math.floor(Ke[0]),st=Math.floor(Ke[1]),_t=(Ke[0]-ot)*a.al,It=(Ke[1]-st)*a.al;for(let Tt=-1;Tt<=1;Tt++){const Vt=Ue+Tt;if(!(Vt<0||Vt>=V)){Q.x=ct-Tt*a.al,ce.x=_t-(Vt-ot)*a.al;for(let Ht=-1;Ht<=1;Ht++){const nr=mt+Ht;Q.y=ht-Ht*a.al,ce.y=It-(nr-st)*a.al,a.cZ(Q,ce,Y)&&O(z,0,b,Vt,nr)}}}},de=p.points,be=de[a.cv],xe=de[a.cw],Pe=this._projectToGround(be,de[a.cx]),Ee=this._projectToGround(xe,de[a.cy]);return le(be,Pe),le(xe,Ee),M}_projectToGround(d,p){return a.cz(a.cA(),d,p,d[2]/(d[2]-p[2]))}coveringTiles(d){let p=this.coveringZoomLevel(d);const b=p,M=this.elevation&&this.elevation.exaggeration(),L=M&&!d.isTerrainDEM,O=this.projection.name==="mercator";if(d.minzoom!==void 0&&pd.maxzoom&&(p=d.maxzoom);const z=this.locationCoordinate(this.center),V=this.center.lat,Y=1<{const qt=new a.ae(Nt.x+25e-6,Nt.y,Nt.z),ur=new a.ae(Nt.x,Nt.y+25e-6,Nt.z),Ar=Nt.toLngLat(),qr=qt.toLngLat(),Sr=ur.toLngLat(),wr=this.locationCoordinate(Ar),nn=this.locationCoordinate(qr),Jr=this.locationCoordinate(Sr),Rr=Math.hypot(nn.x-wr.x,nn.y-wr.y),Vr=Math.hypot(Jr.x-wr.x,Jr.y-wr.y);return Math.sqrt(Rr*Vr)*ht/25e-6},st=Nt=>{const Zt=mt,qt=ct;return{aabb:a.cF(this,Y,0,0,0,Nt,qt,Zt,this.projection),zoom:0,x:0,y:0,minZ:qt,maxZ:Zt,wrap:Nt,fullyVisible:!1}},_t=[];let It=[];const Tt=p,Vt=d.reparseOverscaled?b:p,Ht=(Pe-this._centerAltitude)*xe,nr=Nt=>{if(!this._elevation||!Nt.tileID||!O)return;const Zt=this._elevation.getMinMaxForTile(Nt.tileID),qt=Nt.aabb;Zt?(qt.min[2]=Zt.min,qt.max[2]=Zt.max,qt.center[2]=(qt.min[2]+qt.max[2])/2):(Nt.shouldSplit=zt(Nt),Nt.shouldSplit||(qt.min[2]=qt.max[2]=qt.center[2]=this._centerAltitude))},br=(Nt,Zt)=>{if(.707*Zt{if(Nt.zoom=.9)return!0}else if(L&&(ur=Nt.aabb.distanceZ(Ee)*xe),this.projection.isReprojectedInTileSpace&&b<=5){const Vr=Math.pow(2,Nt.zoom),jn=ot(new a.ae((Nt.x+.5)/Vr,(Nt.y+.5)/Vr));Ar=jn>.85?1:jn}if(!O&&!ce){const Vr=Math.sqrt(Zt*Zt+qt*qt+ur*ur);let jn=(1<0;){const Nt=_t.pop(),Zt=Nt.x,qt=Nt.y;let ur=Nt.fullyVisible;const Ar=()=>this.projection.name==="globe"&&(Nt.y===0||Nt.y===(1<>1),nn={aabb:O?Nt.aabb.quadrant(qr):a.cF(this,Y,Nt.zoom+1,Sr,wr,Nt.wrap,Nt.minZ,Nt.maxZ,this.projection),zoom:Nt.zoom+1,x:Sr,y:wr,wrap:Nt.wrap,fullyVisible:ur,tileID:void 0,shouldSplit:void 0,minZ:Nt.minZ,maxZ:Nt.maxZ};L&&!ce&&(nn.tileID=new a.aQ(Nt.zoom+1===Tt?Vt:Nt.zoom+1,Nt.wrap,Nt.zoom+1,Sr,wr),nr(nn)),_t.push(nn)}else{const qr=Nt.zoom===Tt?Vt:Nt.zoom;if(d.minzoom&&d.minzoom>qr)continue;let Sr=0;if(!ur){let Rr=$e?Nt.aabb.intersectsPrecise(de):Nt.aabb.intersectsPreciseFlat(de);if(Rr===0&&Ar()){const Vr=new a.cD(Nt.zoom,Zt,qt);Rr=a.cE(this,Y,Vr,!0).intersectsPrecise(de)}if(Rr===0)continue;if(d.calculateQuadrantVisibility)if(de.containsPoint(Nt.aabb.center))Sr=15;else for(let Vr=0;Vr<4;Vr++)Nt.aabb.quadrant(Vr).intersects(de)!==0&&(Sr|=1<{const ur=[0,0,0,1],Ar=[a.al,a.al,0,1],qr=this.calculateFogTileMatrix(qt.tileID.toUnwrapped());a.aC(ur,ur,qr),a.aC(Ar,Ar,qr);const Sr=a.cG([],ur,Ar),wr=a.cH([],ur,Ar),nn=a.c$(Sr,wr);if(nn===0)return!0;let Jr=!1;const Rr=this._elevation;if(Rr&&nn>Nt&&Zt!==0){const Vr=this.calculateProjMatrix(qt.tileID.toUnwrapped());let jn;d.isTerrainDEM||(jn=Rr.getMinMaxForTile(qt.tileID)),jn||(jn={min:ct,max:mt});const Kn=a.cI(this.rotation),Is=[Kn[0]*a.al,Kn[1]*a.al,jn.max];a.af(Is,Is,Vr),Jr=(1-Is[1])*this.height*.5Nt.distanceSq-Zt.distanceSq).map(Nt=>Nt.tileID)}resize(d,p){this.width=d,this.height=p,this.pixelsToGLUnits=[2/d,-2/p],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log2(d)}project(d){const p=a.aA(d.lat,-a.cJ,a.cJ),b=this.projection.project(d.lng,p);return new a.P(b.x*this.worldSize,b.y*this.worldSize)}unproject(d){return this.projection.unproject(d.x/this.worldSize,d.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,p){let b,M;const L=this.centerPoint;if(this.projection.name==="globe"){const z=this.worldSize;b=(p.x-L.x)/z,M=(p.y-L.y)/z}else{const z=this.pointCoordinate(p),V=this.pointCoordinate(L);b=z.x-V.x,M=z.y-V.y}const O=this.locationCoordinate(d);this.setLocation(new a.ae(O.x-b,O.y-M))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,p){return this.projection.locationPoint(this,d,p)}locationPoint3D(d,p){return this.projection.locationPoint(this,d,p,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,p){return this.coordinateLocation(this.pointCoordinate3D(d,p))}locationCoordinate(d,p){const b=p?a.cf(p,d.lat):void 0,M=this.projection.project(d.lng,d.lat);return new a.ae(M.x,M.y,b)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,p){const b=p??this._centerAltitude,M=[d.x,d.y,0,1],L=[d.x,d.y,1,1];a.aC(M,M,this.pixelMatrixInverse),a.aC(L,L,this.pixelMatrixInverse);const O=L[3];a.cK(M,M,1/M[3]),a.cK(L,L,1/O);const z=M[2],V=L[2];return{p0:M,p1:L,t:z===V?0:(b-z)/(V-z)}}screenPointToMercatorRay(d){const p=[d.x,d.y,0,1],b=[d.x,d.y,1,1];return a.aC(p,p,this.pixelMatrixInverse),a.aC(b,b,this.pixelMatrixInverse),a.cK(p,p,1/p[3]),a.cK(b,b,1/b[3]),p[2]=a.cf(p[2],this._center.lat)*this.worldSize,b[2]=a.cf(b[2],this._center.lat)*this.worldSize,a.cK(p,p,1/this.worldSize),a.cK(b,b,1/this.worldSize),new a.ax([p[0],p[1],p[2]],a.aw([],a.av([],b,p)))}rayIntersectionCoordinate(d){const{p0:p,p1:b,t:M}=d,L=a.cf(p[2],this._center.lat),O=a.cf(b[2],this._center.lat);return new a.ae(a.ak(p[0],b[0],M)/this.worldSize,a.ak(p[1],b[1],M)/this.worldSize,a.ak(L,O,M))}pointCoordinate(d,p=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,p)}pointCoordinate3D(d,p){if(!this.elevation)return this.pointCoordinate(d,p);let b=this.projection.pointCoordinate3D(this,d.x,d.y);if(b)return new a.ae(b[0],b[1],b[2]);let M=0,L=this.horizonLineFromTop();if(d.y>L)return this.pointCoordinate(d,p);const O=.02*L,z=d.clone();for(let V=0;V<10&&L-M>O;V++){z.y=a.ak(M,L,.66);const Y=this.projection.pointCoordinate3D(this,z.x,z.y);Y?(L=z.y,b=Y):M=z.y}return b?new a.ae(b[0],b[1],b[2]):this.pointCoordinate(d)}isPointAboveHorizon(d){return this.projection.isPointAboveHorizon(this,d)}isPointOnSurface(d){if(d.y<0||d.y>this.height||d.x<0||d.x>this.width)return!1;if(this.elevation||this.zoom>=a.cL)return!this.isPointAboveHorizon(d);const p=this.pointCoordinate(d);return p.y>=0&&p.y<=1}_coordinatePoint(d,p){const b=p&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,M=[d.x*this.worldSize,d.y*this.worldSize,b+d.toAltitude(),1];return a.aC(M,M,this.pixelMatrix),M[3]>0?new a.P(M[0]/M[3],M[1]/M[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:p}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,M=this.width-this._edgeInsets.right,L=this.pointLocation3D(new a.P(p,d)),O=this.pointLocation3D(new a.P(M,d)),z=this.pointLocation3D(new a.P(M,b)),V=this.pointLocation3D(new a.P(p,b));let Y=Math.min(L.lng,O.lng,z.lng,V.lng),Q=Math.max(L.lng,O.lng,z.lng,V.lng),ce=Math.min(L.lat,O.lat,z.lat,V.lat),le=Math.max(L.lat,O.lat,z.lat,V.lat);const de=Math.pow(2,-this.zoom)/16*270,be=this.projection.name==="globe"?1:4,xe=(Pe,Ee,$e,Ke,Ue)=>{const mt=(Pe+$e)/2,ct=(Ee+Ke)/2,ht=new a.P(mt,ct),{lng:ot,lat:st}=this.pointLocation3D(ht),_t=Math.max(0,Y-ot,ce-st,ot-Q,st-le);Y=Math.min(Y,ot),Q=Math.max(Q,ot),ce=Math.min(ce,st),le=Math.max(le,st),(Uede)&&(xe(Pe,Ee,mt,ct,Ue+1),xe(mt,ct,$e,Ke,Ue+1))};if(xe(p,d,M,d,1),xe(M,d,M,b,1),xe(M,b,p,b,1),xe(p,b,p,d,1),this.projection.name==="globe"){const[Pe,Ee]=a.cM(this);Pe?(le=90,Q=180,Y=-180):Ee&&(ce=-90,Q=180,Y=-180)}return new a.aI(new a.aT(Y,ce),new a.aT(Q,le))}_getBoundsRectangular(d,p){const{top:b,left:M}=this._edgeInsets,L=this.height-this._edgeInsets.bottom,O=this.width-this._edgeInsets.right,z=new a.P(M,b),V=new a.P(O,b),Y=new a.P(O,L),Q=new a.P(M,L);let ce=this.pointCoordinate(z,d),le=this.pointCoordinate(V,d);const de=this.pointCoordinate(Y,p),be=this.pointCoordinate(Q,p),xe=(Pe,Ee)=>(Ee.y-Pe.y)/(Ee.x-Pe.x);return ce.y>1&&le.y>=0?ce=new a.ae((1-be.y)/xe(be,ce)+be.x,1):ce.y<0&&le.y<=1&&(ce=new a.ae(-be.y/xe(be,ce)+be.x,0)),le.y>1&&ce.y>=0?le=new a.ae((1-de.y)/xe(de,le)+de.x,1):le.y<0&&ce.y<=1&&(le=new a.ae(-de.y/xe(de,le)+de.x,0)),new a.aI().extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(le)).extend(this.coordinateLocation(be)).extend(this.coordinateLocation(de))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const p=d.visibleDemTiles.reduce((b,M)=>{if(M.dem){const L=M.dem.tree;b.min=Math.min(b.min,L.minimums[0]),b.max=Math.max(b.max,L.maximums[0])}return b},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(p.min*d.exaggeration(),p.max*d.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(d=!0){const p=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,b=this.height/2-p*(1-this._horizonShift);return d?Math.max(0,b):b}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-a.cJ,this.maxLat=a.cJ,this.minLng=-180,this.maxLng=180,d&&(this.minLat=d.getSouth(),this.maxLat=d.getNorth(),this.minLng=d.getWest(),this.maxLng=d.getEast(),this.maxLngce&&(z=ce-Y),ce-Qde&&(O=de-V),de-le{for(let zt=0;zt<16;zt++)Vt[zt]=a.ak(Ht[zt],nr[zt],br)})(z,z,V,a.d0(this.pitch>=bh?1:this.pitch/bh))}else z=V;const Y=a.cP([],V,O);let Q=a.cP([],z,O);if(this.projection.isReprojectedInTileSpace){const st=this.locationCoordinate(this.center),_t=a.bA([]);a.br(_t,_t,[st.x*this.worldSize,st.y*this.worldSize,0]),a.aB(_t,_t,a.cQ(this)),a.br(_t,_t,[-st.x*this.worldSize,-st.y*this.worldSize,0]),a.aB(Q,Q,_t),a.aB(Y,Y,_t),this.inverseAdjustmentMatrix=a.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.cS([],Q,[this.worldSize,this.worldSize,this.worldSize/L,1]),this.projMatrix=Q,this.invProjMatrix=a.bl(new Float64Array(16),this.projMatrix),p){const st=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);st[8]=2*-d.x/this.width,st[9]=2*d.y/this.height,this.expandedFarZProjMatrix=a.cP([],st,O)}else this.expandedFarZProjMatrix=this.projMatrix;const ce=a.bl([],z);this.frustumCorners=a.cT.fromInvProjectionMatrix(ce,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!p);const le=new Float32Array(16);a.bA(le),a.cS(le,le,[1,-1,1]),a.cU(le,le,this._pitch),a.bB(le,le,this.angle);const de=a.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.bz(de);const be=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;de[8]=2*-d.x/this.width,de[9]=2*(d.y+be)/this.height,this.skyboxMatrix=a.aB(le,de,le);const xe=this.point,Pe=xe.x,Ee=xe.y,$e=this.width%2/2,Ke=this.height%2/2,Ue=Math.cos(this.angle),mt=Math.sin(this.angle),ct=Pe-Math.round(Pe)+Ue*$e+mt*Ke,ht=Ee-Math.round(Ee)+Ue*Ke+mt*$e,ot=new Float64Array(Q);if(a.br(ot,ot,[ct>.5?ct-1:ct,ht>.5?ht-1:ht,0]),this.alignedProjMatrix=ot,Q=a.bC(),a.cS(Q,Q,[this.width/2,-this.height/2,1]),a.br(Q,Q,[1,-1,0]),this.labelPlaneMatrix=Q,Q=a.bC(),a.cS(Q,Q,[1,-1,1]),a.br(Q,Q,[-1,-1,0]),a.cS(Q,Q,[2/this.width,2/this.height,1]),this.glCoordMatrix=Q,this.pixelMatrix=a.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},Q=a.bl(new Float64Array(16),this.pixelMatrix),!Q)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=Q,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.cV(this);const st=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.af(st,st,O),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=Q;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,p=this.cameraPixelsPerMeter,b=this._camera.position,M=1/this.height/this._pixelsPerMercatorPixel,L=[d,d,p];a.c5(L,L,M),a.c5(b,b,-1),a.cW(b,b,L);const O=a.bC();a.br(O,O,b),a.cS(O,O,L),this.mercatorFogMatrix=O,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,p,M)}_computeCameraPosition(d){const p=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,b=this._camera.forward(),M=this.point,L=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*p-d/this.worldSize*this._centerAltitude;return[M.x/this.worldSize-b[0]*L,M.y/this.worldSize-b[1]*L,d/this.worldSize*this._centerAltitude-b[2]*L]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const p=this._maxCameraBoundsDistance()*Math.cos(this._pitch),b=this._camera.position[2],M=d[2];let L=1;this.projection.wrap&&(this.center=this.center.wrap()),M>0&&(L=Math.min((p-b)/M,1)),this._camera.position=a.bH([],this._camera.position,d,L),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,p=this._camera.forward(),{pitch:b,bearing:M}=this._camera.getPitchBearing(),L=a.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,O=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.an(this._maxPitch)),z=Math.max((d[2]-L)/Math.cos(b),O),V=this._zoomFromMercatorZ(z);a.bH(d,d,p,z),this._pitch=a.aA(b,a.an(this.minPitch),a.an(this.maxPitch)),this.angle=a.bT(M,-Math.PI,Math.PI),this._setZoom(a.aA(V,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.ae(d[0],d[1],d[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(d){return Math.pow(2,d)*this.tileSize}_mercatorZfromZoom(d){return this.cameraToCenterDistance/this._worldSizeFromZoom(d)}_minimumHeightOverTerrain(){const d=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(d)}_zoomFromMercatorZ(d){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,d)*this.tileSize))}zoomFromMercatorZAdjusted(d){let p=0,b=a.cL,M=0,L=1/0;for(;b-p>1e-6&&b>p;){const O=p+.5*(b-p),z=this.tileSize*Math.pow(2,O),V=this.getCameraToCenterDistance(this.projection,O,z),Y=this.scaleZoom(V/(Math.max(0,d)*this.tileSize)),Q=Math.abs(O-Y);QY||le.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(d,p){const b=a.ag(a.av([],this._camera.position,d)),M=this._zoomFromMercatorZ(b)+p;return b-this._mercatorZfromZoom(M)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([p,b,M],L){const O=[p,b,M,1];a.aC(O,O,L);const z=O[3]=Math.max(O[3],1e-6);return O[0]/=z,O[1]/=z,O[2]/=z,O}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,d))}}getCameraToCenterDistance(d,p=this.zoom,b=this.worldSize){const M=a.cO(d,p,this.width,this.height,1024),L=d.pixelSpaceConversion(this.center.lat,b,M);let O=.5/Math.tan(.5*this._fov)*this.height*L;return this.isOrthographic&&(O=a.ak(1,O,a.d0(this.pitch>=bh?1:this.pitch/bh))),O}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.aB(d,d,this.globeMatrix),d}getFrustum(d){return a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const Nm=(_,d)=>{if(d>0&&_.terrain&&a.w("Cutoff is currently disabled on terrain"),d<=0||_.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const p=_.transform,b=Math.max(Math.abs(p._zoom-(_.minCutoffZoom-1)),1),M=p.isLODDisabled(!1)?a.ah(60,45,p.pitch):a.ah(30,15,p.pitch),L=p._farZ-p._nearZ,O=d*p.height,z=((1-(V=M))*p.cameraToCenterDistance+V*(p._farZ+O))*b;var V;return{shouldRenderCutoff:M<1,uniformValues:{u_cutoff_params:[p._nearZ,p._farZ,(z-p._nearZ)/L,(z-O-p._nearZ)/L]}}},Hu=2048;class sv{constructor(d,p){this.aabb=d,this.lastCascade=p}}class Die{add(d,p){const b=this.receivers[d.key];b!==void 0?(b.aabb.min[0]=Math.min(b.aabb.min[0],p.min[0]),b.aabb.min[1]=Math.min(b.aabb.min[1],p.min[1]),b.aabb.min[2]=Math.min(b.aabb.min[2],p.min[2]),b.aabb.max[0]=Math.max(b.aabb.max[0],p.max[0]),b.aabb.max[1]=Math.max(b.aabb.max[1],p.max[1]),b.aabb.max[2]=Math.max(b.aabb.max[2],p.max[2])):this.receivers[d.key]=new sv(p,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,p,b){const M=a.d9.fromPoints(d.points);let L=0;for(const O in this.receivers){const z=this.receivers[O];if(!z||!M.intersectsAabb(z.aabb))continue;z.aabb.min=M.closestPoint(z.aabb.min),z.aabb.max=M.closestPoint(z.aabb.max);const V=z.aabb.getCorners();for(let Y=0;Y1||le[1]<-1||le[1]>1){Q=!1;break}}if(z.lastCascade=Y,L=Math.max(L,Y),Q)break}}return L+1}}class my{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Die,this._depthMode=new cn(d.context.gl.LEQUAL,cn.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const d of this._cascades)d.texture.destroy(),d.framebuffer.destroy();this._cascades=[]}updateShadowParameters(d,p){const b=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!p||!p.properties)return;const M=p.properties.get("shadow-intensity");if(!p.shadowsEnabled()||M<=0||(this._shadowLayerCount=b.style.order.reduce((be,xe)=>{const Pe=b.style._mergedLayers[xe];return be+(Pe.hasShadowPass()&&!Pe.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const L=b.context,O=Hu,z=Hu;if(this._cascades.length===0||Hu!==this._cascades[0].texture.size[0]){this._cascades=[];for(let be=0;be<2;++be){const xe=b._shadowMapDebug,Pe=L.gl,Ee=L.createFramebuffer(O,z,xe?1:0,"texture"),$e=new a.T(L,{width:O,height:z,data:null},Pe.DEPTH_COMPONENT16);if(Ee.depthAttachment.set($e.texture),xe){const Ke=new a.T(L,{width:O,height:z,data:null},Pe.RGBA8);Ee.colorAttachment0.set(Ke.texture)}this._cascades.push({framebuffer:Ee,texture:$e,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.cB,scale:0})}}this.shadowDirection=av(p);let V=0;if(d.elevation){const be=d.elevation,xe=[1e4,-1e4];be.visibleDemTiles.filter(Pe=>Pe.dem).forEach(Pe=>{const Ee=Pe.dem.tree;xe[0]=Math.min(xe[0],Ee.minimums[0]),xe[1]=Math.max(xe[1],Ee.maximums[0])}),xe[0]!==1e4&&(V=(xe[1]-xe[0])*be.exaggeration())}const Y=1.5*d.cameraToCenterDistance,Q=3*Y,ce=new Float64Array(16);for(let be=0;be=0)return{};const L=function(V,Y,Q){const ce=Q/(1<0&&(a.d8(L[1],L[1],[M[0]*O,0,0]),a.d8(L[2],L[2],[M[0]*O,0,0])),M[1]<0?(a.d8(L[0],L[0],[0,M[1]*O,0]),a.d8(L[1],L[1],[0,M[1]*O,0])):M[1]>0&&(a.d8(L[2],L[2],[0,M[1]*O,0]),a.d8(L[3],L[3],[0,M[1]*O,0]));const z={};return z.vertices=L,z.planes=[iv(L[1],L[0],L[4]),iv(L[2],L[1],L[5]),iv(L[3],L[2],L[6]),iv(L[0],L[3],L[7])],z}addShadowReceiver(d,p,b){this._receivers.add(d,a.d9.fromTileIdAndHeight(d,p,b))}getMaxCascadeForTile(d){const p=this._receivers.get(d);return p&&p.lastCascade?p.lastCascade:0}}function iv(_,d,p){const b=a.av([],p,d),M=a.av([],_,d),L=a.bI([],b,M),O=a.ag(L);return O===0?[0,0,1,0]:(a.c5(L,L,1/O),[L[0],L[1],L[2],-a.bJ(L,d)])}function av(_){const d=_.properties.get("direction"),p=a.d4(d.x,d.y,d.z);p[2]=a.aA(p[2],0,75);const b=a.d6([p[0],p[1],p[2]]);return a.d5(b.x,b.y,b.z)}function up(_,d,p){const b=d.properties.get("color-use-theme")==="none",M=d.properties.get("color"),L=d.properties.get("intensity"),O=d.properties.get("direction"),z=[O.x,O.y,O.z],V=p.properties.get("color-use-theme")==="none",Y=p.properties.get("color"),Q=p.properties.get("intensity"),ce=Math.max(a.bJ([0,0,1],z),0),le=[0,0,0];a.c5(le,Y.toPremultipliedRenderColor(V?null:_.getLut(d.scope)).toArray01Linear().slice(0,3),Q);const de=[0,0,0];return a.c5(de,M.toPremultipliedRenderColor(b?null:_.getLut(p.scope)).toArray01Linear().slice(0,3),ce*L),a.db([le[0]>0?le[0]/(le[0]+de[0]):0,le[1]>0?le[1]/(le[1]+de[1]):0,le[2]>0?le[2]/(le[2]+de[2]):0])}function Sm(_,d,p,b,M,L){const O=_.zoom,z=_.scale,V=_.worldSize,Y=1/V,Q=_.aspect,ce=Math.sqrt(1+Q*Q)*Math.tan(.5*_.fovX),le=ce*ce,de=b-p,be=b+p;let xe,Pe;le>de/be?(xe=b,Pe=b*ce):(xe=.5*be*(1+le),Pe=.5*Math.sqrt(de*de+2*(b*b+p*p)*le+be*be*le*le));const Ee=_.projection.pixelsPerMeter(_.center.lat,V),$e=_._camera.getCameraToWorldMercator(),Ke=[0,0,-xe*Y];a.af(Ke,Ke,$e);let Ue=Pe*Y;const mt=_._edgeInsets;if(!(mt.left===0&&mt.top===0&&mt.right===0&&mt.bottom===0||mt.left===mt.right&&mt.top===mt.bottom)){const ur=_._camera.getWorldToCamera(_.worldSize,_.projection.zAxisUnit==="meters"?Ee:1),Ar=_._camera.getCameraToClipPerspective(_._fov,_.width/_.height,p,b);Ar[8]=2*-_.centerOffset.x/_.width,Ar[9]=2*_.centerOffset.y/_.height;const qr=new Float64Array(16);a.cP(qr,Ar,ur);const Sr=new Float64Array(16);a.bl(Sr,qr);const wr=a.cB.fromInvProjectionMatrix(Sr,V,O,!0);for(const nn of wr.points){const Jr=((ct=nn)[0]/=z,ct[1]/=z,ct[2]=a.cf(ct[2],_._center.lat),ct);Ue=Math.max(Ue,a.c6(a.da([],Ke,Jr)))}}var ct;Ue*=M/(M-1);const ht=Math.acos(d[2]),ot=Math.atan2(-d[0],-d[1]),st=new fk;st.position=Ke,st.setPitchBearing(ht,ot);const _t=st.getWorldToCamera(V,Ee),It=Ue*V,Tt=Math.min(_._mercatorZfromZoom(17)*V*-2,-2*It),Vt=st.getCameraToClipOrthographic(-It,It,-It,It,Tt,(It+L*Ee)/d[2]),Ht=new Float64Array(16);a.aB(Ht,Vt,_t);const nr=a.d5(Math.floor(1e6*Ke[0])/1e6*V,Math.floor(1e6*Ke[1])/1e6*V,0),br=.5*M,zt=[0,0,0];a.af(zt,nr,Ht),a.c5(zt,zt,br);const Nt=[Math.floor(zt[0]),Math.floor(zt[1]),Math.floor(zt[2])],Zt=[0,0,0];a.av(Zt,zt,Nt),a.c5(Zt,Zt,-1/br);const qt=new Float64Array(16);return a.bA(qt),a.br(qt,qt,Zt),a.aB(Ht,qt,Ht),[Ht,It]}class Rie extends a.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,p){return a.dc(this.requestManager.transformRequest(p,a.R.Model).url).then(b=>{if(!b)return;const M=a.dd(b),L=new a.de(d,p,void 0,void 0,M);return L.computeBoundsAndApplyParent(),L}).catch(b=>{if(b&&b.status===404)return null;this.fire(new a.y(new Error(`Could not load model ${d} from ${p}: ${b.message}`)))})}load(d,p,b={forceReload:!1}){this.models[p]||(this.models[p]={});const M=Object.keys(d),L=[],O=[];for(const z of M){const V=d[z];this.hasURLBeenRequested(V)&&!b.forceReload||(this.modelByURL[V]={modelId:z,scope:p},L.push(this.loadModel(z,V)),O.push(z)),this.models[p][z]||(this.models[p][z]={model:null,numReferences:1})}this.numModelsLoading[p]=(this.numModelsLoading[p]||0)+O.length,Promise.allSettled(L).then(z=>{for(let V=0;V{this.fire(new a.y(new Error(`Could not load models: ${z.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,p,b={exactIdMatch:!1}){return!!(b.exactIdMatch?this.getModel(d,p):this.getModelByURL(this.modelUris[p][d]))}getModel(d,p){return this.models[p]||(this.models[p]={}),this.models[p][d]?this.models[p][d].model:void 0}getModelByURL(d){if(!d)return null;const p=this.modelByURL[d];return p?this.models[p.scope][p.modelId].model:null}hasModelBeenAdded(d,p){return this.models[p]&&this.models[p][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,p,b){this.models[b]||(this.models[b]={}),this.modelUris[b]||(this.modelUris[b]={});const M=this.requestManager.normalizeModelURL(p);if((this.hasModel(d,b,{exactIdMatch:!0})||this.hasModelBeenAdded(d,b))&&this.modelUris[b][d]===M)this.models[b][d].numReferences++;else if(this.hasURLBeenRequested(M)){const{scope:L,modelId:O}=this.modelByURL[M];this.models[L][O].numReferences++}else this.modelUris[b][d]=M,this.load({[d]:this.modelUris[b][d]},b)}addModelURLs(d,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const b=this.modelUris[p];for(const M in d)b[M]=this.requestManager.normalizeModelURL(d[M])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const b={};for(const M of d)this.hasModel(M,p,{exactIdMatch:!0})||this.hasURLBeenRequested(M)?this.models[p][M].numReferences++:this.modelUris[p][M]&&!this.hasURLBeenRequested(M)?b[M]=this.modelUris[p][M]:!this.hasURLBeenRequested(M)&&a.df(M,!1)&&(this.modelUris[p][M]=this.requestManager.normalizeModelURL(M),b[M]=this.modelUris[p][M]);this.load(b,p)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,p,b=!1,M=!1){if(this.models[p]&&this.models[p][d]&&(this.models[p][d].numReferences--,this.models[p][d].numReferences===0||M)){const L=this.modelUris[p][d];b||delete this.modelUris[p][d],delete this.modelByURL[L];const O=this.models[p][d].model;if(!O)return;delete this.models[p][d],O.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const p of Object.keys(this.models[d])){const b=this.models[d][p].model;delete this.models[d][p],b&&b.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(d){return this.models[d]||(this.models[d]={}),Object.keys(this.models[d])}upload(d,p){this.models[p]||(this.models[p]={});for(const b in this.models[p])this.models[p][b].model&&this.models[p][b].model.upload(d.context)}}const E5=a.a6.colorTheme,Fie=new a.a9({data:new a.aa(E5.data)});function FI(_){if(!_.metadata||!_.metadata.content_area)return;const d=a.o.devicePixelRatio,{left:p,top:b,width:M,height:L}=_.metadata.content_area,O=p*d,z=b*d;return[O,z,O+M*d,z+L*d]}function zI(_){if(_)return _.map(([d,p])=>[d*a.o.devicePixelRatio,p*a.o.devicePixelRatio])}class I5{constructor(d,p,b){this.id=d,this.scope=p,this.sourceCache=b,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(d){this.missingRequests.has(d.name)||this.pendingRequests.has(d.name)||this.pendingRequests.add(d.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const d=new Map;if(!this.sourceCache.loaded())return d;const p=this.sourceCache.getVisibleCoordinates();if(p.length===0)return d;const b=this.sourceCache.getSource();if(!(b instanceof Jo))return d;const M=p.map(O=>this.sourceCache.getTile(O)),L=b.getImages(M,Array.from(this.pendingRequests));for(const[O,z]of L)d.set(a.I.from({name:O,iconsetId:this.id}),z),this.pendingRequests.delete(O);for(const O of this.pendingRequests)this.missingRequests.add(O);return this.pendingRequests.clear(),d}}const Cm=(_,d)=>We(_,d&&d.filter(p=>p.identifier!=="source.canvas")),BI=a.aH(cr,["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"]),$I=a.aH(cr,["setCenter","setZoom","setBearing","setPitch"]),mk=new Set(["background","sky","slot","custom"]),Mm={version:8,layers:[],sources:{}},ov={duration:300,delay:0};class Wu extends a.E{constructor(d,p={}){super(),this.map=d,this.scope=p.scope||"",this.globalId=null,this.fragments=[],this.importDepth=p.importDepth||0,this.importsCache=p.importsCache||new Map,this.resolvedImports=p.resolvedImports||new Set,this.transition=Object.assign({},ov),this._buildingIndex=new w5(this),this.crossTileSymbolIndex=new _h,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=p.styleChanges||new Me,this._hasDataDrivenEmissive=!1,this.dispatcher=p.dispatcher?p.dispatcher:new a.D(a.dh(),this),p.imageManager?this.imageManager=p.imageManager:(this.imageManager=new Re(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=p.glyphManager?p.glyphManager:new a.di(d._requestManager,p.localFontFamily?a.dj.all:p.localIdeographFontFamily?a.dj.ideographs:a.dj.none,p.localFontFamily||p.localIdeographFontFamily),p.modelManager?this.modelManager=p.modelManager:(this.modelManager=new Rie(d._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=p.configOptions?p.configOptions:new Map,this._configDependentLayers=p.configDependentLayers?p.configDependentLayers:new Set,this._indoorDependentLayers=p.indoorDependentLayers?p.indoorDependentLayers:new Set,this._config=p.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:p.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=p.initialConfig,this.dispatcher.broadcast("setReferrer",a.dk());const b=this;this._rtlTextPluginCallback=Wu.registerForPluginStateChange(M=>{b.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:M.pluginStatus,pluginURL:M.pluginURL},(L,O)=>{if(a.dl(L),O&&O.every(z=>z))for(const z in b._sourceCaches){const V=b._sourceCaches[z],Y=V.getSource().type;Y!=="vector"&&Y!=="geojson"||V.reload()}})}),this.on("data",M=>{if(M.dataType!=="source"||M.sourceDataType!=="metadata")return;const L=this.getOwnSource(M.sourceId);if(L&&L.vectorLayerIds)for(const O in this._layers){const z=this._layers[O];z.source===L.id&&this._validateLayer(z)}})}load(d){return d?(typeof d=="string"?this.loadURL(d):this.loadJSON(d),this):this}_getGlobalId(d){if(!d)return null;if(typeof d=="string"){if(a.h(d))return d;const p=a.dm(d);if(!p.startsWith("http"))try{return new URL(p,location.href).toString()}catch{return p}return p}return`json://${a.dn(JSON.stringify(d))}`}_diffStyle(d,p,b){this.globalId=this._getGlobalId(d);const M=(L,O)=>{try{O(null,this.setState(L,b))}catch(z){O(z,!1)}};if(typeof d=="string"){const L=this.map._requestManager.normalizeStyleURL(d),O=this.map._requestManager.transformRequest(L,a.R.Style);a.m(O,(z,V)=>{z?this.fire(new a.y(z)):V&&M(V,p)})}else typeof d=="object"&&M(d,p)}loadURL(d,p={}){this.fire(new a.z("dataloading",{dataType:"style"}));const b=typeof p.validate=="boolean"?p.validate:!a.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,p.accessToken),this.resolvedImports.add(d);const M=this.importsCache.get(d);if(M)return this._load(M,b);const L=this.map._requestManager.transformRequest(d,a.R.Style);this._request=a.m(L,(O,z)=>{if(this._request=null,O)this.fire(new a.y(O));else if(z)return this.importsCache.set(d,z),this._load(z,b)})}loadJSON(d,p={}){this.fire(new a.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=a.o.frame(()=>{this._request=null,this._load(d,p.validate!==!1)})}loadEmpty(){this.fire(new a.z("dataloading",{dataType:"style"})),this._load(Mm,!1)}_loadImports(d,p,b){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const M=[];for(const L of d){const O=this._createFragmentStyle(L),z=new Promise(Q=>{O.once("style.import.load",Q),O.once("error",Q)}).then(()=>this.mergeAll());if(M.push(z),this.resolvedImports.has(L.url)){O.loadEmpty();continue}const V=L.data||this.importsCache.get(L.url);V?(O.loadJSON(V,{validate:p}),this._isInternalStyle(V)&&(O.globalId=null)):L.url?O.loadURL(L.url,{validate:p}):O.loadEmpty();const Y={style:O,id:L.id,config:L.config};if(b){const Q=this.fragments.findIndex(({id:ce})=>ce===b);this.fragments=this.fragments.slice(0,Q).concat(Y).concat(this.fragments.slice(Q))}else this.fragments.push(Y)}return Promise.allSettled(M)}getImportGlobalIds(d=this,p=new Set){for(const b of d.fragments)b.style.globalId&&p.add(b.style.globalId),this.getImportGlobalIds(b.style,p);return[...p.values()]}_createFragmentStyle(d){const p=this.scope?a.B(d.id,this.scope):d.id;let b;const M=this._initialConfig&&this._initialConfig[p];(d.config||M)&&(b=Object.assign({},d.config,M));const L=new Wu(this.map,{scope:p,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:b,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return L.setEventedParent(this.map,{style:L}),L}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(d){return this.isRootStyle()&&(d.fragment||!!d.schema&&d.fragment!==!1)}_load(d,p){if(this._isInternalStyle(d)){const L=Object.assign({},Mm,{imports:[{id:"basemap",data:d,url:""}]},d.center?{center:d.center}:{},d.bearing?{bearing:d.bearing}:{},d.pitch?{pitch:d.pitch}:{},d.zoom?{zoom:d.zoom}:{},d.light?{light:d.light}:{});return this._importedAsBasemap=!0,void this._load(L,p)}if(this.updateConfig(this._config,d.schema),p&&Cm(this,Mi(d)))return;this._loaded=!0,this.stylesheet=a.dp(d);const b=()=>{for(const V in d.sources)this.addSource(V,d.sources[V],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const V in d.iconsets)this.addIconset(V,d.iconsets[V]);d.sprite?this._loadIconset(d.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&d.glyphs&&this.glyphManager.setURL(d.glyphs);const L=Cr(this.stylesheet.layers);if(this._order=L.map(V=>V.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const V=this.stylesheet.lights[0];this.light=new Ct(V.properties,V.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Ct(this.stylesheet.light)),this._layers={};for(const V of L){const Y=a.du(V,this.scope,this._styleColorTheme.lut,this.options);Y.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(Y.fqid),Y.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(Y.fqid),this._hasAppearances=this._hasAppearances||Y.getAppearances().length!==0,Y.setEventedParent(this,{layer:{id:Y.id}}),this._layers[Y.id]=Y;const Q=this.getOwnLayerSourceCache(Y),ce=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Q&&Y.canCastShadows()&&ce&&(Q.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const O=this.stylesheet.terrain;O&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(O,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 a.z("data",{dataType:"style"}));const z=this.isRootStyle();d.imports?this._loadImports(d.imports,p).then(()=>{this._reloadImports(),this.fire(new a.z(z?"style.load":"style.import.load"))}).catch(V=>{this.fire(new a.y(new Error("Failed to load imports",V))),this.fire(new a.z(z?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new a.z(z?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const M=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(M){const L=this._evaluateColorThemeData(M);this._loadColorTheme(L).then(()=>{b()}).catch(O=>{a.w(`Couldn't load color theme from the stylesheet: ${O}`),b()})}else this._styleColorTheme.lut=null,b()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,p,b,M,L,O,z,V,Y,Q;const ce={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(le=>{if(le.stylesheet){if(le.light!=null&&(d=le.light),le.stylesheet.lights)for(const de of le.stylesheet.lights)de.type==="ambient"&&le.ambientLight!=null&&(p=le.ambientLight),de.type==="directional"&&le.directionalLight!=null&&(b=le.directionalLight);M=this._prioritizeTerrain(M,le.terrain,le.stylesheet.terrain),le.stylesheet.fog&&le.fog!=null&&(L=le.fog),le.stylesheet.snow&&le.snow!=null&&(O=le.snow),le.stylesheet.rain&&le.rain!=null&&(z=le.rain),le.stylesheet.camera!=null&&(Q=le.stylesheet.camera),le.stylesheet.projection!=null&&(V=le.stylesheet.projection),le.stylesheet.transition!=null&&(Y=le.stylesheet.transition),ce[le.scope]=le._styleColorTheme}}),this.light=d,this.ambientLight=p,this.directionalLight=b,this.fog=L,this.snow=O,this.rain=z,this._styleColorThemeForScope=ce,M===null?delete this.terrain:this.terrain=M,this.camera=Q||{"camera-projection":"perspective"},this.projection=V||{name:"mercator"},this.transition=Object.assign({},ov,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const p=b=>{for(const M of b.fragments)p(M.style);d(b)};p(this)}_prioritizeTerrain(d,p,b){const M=d&&d.drapeRenderMode===0;return b===null?p&&p.drapeRenderMode===0?p:M?d:null:p!=null&&(!d||M||p&&p.drapeRenderMode===1)?p:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(p=>{d=this._prioritizeTerrain(d,p.terrain,p.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(p=>{p.stylesheet.projection!=null&&(d=p.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},p={},b={};this.forEachFragmentStyle(M=>{for(const L in M._sourceCaches){const O=a.B(L,M.scope);d[O]=M._sourceCaches[L]}for(const L in M._otherSourceCaches){const O=a.B(L,M.scope);p[O]=M._otherSourceCaches[L]}for(const L in M._symbolSourceCaches){const O=a.B(L,M.scope);b[O]=M._symbolSourceCaches[L]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=p,this._mergedSymbolSourceCaches=b}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const p of Object.values(d.stylesheet.indoor)){const b=p,M=a.B(b.sourceId,d.scope);this._mergedIndoor[M]=new Set(b.sourceLayers||[])}})}mergeLayers(){const d={},p=[],b={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(O=>{for(const z of O._order){const V=O._layers[z];if(V.type==="slot"){const Y=a.dq(z);if(d[Y])continue;d[Y]=[]}V.slot&&d[V.slot]?d[V.slot].push(V):p.push(V)}}),this._mergedOrder=[];let M=-1;const L=(O=[])=>{for(const z of O)if(z.type==="slot"){const V=a.dq(z.id);d[V]&&L(d[V]),this._mergedSlots.push(V)}else{const V=a.B(z.id,z.scope);this._mergedOrder.push(V),b[V]=z,z.is3D(!!this.terrain)&&(this._has3DLayers=!0,M=this._mergedOrder.length-1),z.type==="circle"&&(this._hasCircleLayers=!0),z.type==="symbol"&&(this._hasSymbolLayers=!0),z.type==="clip"&&(this._clipLayerPresent=!0)}};if(L(p),this._has3DLayers){const O={};for(let z=0;zO[z]-O[V])}this._mergedLayers=b,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(d){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,d),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(d){return d.data?function(p,b,M,L){const O=Object.assign({},b);for(const V of Object.keys(E5))O[V]===void 0&&(O[V]=E5[V].default);const z=new a.a8(Fie,p,new Map(M));return z.setTransitionOrValue(O,M),z.untransitioned().possiblyEvaluate(new a.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const p=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((b,M)=>{const L="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void b();let O=d;O.startsWith(L)||(O=L+O);const z=a.I.from("mapbox-reserved-lut"),V=new Image;V.src=O,V.onerror=()=>{this._styleColorTheme.lutLoading=!1,M(new Error("Failed to load image data"))},V.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==p)return void b();this._styleColorTheme.lutLoading=!1;const{width:Y,height:Q,data:ce}=a.o.getImageData(V);if(Q>32)return void M(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==Q*Q)return void M(new Error("The width of the image must be equal to the height squared."));this.getImage(z)&&this.removeImage(z),this.addImage(z,{data:new a.q({width:Y,height:Q},ce),pixelRatio:1,sdf:!1,usvg:!1,version:0});const le=this.imageManager.getImage(z,this.scope);le?(this._styleColorTheme.lut={image:le.data,data:d},b()):M(new Error("Missing LUT image."))}})}getLut(d){const p=this._styleColorThemeForScope[d];return p?p.lut:null}setProjection(d){d?this.stylesheet.projection=d:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(d){this._spriteRequest=function(p,b,M){let L,O,z;const V=a.o.devicePixelRatio>1?"@2x":"";let Y=a.m(b.transformRequest(b.normalizeSpriteURL(p,V,".json"),a.R.SpriteJSON),(le,de)=>{Y=null,z||(z=le,L=de,ce())}),Q=a.n(b.transformRequest(b.normalizeSpriteURL(p,V,".png"),a.R.SpriteImage),(le,de)=>{Q=null,z||(z=le,O=de,ce())});function ce(){if(z)M(z);else if(L&&O){const le=a.o.getImageData(O),de={};for(const be in L){const{width:xe,height:Pe,x:Ee,y:$e,sdf:Ke,pixelRatio:Ue,stretchX:mt,stretchY:ct,content:ht}=L[be],ot=new a.q({width:xe,height:Pe});a.q.copy(le,ot,{x:Ee,y:$e},{x:0,y:0},{width:xe,height:Pe},null),de[be]={data:ot,pixelRatio:Ue!==void 0?Ue:1,sdf:Ke!==void 0&&Ke,stretchX:mt,stretchY:ct,content:ht,usvg:!1,version:0}}M(null,de)}}return{cancel(){Y&&(Y.cancel(),Y=null),Q&&(Q.cancel(),Q=null)}}}(d,this.map._requestManager,(p,b)=>{if(this._spriteRequest=null,p)this.fire(new a.y(p));else if(b){const M=new Map;for(const L in b)M.set(a.I.from(L),b[L]);this.addImages(M)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))})}addIconset(d,p){if(p.type==="sprite")return void this._loadSprite(p.url);const b=this.getOwnSourceCache(p.source);if(!b)return void this.fire(new a.y(new Error(`Source "${p.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const M=b.getSource();if(M.type!=="raster-array")return void this.fire(new a.y(new Error(`Source "${p.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));M.partial=!1;const L=new I5(d,this.scope,b);this.imageManager.addImageProvider(L,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!a.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const p=this.map._spriteFormat==="auto";var b,M;this._spriteRequest=(M=(L,O)=>{if(this._spriteRequest=null,L)p?this._loadSprite(d):this.fire(new a.y(L));else if(O){const z=new Map;for(const V in O)z.set(a.I.from(V),O[V]);this.addImages(z)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))},a.bu((b=this.map._requestManager).transformRequest(b.normalizeIconsetURL(d),a.R.Iconset),(L,O)=>{if(L)return void M(L);const z={},V=a.dg(new a.bt(O));for(const Y of V.icons){const Q={version:1,pixelRatio:a.o.devicePixelRatio,content:FI(Y),stretchX:Y.metadata?zI(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?zI(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};z[Y.name]=Q}M(null,z)}))}_validateLayer(d){const p=this.getOwnSource(d.source);if(!p)return;const b=d.sourceLayer;b&&(p.type==="geojson"||p.vectorLayerIds&&p.vectorLayerIds.indexOf(b)===-1)&&this.fire(new a.y(new Error(`Source layer "${b}" does not exist on source "${p.id}" as specified by style layer "${d.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const d in this._sourceCaches)if(!this._sourceCaches[d].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:d}of this.fragments)if(!d.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((d,p)=>{const b=this.fragments[p];return b&&b.style&&(d.data=b.style.serialize()),d})}_serializeSources(){const d={};for(const p in this._sourceCaches){const b=this._sourceCaches[p].getSource();d[b.id]||(d[b.id]=b.serialize())}return d}_serializeLayers(d){const p=[];for(const b of d){const M=this._layers[b];M&&M.type!=="custom"&&p.push(M.serialize())}return p}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const d in this._sourceCaches)if(this._sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const d in this._mergedLayers){const p=this._mergedLayers[d];if(p._transitionablePaint&&p._transitionablePaint._values){const b=p._transitionablePaint._values["line-emissive-strength"];if(b&&b.value&&b.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(d){return d?this.order:this._mergedOrder}isLayerDraped(d){return!!this.terrain&&d.isDraped(this.getLayerSourceCache(d))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(d){const p=this.getOwnLayer(d);if(p)return p;this.fire(new a.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const p=this.getOwnSource(d);if(p)return p;this.fire(new a.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,p){const b=this.map.painter;if(b)for(let M=d.minzoom||0;M<(d.maxzoom||25.5);M++){const L=d.getProgramIds();if(L)for(const O of L){const z=d.getDefaultProgramParams(O,p.zoom,this._styleColorTheme.lut);z&&(b.style=this,this.fog&&(b._fogVisible=!0,z.overrideFog=!0,b.getOrCreateProgram(O,z)),b._fogVisible=!1,z.overrideFog=!1,b.getOrCreateProgram(O,z),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(z.overrideRtt=!0,b.getOrCreateProgram(O,z)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const p=this.calculateLightsBrightness();d.brightness=p||0,p!==this._brightness&&(this._brightness=p,this.dispatcher.broadcast("setBrightness",p)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const b=this._changes.isDirty();let M=!1;if(this._changes.isDirty()){const z=this._changes.getLayerUpdatesByScope();for(const V in z){const{updatedIds:Y,removedIds:Q}=z[V];(Y||Q)&&(this._updateWorkerLayers(V,Y,Q),M=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(d),this.light&&this.light.updateTransitions(d),this.ambientLight&&this.ambientLight.updateTransitions(d),this.directionalLight&&this.directionalLight.updateTransitions(d),this.fog&&this.fog.updateTransitions(d),this.snow&&this.snow.updateTransitions(d),this.rain&&this.rain.updateTransitions(d),this._changes.reset()}const L={};for(const z in this._mergedSourceCaches){const V=this._mergedSourceCaches[z];L[z]=V.used,V.used=!1,V.tileCoverLift=0}for(const z of this._mergedOrder){const V=this._mergedLayers[z];if(V.visibility!=="none"&&V.recalculate(d,this._availableImages),!V.isHidden(d.zoom)){const Y=this.getLayerSourceCache(V);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,V.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(V,d)}):this.precompilePrograms(V,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&M&&this.mergeLayers();const O=this.imageManager.getPendingImageProviders();for(const z of O)z.sourceCache.used=!0;for(const z in L){const V=this._mergedSourceCaches[z];L[z]!==V.used&&V.getSource().fire(new a.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:V.getSource().id}))}this.light&&this.light.recalculate(d),this.terrain&&this.terrain.recalculate(d),this.fog&&this.fog.recalculate(d),this.snow&&this.snow.recalculate(d),this.rain&&this.rain.recalculate(d),this.z=d.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),b&&this.fire(new a.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const p of d){const b=p.resolvePendingRequests(),M=this.getFragmentStyle(p.scope);M&&M.addImages(b)}}_updateTilesForChangedImages(){const d={};for(const p in this._mergedSourceCaches){const b=this._mergedSourceCaches[p].getSource().scope;d[b]=d[b]||this._changes.getUpdatedImages(b),d[b].length!==0&&this._mergedSourceCaches[p].reloadTilesForDependencies(["icons","patterns"],d[b])}for(const p in d)this._changes.resetUpdatedImages(p)}_updateWorkerLayers(d,p,b){const M=this.getFragmentStyle(d);M&&this.dispatcher.broadcast("updateLayers",{layers:p?M._serializeLayers(p):[],scope:d,removedIds:b||[],options:M.options})}setState(d,p){if(this._checkLoaded(),Cm(this,Mi(d)))return!1;(d=a.dp(d)).layers=Cr(d.layers);const b=function(O,z){if(!O)return[{command:cr.setStyle,args:[z]}];let V=[];try{if(!a.by(O.version,z.version))return[{command:cr.setStyle,args:[z]}];if(a.by(O.center,z.center)||V.push({command:cr.setCenter,args:[z.center]}),a.by(O.zoom,z.zoom)||V.push({command:cr.setZoom,args:[z.zoom]}),a.by(O.bearing,z.bearing)||V.push({command:cr.setBearing,args:[z.bearing]}),a.by(O.pitch,z.pitch)||V.push({command:cr.setPitch,args:[z.pitch]}),a.by(O.sprite,z.sprite)||V.push({command:cr.setSprite,args:[z.sprite]}),a.by(O.glyphs,z.glyphs)||V.push({command:cr.setGlyphs,args:[z.glyphs]}),a.by(O.imports,z.imports)||function(de=[],be=[],xe){be=be||[];const Pe=(de=de||[]).map(Dg),Ee=be.map(Dg),$e=de.reduce(X1,{}),Ke=be.reduce(X1,{}),Ue=Pe.slice();let mt,ct,ht,ot;for(mt=0,ct=0;mt{de.source&&Y[de.source]?V.push({command:cr.removeLayer,args:[de.id]}):ce.push(de)});let le=O.terrain;le&&Y[le.source]&&(V.push({command:cr.setTerrain,args:[void 0]}),le=void 0),V=V.concat(Q),a.by(le,z.terrain)||V.push({command:cr.setTerrain,args:[z.terrain]}),function(de,be,xe){be=be||[];const Pe=(de=de||[]).map(Dg),Ee=be.map(Dg),$e=de.reduce(X1,{}),Ke=be.reduce(X1,{}),Ue=Pe.slice(),mt=Object.create(null);let ct,ht,ot,st,_t,It,Tt;for(ct=0,ht=0;ct!(O.command in $I));if(b.length===0)return!1;const M=b.filter(O=>!(O.command in BI));if(M.length>0)throw new Error(`Unimplemented: ${M.map(O=>O.command).join(", ")}.`);const L=[];return b.forEach(O=>{L.push(this[O.command](...O.args))}),p&&Promise.all(L).then(p).catch(p),this.stylesheet=d,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(d){if(d.size===0)return this;for(const[p,b]of d.entries()){if(this.getImage(p))return this.fire(new a.y(new Error(`An image with the name "${p.name}" already exists.`)));this.imageManager.addImage(p,this.scope,b),this._changes.updateImage(p,this.scope)}return this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this}addImage(d,p){return this.getImage(d)?this.fire(new a.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,p),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this)}updateImage(d,p,b=!1){this.imageManager.updateImage(d,this.scope,p),b&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})))}getImage(d){return this.imageManager.getImage(d,this.scope)}removeImage(d){return this.getImage(d)?(this.imageManager.removeImage(d,this.scope),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(d){return this.modelManager.addModelURLs(d,this.getActualScope()),this._updateWorkerModels(),this.fire(new a.z("data",{dataType:"style"})),this}addModel(d,p,b={}){return this._checkLoaded(),this._validate(_e,`models.${d}`,p,null,b)||(this.modelManager.addModel(d,p,this.getActualScope()),this.fire(new a.z("data",{dataType:"style"}))),this}hasModel(d){return this.modelManager.hasModel(d,this.getActualScope())}removeModel(d){return this.hasModel(d)?(this.modelManager.removeModel(d,this.getActualScope(),!1,!0),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,p,b={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!p.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(p).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(p.type)>=0&&this._validate(Eo,`sources.${d}`,p,null,b))return;this.map&&this.map._collectResourceTiming&&(p.collectResourceTiming=!0);const M=Do(d,p,this.dispatcher,this);M.scope=this.scope,M.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(M.id),source:M.serialize(),sourceId:M.id}));const L=O=>{const z=(O?"symbol:":"other:")+M.id,V=a.B(z,this.scope),Y=this._sourceCaches[z]=new Vc(V,M,O);(O?this._symbolSourceCaches:this._otherSourceCaches)[M.id]=Y,Y.onAdd(this.map)};L(!1),p.type!=="vector"&&p.type!=="geojson"||L(!0),M.onAdd&&M.onAdd(this.map),b.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const p=this.getOwnSource(d);if(!p)throw new Error("There is no source with this ID");for(const M in this._layers)if(this._layers[M].source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while layer "${M}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const M=Object.entries(this.stylesheet.iconsets).find(([L,O])=>O.type==="source"&&O.source===d);if(M)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while iconset "${M[0]}" is using it.`)))}const b=this.getOwnSourceCaches(d);for(const M of b){const L=a.dq(M.id);delete this._sourceCaches[L],this._changes.discardSourceCacheUpdate(M.id),M.fire(new a.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:M.getSource().id})),M.setEventedParent(null),M.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),p.setEventedParent(null),p.onRemove&&p.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,p){this._checkLoaded(),this.getOwnSource(d).setData(p),this._changes.setDirty()}getOwnSource(d){const p=this.getOwnSourceCache(d);return p&&p.getSource()}getOwnSources(){const d=[];for(const p in this._otherSourceCaches){const b=this.getOwnSourceCache(p);b&&d.push(b.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const p in d){const b=d[p]._tiles;for(const M in b){const L=b[M];if(L.state!=="loaded"&&L.state!=="errored")return!1}}return!0}setLights(d){if(this._checkLoaded(),!d)return delete this.ambientLight,void delete this.directionalLight;const p=this._getTransitionParameters();for(const L of d){if(this._validate(ho,"lights",L))return;switch(L.type){case"ambient":if(this.ambientLight){const O=this.ambientLight;O.set(L),O.updateTransitions(p)}else this.ambientLight=new Ws(L,Va||(Va=new a.a9({color:new a.aa(a.a6.properties_light_ambient.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const O=this.directionalLight;O.set(L),O.updateTransitions(p)}else this.directionalLight=new Ws(L,Ea||(Ea=new a.a9({direction:new a.ap(a.a6.properties_light_directional.direction),color:new a.aa(a.a6.properties_light_directional.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_directional.intensity),"cast-shadows":new a.aa(a.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new a.aa(a.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new a.aa(a.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const b=Object.assign(p,{worldview:this.map.getWorldview()}),M=new a.ac(this.z||0,b);this.ambientLight&&this.ambientLight.recalculate(M),this.directionalLight&&this.directionalLight.recalculate(M),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,p=this.ambientLight;if(!d||!p)return;const b=le=>.2126*(le[0]<=.03928?le[0]/12.92:Math.pow((le[0]+.055)/1.055,2.4))+.7152*(le[1]<=.03928?le[1]/12.92:Math.pow((le[1]+.055)/1.055,2.4))+.0722*(le[2]<=.03928?le[2]/12.92:Math.pow((le[2]+.055)/1.055,2.4)),M=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),L=d.properties.get("intensity"),O=d.properties.get("direction"),z=1-a.d4(O.x,O.y,O.z)[2]/90,V=b(M)*L*z,Y=p.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),Q=p.properties.get("intensity"),ce=b(Y)*Q;return Number(((V+ce)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const d=[];return this.directionalLight&&d.push(this.directionalLight.get()),this.ambientLight&&d.push(this.ambientLight.get()),d}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(d){if(d==null||d===""&&this.isRootStyle())return this;if(a.dr(d)){const p=a.ds(d),b=this.fragments.find(({id:L})=>L===p);if(!b)return;const M=a.dq(d);return b.style.getFragmentStyle(M)}{const p=this.fragments.find(({id:b})=>b===d);return p?p.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const p={},b=(M,L="")=>`${M}::${L}`;this._featuresetSelectors={};for(const M in d){const L=this._featuresetSelectors[M]=[];for(const O of d[M].selectors){if(O.featureNamespace){const V=this.getOwnLayer(O.layer);if(!V){a.w(`Layer is undefined for selector: ${O.layer}`);continue}const Y=b(V.source,V.sourceLayer);if(Y in p&&p[Y]!==O.featureNamespace){a.w(`"featureNamespace ${O.featureNamespace} of featureset ${M}'s selector is not associated to the same source, skip this selector`);continue}p[Y]=O.featureNamespace}let z;if(O.properties)for(const V in O.properties){const Y=a.U(O.properties[V]);Y.result==="success"&&(z=z||{},z[V]=Y.value)}L.push({layerId:O.layer,namespace:O.featureNamespace,properties:z,uniqueFeatureID:O._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const p=this.getFragmentStyle(d);if(!p||!p.stylesheet.featuresets)return[];const b=[];for(const M in p.stylesheet.featuresets)b.push({featuresetId:M,importId:p.scope?p.scope:void 0});return b}getFeaturesetLayers(d,p){const b=this.getFragmentStyle(p),M=b.stylesheet.featuresets;if(!M||!M[d])return this.fire(new a.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const L=[];for(const O of M[d].selectors){const z=b.getOwnLayer(O.layer);z&&L.push(z)}return L}getConfigProperty(d,p){const b=this.getFragmentStyle(d);if(!b)return null;const M=a.B(p,b.scope),L=b.options.get(M),O=L?L.value||L.default:null;return O?O.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,p){const b=a.B(d,p);return this._mergedIndoor[b]}setIndoorData(d,p){this.map.indoor.setIndoorData(p)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,p,b){const M=this.getFragmentStyle(d);if(!M)return;const L=M.stylesheet.schema;if(!L||!L[p])return;const O=a.U(b);if(O.result!=="success")return void Cm(this,O.value);const z=O.value.expression,V=a.B(p,M.scope),Y=M.options.get(V);if(!Y)return;let Q;const{minValue:ce,maxValue:le,stepValue:de,type:be,values:xe}=L[p],Pe=a.U(L[p].default);Pe.result==="success"&&(Q=Pe.value.expression),Q?(this.options.set(V,Object.assign({},Y,{value:z,default:Q,minValue:ce,maxValue:le,stepValue:de,type:be,values:xe})),this.updateConfigDependencies(p)):this.fire(new a.y(new Error(`No schema defined for the config option "${p}" in the "${d}" fragment.`)))}getConfig(d){const p=this.getFragmentStyle(d);if(!p)return null;const b=p.stylesheet.schema;if(!b)return null;const M={};for(const L in b){const O=a.B(L,p.scope),z=p.options.get(O),V=z?z.value||z.default:null;M[L]=V?V.serialize():null}return M}setConfig(d,p){const b=this.getFragmentStyle(d);b&&(b.updateConfig(p,b.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const p=this.getFragmentStyle(d);return p?p.stylesheet.schema:null}setSchema(d,p){const b=this.getFragmentStyle(d);b&&(b.stylesheet.schema=p,b.updateConfig(b._config,p),this.updateConfigDependencies())}updateConfig(d,p){if(this._config=d,d||p)if(p)for(const b in p){let M,L;const O=a.U(p[b].default);if(O.result==="success"&&(M=O.value.expression),d&&d[b]!==void 0){const le=a.U(d[b]);le.result==="success"&&(L=le.value.expression)}const{minValue:z,maxValue:V,stepValue:Y,type:Q,values:ce}=p[b];if(M){const le=a.B(b,this.scope);this.options.set(le,{default:M,value:L,minValue:z,maxValue:V,stepValue:Y,type:Q,values:ce})}else this.fire(new a.y(new Error(`No schema defined for config option "${b}".`)))}else this.fire(new a.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,p=()=>!0){for(const b of d){const M=this.getLayer(b);M&&p(M)&&(M.possiblyEvaluateVisibility(),this._updateLayer(M),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,p=>!d||p.expressionDependencies.configDependencies.has(d)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(p=>{const b=p._styleColorTheme.colorThemeOverride?p._styleColorTheme.colorThemeOverride:p._styleColorTheme.colorTheme;if(b){const M=p._evaluateColorThemeData(b);(!p._styleColorTheme.lut&&M!==""||p._styleColorTheme.lut&&M!==p._styleColorTheme.lut.data)&&p.setColorTheme(b)}}),this._changes.setDirty()}addLayer(d,p,b={}){this._checkLoaded();const M=d.id;if(this._layers[M])return void this.fire(new a.y(new Error(`Layer with id "${M}" already exists on this map`)));let L;if(d.type==="custom"){if(Cm(this,a.dt(d)))return;L=a.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(M,d.source),d=a.dp(d),d=Object.assign(d,{source:M})),this._validate(Od,`layers.${M}`,d,{arrayIndex:-1},b))return;L=a.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(L),L.setEventedParent(this,{layer:{id:M}})}const O=a.B(L.source,L.scope);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O);let z=this._order.length;if(p){const ce=this._order.indexOf(p);if(ce===-1)return void this.fire(new a.y(new Error(`Layer with id "${p}" does not exist on this map.`)));L.slot===this._layers[p].slot?z=ce:a.w(`Layer with id "${p}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(z,0,M),this._layerOrderChanged=!0,this._layers[M]=L;const V=this.getOwnLayerSourceCache(L),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();V&&L.canCastShadows()&&Y&&(V.castsShadows=!0);const Q=this._changes.getRemovedLayer(L);if(Q&&L.source&&V&&L.type!=="custom"){this._changes.discardLayerRemoval(L);const ce=a.B(L.source,L.scope);Q.type!==L.type?this._changes.updateSourceCache(ce,"clear"):(this._changes.updateSourceCache(ce,"reload"),V.pause())}this._updateLayer(L),L.onAdd&&L.onAdd(this.map),L.scope=this.scope,this.mergeLayers()}moveLayer(d,p){this._checkLoaded();const b=this._checkLayer(d);if(!b||d===p)return;const M=this._order.indexOf(d);this._order.splice(M,1);let L=this._order.length;if(p){const O=this._order.indexOf(p);if(O===-1)return void this.fire(new a.y(new Error(`Layer with id "${p}" does not exist on this map.`)));b.slot===this._layers[p].slot?L=O:a.w(`Layer with id "${p}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(L,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const p=this._checkLayer(d);if(!p)return;p.setEventedParent(null);const b=this._order.indexOf(d);this._order.splice(b,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(p.fqid),this._indoorDependentLayers.delete(p.fqid),this._changes.removeLayer(p);const M=this.getOwnLayerSourceCache(p);if(M&&M.castsShadows){let L=!1;for(const O in this._layers)if(this._layers[O].source===p.source&&this._layers[O].canCastShadows()){L=!0;break}M.castsShadows=L}p.onRemove&&p.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const p in this._layers)if(this._layers[p].type===d)return!0;return!1}setLayerZoomRange(d,p,b){this._checkLoaded();const M=this._checkLayer(d);M&&(M.minzoom===p&&M.maxzoom===b||(p!=null&&(M.minzoom=p),b!=null&&(M.maxzoom=b),this._updateLayer(M)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,p){this._checkLoaded();const b=this._checkLayer(d);b&&b.slot!==p&&(b.slot=p,this._updateLayer(b))}setFilter(d,p,b={}){this._checkLoaded();const M=this._checkLayer(d);if(M&&!a.by(M.filter,p))return p==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate(vr,`layers.${M.id}.filter`,p,{layerType:M.type},b)||(M.filter=a.dp(p),this._updateLayer(M)))}getFilter(d){const p=this._checkLayer(d);if(p)return a.dp(p.filter)}setLayoutProperty(d,p,b,M={}){this._checkLoaded();const L=this._checkLayer(d);if(L&&!a.by(L.getLayoutProperty(p),b)){if(b!=null&&(!M||M.validate!==!1)&&Cm(L,bt.call(Mi,{key:`layers.${d}.layout.${p}`,layerType:L.type,objectKey:p,value:b,styleSpec:a.a6,style:{glyphs:!0,sprite:!0}})))return;L.setLayoutProperty(p,b),L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),this._updateLayer(L)}}setLayerProperty(d,p,b,M={}){this._checkLoaded();const L=this._checkLayer(d);L&&(p==="appearances"?(L.setAppearances(b),this._changes.setDirty()):L.isPaintProperty(p)?this.setPaintProperty(d,p,b,M):this.setLayoutProperty(d,p,b,M))}getLayoutProperty(d,p){const b=this._checkLayer(d);if(b)return b.getLayoutProperty(p)}setPaintProperty(d,p,b,M={}){this._checkLoaded();const L=this._checkLayer(d);if(!L||a.by(L.getPaintProperty(p),b)||b!=null&&(!M||M.validate!==!1)&&Cm(L,Vn.call(Mi,{key:`layers.${d}.paint.${p}`,layerType:L.type,objectKey:p,value:b,styleSpec:a.a6})))return;const O=L.setPaintProperty(p,b);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),O&&this._updateLayer(L),this._changes.updatePaintProperties(L)}getPaintProperty(d,p){const b=this._checkLayer(d);if(b)return b.getPaintProperty(p)}setFeatureState(d,p){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:le,sourceLayer:de}of ce)Q.setFeatureState({id:d.id,source:le,sourceLayer:de},p)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},p)}return}const b=d.source,M=d.sourceLayer,L=this._checkSource(b);if(!L)return;const O=L.type;if(O==="geojson"&&M)return void this.fire(new a.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(O==="vector"&&!M)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided.")));const z=this.getOwnSourceCaches(b);for(const V of z)V.setFeatureState(M,d.id,p)}removeFeatureState(d,p){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:le,sourceLayer:de}of ce)Q.removeFeatureState({id:d.id,source:le,sourceLayer:de},p)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},p)}return}const b=d.source,M=this._checkSource(b);if(!M)return;const L=M.type,O=L==="vector"?d.sourceLayer:void 0;if(L==="vector"&&!O)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(p&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new a.y(new Error("A feature id is required to remove its specific state property.")));const z=this.getOwnSourceCaches(b);for(const V of z)V.removeFeatureState(O,d.id,p)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let L;if("featuresetId"in d.target){const{featuresetId:O,importId:z}=d.target,V=this.getFragmentStyle(z),Y=V.getFeaturesetLayers(O);for(const{source:Q,sourceLayer:ce}of Y){const le=V.getFeatureState({id:d.id,source:Q,sourceLayer:ce});if(le&&!L)L=le;else if(!a.by(L,le))return void this.fire(new a.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in d.target){const{layerId:O}=d.target,z=this.getLayer(O);L=this.getFeatureState({id:d.id,source:z.source,sourceLayer:z.sourceLayer})}return L}const p=d.source,b=d.sourceLayer,M=this._checkSource(p);if(M){if(M.type!=="vector"||b)return d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(p)[0].getFeatureState(b,d.id);this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(d){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,d),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const d=this.getTerrain(),p=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return a.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:p,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)},b=>b!==void 0)}_updateFilteredLayers(d){for(const p of Object.values(this._mergedLayers))d(p)&&this._updateLayer(p)}_updateLayer(d){this._changes.updateLayer(d);const p=this.getLayerSourceCache(d),b=a.B(d.source,d.scope),M=this._changes.getUpdatedSourceCaches();d.source&&!M[b]&&p&&p.getSource().type!=="raster"&&(this._changes.updateSourceCache(b,"reload"),p.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const p=z=>this._mergedLayers[z].is3D(!!this.terrain),b=this.order,M={},L=[];for(let z=b.length-1;z>=0;z--){const V=b[z];if(p(V)){M[V]=z;for(const Y of d){const Q=Y[V];if(Q)for(const ce of Q)L.push(ce)}}}L.sort((z,V)=>V.intersectionZ-z.intersectionZ);const O=[];for(let z=b.length-1;z>=0;z--){const V=b[z];if(p(V))for(let Y=L.length-1;Y>=0;Y--){const Q=L[Y].feature;if(Q.layer&&M[Q.layer.id]{if(mk.has(Q.type))return;const ce=this.getOwnLayerSourceCache(Q),le=L[ce.id]=L[ce.id]||{sourceCache:ce,layers:{},has3DLayers:!1};Q.is3D(!!this.terrain)&&(le.has3DLayers=!0),le.layers[Q.fqid]=le.layers[Q.fqid]||{styleLayer:Q,targets:[]},le.layers[Q.fqid].targets.push({filter:M})};if(p&&p.layers){if(!Array.isArray(p.layers))return this.fire(new a.y(new Error("parameters.layers must be an Array."))),[];for(const Q of p.layers){const ce=this._layers[Q];if(!ce)return this.fire(new a.y(new Error(`The layer '${Q}' does not exist in the map's style and cannot be queried for features.`))),[];O(ce)}}else for(const Q in this._layers)O(this._layers[Q]);const z=this._queryRenderedFeatures(d,L,b),V=this._flattenAndSortRenderedFeatures(z),Y=[];for(const Q of V)a.dw(Q.layer.id)===this.scope&&Y.push(Q);return Y}queryRenderedFeatureset(d,p,b){let M;p&&!Array.isArray(p)&&p.filter&&(this._validate(vr,"queryRenderedFeatures.filter",p.filter,null,p),M=a.b6(p.filter));const L="mock",O=[];if(p&&p.target)O.push(Object.assign({},p,{targetId:L,filter:M}));else{const Q=this.getFeaturesetDescriptors();for(const ce of Q)O.push({targetId:L,filter:M,target:ce});for(const{style:ce}of this.fragments){const le=ce.getFeaturesetDescriptors();for(const de of le)O.push({targetId:L,filter:M,target:de})}}const z=this.queryRenderedTargets(d,O,b),V=[],Y=new Set;for(const Q of z)for(const ce of Q.variants[L])Fu(ce,Q,Y)||V.push(new a.dx(Q,ce));return V}queryRenderedTargets(d,p,b){const M={},L=(z,V,Y,Q)=>{const ce=M[V.id]=M[V.id]||{sourceCache:V,layers:{},has3DLayers:!1};if(ce.layers[z.fqid]=ce.layers[z.fqid]||{styleLayer:z,targets:[]},z.is3D(!!this.terrain)&&(ce.has3DLayers=!0),!Q)return Y.uniqueFeatureID=!1,void ce.layers[z.fqid].targets.push(Y);ce.layers[z.fqid].targets.push(Object.assign({},Y,{namespace:Q.namespace,properties:Q.properties,uniqueFeatureID:Q.uniqueFeatureID}))};for(const z of p)if("featuresetId"in z.target){const{featuresetId:V,importId:Y}=z.target,Q=this.getFragmentStyle(Y);if(!Q||!Q._featuresetSelectors)continue;const ce=Q._featuresetSelectors[V];if(!ce){this.fire(new a.y(new Error(`The featureset '${V}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const le of ce){const de=Q.getOwnLayer(le.layerId);de&&!mk.has(de.type)&&L(de,Q.getOwnLayerSourceCache(de),z,le)}}else if("layerId"in z.target){const{layerId:V}=z.target,Y=this.getLayer(V);if(!Y||mk.has(Y.type))continue;L(Y,this.getLayerSourceCache(Y),z)}const O=this._queryRenderedFeatures(d,M,b);return this._flattenAndSortRenderedFeatures(O)}_queryRenderedFeatures(d,p,b){const M=[],L=!!this.map._showQueryGeometry,O=ha.createFromScreenPoints(d,b);for(const z in p){const V=Yl(O,p[z],this._availableImages,b,L);Object.keys(V).length&&M.push(V)}if(this.placement)for(const z in p){if(!p[z].sourceCache._onlySymbols)continue;const V=sp(O.screenGeometry,p[z],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(V).length&&M.push(V)}return M}querySourceFeatures(d,p){const b=p&&p.filter;b&&this._validate(vr,"querySourceFeatures.filter",b,null,p);let M=[];const L=this.getOwnSourceCaches(d);for(const O of L)M=M.concat(wm(O,p));return M}addSourceType(d,p,b){return Wu.getSourceType(d)?b(new Error(`A source type called "${d}" already exists.`)):(Wu.setSourceType(d,p),p.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:p.workerSourceURL},b):b(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,p,b={}){this._checkLoaded();const M=this.light.getLight();let L=!1;for(const z in d)if(!a.by(d[z],M[z])){L=!0;break}if(!L)return;const O=this._getTransitionParameters();this.light.setLight(d,p,b),this.light.updateTransitions(O)}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=a.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,p=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),p===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let b=d;const M=!("source"in d)||d.source==null;if(p===1){if(this.disableElevatedTerrain)return;if("source"in b&&typeof b.source=="object"){const z="terrain-dem-src";this.addSource(z,b.source),b=a.dp(b),b=Object.assign(b,{source:z})}const L=Object.assign({},b),O={};if(this.terrain&&M){L.source=this.terrain.get().source;const z=this.terrain?this.getFragmentStyle(this.terrain.scope):null;z&&(O.style=z.serialize())}if(this._validate(Nc,"terrain",L,O))return}if(!this.terrain||this.terrain.scope!==this.scope&&!M||this.terrain&&p!==this.terrain.drapeRenderMode){if(!b)return;this._createTerrain(b,p),this.fire(new a.z("data",{dataType:"style"}))}else{const L=this.terrain,O=L.get();for(const z of Object.keys(a.a6.terrain))!b.hasOwnProperty(z)&&a.a6.terrain[z].default&&(b[z]=a.a6.terrain[z].default);for(const z in d)if(!a.by(d[z],O[z])){L.set(d,this.options),this.stylesheet.terrain=d;const V=this._getTransitionParameters({duration:0});L.updateTransitions(V),this.fire(new a.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const p=this.fog=new Yn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}_createSnow(d){const p=this.snow=new oo(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}_createRain(d){const p=this.rain=new va(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const d of this.map._markers)d._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(d){if(this._checkLoaded(),!d)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const p=this.fog;if(!a.by(p.get(),d)){p.set(d,this.options),this.stylesheet.fog=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}}else this._createFog(d);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(d){if(this._checkLoaded(),!d)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const p=this.snow;if(!a.by(p.get(),d)){p.set(d,this.options),this.stylesheet.snow=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}}else this._createSnow(d);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(d){if(this._checkLoaded(),!d)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const p=this.rain;if(!a.by(p.get(),d)){p.set(d,this.options),this.stylesheet.rain=p.get();const b=this._getTransitionParameters({duration:0});p.updateTransitions(b)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const M in this._layers)this._layers[M].lut=this._styleColorTheme.lut;for(const M in this._sourceCaches)this._sourceCaches[M].clearTiles()},p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!p)return this._styleColorTheme.lut=null,void d();const b=this._evaluateColorThemeData(p);this._loadColorTheme(b).then(()=>{this.fire(new a.z("colorthemeset")),d()}).catch(M=>{a.w(`Couldn't set color theme: ${M}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&a.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=d,this._reloadColorTheme()}setImportColorTheme(d,p){const b=this.getFragmentStyle(d);b&&(b._styleColorTheme.colorThemeOverride=p,b._reloadColorTheme())}_getTransitionParameters(d){return{now:a.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],p=[];for(const b of this._mergedOrder)this.isLayerDraped(this._mergedLayers[b])?d.push(b):p.push(b);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...p)}_createTerrain(d,p){const b=this.terrain=new At(d,p,this.scope,this.options,this.map.getWorldview());p===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const M=this._getTransitionParameters({duration:0});b.updateTransitions(M)}_force3DLayerUpdate(){for(const d in this._layers){const p=this._layers[d];p.type==="fill-extrusion"&&this._updateLayer(p)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const p=this._layers[d];p.type==="symbol"&&this._updateLayer(p)}}_validate(d,p,b,M,L={}){if(L&&L.validate===!1)return!1;const O=Object.assign({},this.serialize());return Cm(this,d.call(Mi,Object.assign({key:p,style:O,value:b,styleSpec:a.a6},M)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const d in this._mergedLayers)this._mergedLayers[d].setEventedParent(null);for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles(),this._mergedSourceCaches[d].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(d){const p=this.getSourceCaches(d);for(const b of p)b.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const p=this._mergedLayers[d];p._clear&&p._clear()}}reloadSource(d){const p=this.getSourceCaches(d);for(const b of p)b.resume(),b.reload()}reloadSources(){for(const d of this.getSources())d.reload&&d.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(d=>{d.modelManager.reloadModels(d.scope)})}updateSources(d){let p;this.directionalLight&&(p=av(this.directionalLight));const b=new Set,M=new Set;for(const L in this._mergedLayers){const O=this._mergedLayers[L];O.type==="building"&&b.add(O.source),O.hasElevation()&&!M.has(O.source)&&M.add(O.source)}for(const L in this._mergedSourceCaches){const O=this._mergedSourceCaches[L],z=M.has(O._source.id);b.has(O._source.id)&&(O._source.reparseOverscaled=!1),O.update(d,void 0,void 0,p,z)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const p=this._sourceCaches[d];p.resume(),p.reload()}}_updatePlacement(d,p,b,M,L,O,z=!1){let V=!1,Y=!1;const Q={},ce={};for(const xe of this._mergedOrder){const Pe=this._mergedLayers[xe];if(Pe.type!=="symbol")continue;const Ee=a.B(Pe.source,Pe.scope);let $e=Q[Ee];if(!$e){const Ue=this.getLayerSourceCache(Pe);if(!Ue)continue;const mt=Ue.getRenderableIds(!0).map(ct=>Ue.getTileByID(ct));ce[Ee]=mt.slice(),$e=Q[Ee]=mt.sort((ct,ht)=>ht.tileID.overscaledZ-ct.tileID.overscaledZ||(ct.tileID.isLessThan(ht.tileID)?-1:1))}const Ke=this.crossTileSymbolIndex.addLayer(Pe,$e,p.center.lng,p.projection);V=V||Ke}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),z=z||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new a.z("neworder"));const le=!!(this.placement&&!p.equals(this.placement.transform)),de=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!O||this.placement.lastReplacementSourceUpdateTime!==O.updateTime)),be=(le||de||V||this.placement&&this.placement.isStale())&&M===0;if((z||!this.pauseablePlacement||be||M!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.o.now(),p.zoom))&&(this.pauseablePlacement=new dl(p,this._mergedOrder,z||M===0,b,M,L,this.placement,this.fog&&p.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,Q,ce,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.o.now()),Y=!0),V&&this.pauseablePlacement.placement.setStale()),Y||V){this._buildingIndex.onNewFrame(p.zoom);for(let xe=0;xeL===d.id)!==-1)return void this.fire(new a.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!p)return b.push(d),this._loadImports([d],!0);const M=b.findIndex(({id:L})=>L===p);return M===-1&&this.fire(new a.y(new Error(`Import with id "${p}" does not exist on this map.`))),this.stylesheet.imports=b.slice(0,M).concat(d).concat(b.slice(M)),this._loadImports([d],!0,p)}updateImport(d,p){this._checkLoaded();const b=this.stylesheet.imports||[],M=this.getImportIndex(d);return M===-1?this:typeof p=="string"?(this.setImportUrl(d,p),this):(p.url&&p.url!==b[M].url&&this.setImportUrl(d,p.url),a.by(p.config,b[M].config)||this.setImportConfig(d,p.config,p.data.schema),a.by(p.data,b[M].data)||this.setImportData(d,p.data),this)}moveImport(d,p){this._checkLoaded();let b=this.stylesheet.imports||[];const M=this.getImportIndex(d);if(M===-1)return this;const L=this.getImportIndex(p);if(L===-1)return this;const O=b[M],z=this.fragments[M];return b=b.filter(({id:V})=>V!==d),this.fragments=this.fragments.filter(({id:V})=>V!==d),this.stylesheet.imports=b.slice(0,L).concat(O).concat(b.slice(L)),this.fragments=this.fragments.slice(0,L).concat(z).concat(this.fragments.slice(L)),this.mergeLayers(),this}setImportUrl(d,p){this._checkLoaded();const b=this.stylesheet.imports||[],M=this.getImportIndex(d);if(M===-1)return this;b[M].url=p;const L=this.fragments[M];return L.style=this._createFragmentStyle(b[M]),L.style.on("style.import.load",()=>this.mergeAll()),L.style.loadURL(p),this}setImportData(d,p){this._checkLoaded();const b=this.getImportIndex(d),M=this.stylesheet.imports||[];return b===-1?this:p?(this.fragments[b].style.setState(p),this._reloadImports(),this):(delete M[b].data,this.setImportUrl(d,M[b].url))}setImportConfig(d,p,b){this._checkLoaded();const M=this.getImportIndex(d),L=this.stylesheet.imports||[];if(M===-1)return this;p?L[M].config=p:delete L[M].config;const O=this.fragments[M];b&&O.style.stylesheet&&(O.style.stylesheet.schema=b);const z=O.style.stylesheet&&O.style.stylesheet.schema;return O.config=p,O.style.updateConfig(p,z),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const p=this.stylesheet.imports||[],b=this.getImportIndex(d);b!==-1&&(p.splice(b,1),this.fragments[b].style._remove(),this.fragments.splice(b,1),this._reloadImports())}getImportIndex(d){const p=(this.stylesheet.imports||[]).findIndex(b=>b.id===d);return p===-1&&this.fire(new a.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),p}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const p in this._mergedOtherSourceCaches){const b=this._mergedOtherSourceCaches[p];b&&d.push(b.getSource())}return d}getSource(d,p){const b=this.getSourceCache(d,p);return b&&b.getSource()}getLayerSource(d){const p=this.getLayerSourceCache(d);return p&&p.getSource()}getSourceCache(d,p){const b=a.B(d,p);return this._mergedOtherSourceCaches[b]}getLayerSourceCache(d){const p=a.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[p]:this._mergedOtherSourceCaches[p]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const p=[];return this._mergedOtherSourceCaches[d]&&p.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&p.push(this._mergedSymbolSourceCaches[d]),p}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const p in d){const b=d[p];b==="reload"?this.reloadSource(p):b==="clear"&&this.clearSource(p)}}updateLayers(d){const p=this._changes.getUpdatedPaintProperties();for(const b of p){const M=this.getLayer(b);M&&M.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,p,b){this.imageManager.getImages(p.images,p.scope,b),this._updateTilesForChangedImages();const M=O=>{if(O){const z=p.images.map(V=>a.I.toString(V));O.setDependencies(p.tileID.key,p.type,z)}},L=a.B(p.source,p.scope);M(this._mergedOtherSourceCaches[L]),M(this._mergedSymbolSourceCaches[L]),p.images.some(O=>O.iconsetId)&&this.fire(new a.z("data",{dataType:"style"}))}rasterizeImages(d,p,b){this.imageManager.rasterizeImages(p,b)}getGlyphs(d,p,b){this.glyphManager.getGlyphs(p.stacks,b)}getResource(d,p,b){return a.dz(p,b)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const p=[];return this._otherSourceCaches[d]&&p.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&p.push(this._symbolSourceCaches[d]),p}_isSourceCacheLoaded(d){const p=this.getOwnSourceCaches(d);return p.length===0?(this.fire(new a.y(new Error(`There is no source with ID '${d}'`))),!1):p.every(b=>b.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,p){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const b=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),M=d.type==="building";if(d.is3D(!!this.terrain)){if(b||M||p&&p.type==="batched-model"||d.type==="model")return!0}else if(d.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(d=>{d.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Wu.getSourceType=function(_){return ru[_]},Wu.setSourceType=function(_,d){ru[_]=d},Wu.registerForPluginStateChange=a.dA;class UI extends a.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},a.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(d){d===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=d,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(d){this._activeFloorsVisible=d,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(d){for(const[p,b]of Object.entries(d.buildings))if(this._buildings[p])for(const M of b.floorIds)this._buildings[p].floors[M]||(this._buildings[p].floors[M]=b.floors[M]);else this._buildings[p]=b;for(const p of d.activeFloors)this._activeFloors.add(p);this._updateIndoorSelector()}getIndoorTileOptions(d,p){const b=this._style.getIndoorSourceLayers(d,p);return b&&this._indoorState?{sourceLayers:b,indoorState:this._indoorState}:null}_updateUI(d,p,b){const M=function(L,O,z,V){let Y=null,Q=Number.MAX_SAFE_INTEGER;if(V<16)return null;for(const[ce,le]of Object.entries(L)){const de=le.center;if(de){const be=O.distanceTo(a.aT.convert(de));be({id:O,name:b.floors[O].name,zIndex:b.floors[O].zIndex})).sort((O,z)=>z.zIndex-O.zIndex);this.fire(new a.z("selector-update",{selectedFloorId:M,activeFloorsVisible:this._activeFloorsVisible,floors:L}))}_updateActiveFloors(){const d=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:d,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var gy=` #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`,xy=` #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;}`,P5=` #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`,gk="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;}",su=` #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`,xk=`#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`,Mr=`#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`,L5=`#ifdef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) );}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) );}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} #endif`,yk=`#ifdef RASTER_ARRAY uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} #endif uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,vk=`#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`,O5=`#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 lv=/#include\s+"([^"]+)"/g,df=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,D5=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,zg=new Set(["ifdef","ifndef","elif","if","defined"]),Bg=new Set;Am(gy,Bg),Am(P5,Bg),Am(xy,Bg);const Tm={"_prelude_fog.vertex.glsl":xk,"_prelude_terrain.vertex.glsl":su,"_prelude_shadow.vertex.glsl":vk,"_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":Mr,"_prelude_shadow.fragment.glsl":O5,"_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":L5,"_prelude_raster_particle.glsl":yk},_k={};Ks("",su),Ks(Mr,xk),Ks(O5,vk),Ks(L5,""),Ks(yk,"");const qI=Ks(xy,P5),bk=gy,zie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",bk,qI.fragmentSource].join(` `),VI=["precision highp float;",bk,qI.vertexSource].join(` `);var R5={background:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`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:Ks(`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:Ks(`#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:Ks("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:Ks(`#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:Ks(`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:Ks("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:Ks("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:Ks("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:Ks(`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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`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:Ks(`#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:Ks(`#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:Ks(`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:Ks(`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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`#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:Ks("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:Ks("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:Ks(`#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:Ks(`#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:Ks(`#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:Ks("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:Ks(`#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 }`,gk),skyboxGradient:Ks(`#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 }`,gk),skyboxCapture:Ks(` 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:Ks(`#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:Ks(`#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:Ks(`#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:Ks(`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:Ks(`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:Ks("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:Ks("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:Ks("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:Ks("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 Am(_,d){const p=_.split(` `);for(let b of p){if(b=b.trimStart(),b[0]!=="#"||!b.includes("if")||b.startsWith("#endif"))continue;const M=b.match(D5);if(M)for(const L of M)zg.has(L)||d.add(L)}}function Ks(_,d){const p=new Set,b=[],M=[];_=_.replace(lv,(O,z)=>(M.push(z),"")),d=d.replace(lv,(O,z)=>(b.push(z),""));let L=new Set(Bg);Am(_,L),Am(d,L);for(const O of[...b,...M])_k[O]||(_k[O]=new Set,Am(Tm[O],_k[O])),L=new Set([...L,..._k[O]]);return{fragmentSource:_=_.replace(df,(O,z,V,Y,Q)=>(p.add(Q),z==="define"?` #ifndef HAS_UNIFORM_u_${Q} in ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:z==="initialize"?` #ifdef HAS_UNIFORM_u_${Q} ${V} ${Y} ${Q} = u_${Q}; #endif `:z==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} ${Q}; #endif `:z==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(df,(O,z,V,Y,Q)=>{const ce=`MATERIAL_ATTRIBUTE_OFFSET_${Q}`,le=Y==="float"?"vec2":Y,de=`GET_ATTRIBUTE_${le}(a_${Q}, materialInfo, ${ce})`,be=Q.match(/color/)?"color":le;return z==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; #endif `:p.has(Q)?z==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${le} a_${Q}; #endif out ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:z==="initialize"?be==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} ${Q} = a_${Q}; #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #if !defined(HAS_UNIFORM_u_${Q}) #ifdef ${ce} ${Q} = unpack_mix_${be}(${de}, u_${Q}_t); #else ${Q} = unpack_mix_${be}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:z==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; out ${V} ${Y} ${Q}; #endif `:z==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${Q} = a_${Q}; #endif `:void 0:z==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${le} a_${Q}; #endif #else uniform ${V} ${Y} u_${Q}; #endif `:z==="define-instanced"?be==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${Q}0; in vec4 a_${Q}1; in vec4 a_${Q}2; in vec4 a_${Q}3; #else uniform ${V} ${Y} u_${Q}; #endif `:` #ifdef INSTANCED_ARRAYS in ${V} ${le} a_${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:z==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${V} ${Y} ${Q} = a_${Q}; #endif `:be==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = ${de}; #else ${V} ${Y} ${Q} = a_${Q}; #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = unpack_mix_${be}(${de}, u_${Q}_t); #else ${V} ${Y} ${Q} = unpack_mix_${be}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `}),usedDefines:L,vertexIncludes:b,fragmentIncludes:M}}class Bie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,p,b,M,L,O,z,V){this.context=d;let Y=this.boundPaintVertexBuffers.length!==M.length;for(let ce=0;!Y&&ce{const mt=Ke.paint.get("hillshade-shadow-color"),ct=Ke.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ht=Ke.paint.get("hillshade-highlight-color"),ot=Ke.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",st=Ke.paint.get("hillshade-accent-color"),_t=Ke.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",It=Ke.paint.get("hillshade-emissive-strength");let Tt=a.an(Ke.paint.get("hillshade-illumination-direction"));if(Ke.paint.get("hillshade-illumination-anchor")==="viewport")Tt-=Ee.transform.angle;else if(Ee.style&&Ee.style.enable3dLights()&&Ee.style.directionalLight){const Ht=Ee.style.directionalLight.properties.get("direction"),nr=a.d4(Ht.x,Ht.y,Ht.z);Tt=a.an(nr[1])}const Vt=!Ee.options.moving;return{u_matrix:Ue||Ee.transform.calculateProjMatrix($e.tileID.toUnwrapped(),Vt),u_image:0,u_latrange:$ie(0,$e.tileID),u_light:[Ke.paint.get("hillshade-exaggeration"),Tt],u_shadow:mt.toPremultipliedRenderColor(ct?null:Ke.lut),u_highlight:ht.toPremultipliedRenderColor(ot?null:Ke.lut),u_emissive_strength:It,u_accent:st.toPremultipliedRenderColor(_t?null:Ke.lut)}})(_,p,b,_.terrain?d.projMatrix:null);_.uploadCommonUniforms(z,le,d.toUnwrapped());const{tileBoundsBuffer:be,tileBoundsIndexBuffer:xe,tileBoundsSegments:Pe}=_.getTileBoundsBuffers(p);le.draw(_,V.TRIANGLES,M,L,O,Fn.disabled,de,b.id,be,xe,Pe)}function F5(_,d,p){if(!d.needsDEMTextureUpload)return;const b=_.context,M=b.gl;b.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||_.getTileTexture(p.stride);const L=p.getPixels();d.demTexture?d.demTexture.update(L,{premultiply:!1}):d.demTexture=new a.T(b,L,M.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function qie(_,d,p){const b=_.context,M=b.gl;if(!d.dem)return;const L=d.dem;if(b.activeTexture.set(M.TEXTURE1),F5(_,d,L),!d.demTexture)return;d.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);const O=L.dim;b.activeTexture.set(M.TEXTURE0);let z=d.hillshadeFBO;if(!z){const le=new a.T(b,{width:O,height:O,data:null},M.RGBA8);le.bind(M.LINEAR,M.CLAMP_TO_EDGE),z=d.hillshadeFBO=b.createFramebuffer(O,O,1,"renderbuffer"),z.colorAttachment0.set(le.texture)}b.bindFramebuffer.set(z.framebuffer),b.viewport.set([0,0,O,O]);const{tileBoundsBuffer:V,tileBoundsIndexBuffer:Y,tileBoundsSegments:Q}=_.getMercatorTileBoundsBuffers(),ce=[];_.linearFloatFilteringSupported()&&ce.push("TERRAIN_DEM_FLOAT_FORMAT"),_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ce.push("USE_MRT1"),_.getOrCreateProgram("hillshadePrepare",{defines:ce}).draw(_,M.TRIANGLES,cn.disabled,zn.disabled,ns.unblended,Fn.disabled,((le,de)=>{const be=de.stride,xe=a.bC();return a.ce(xe,0,a.al,-a.al,0,0,1),a.br(xe,xe,[0,-a.al,0]),{u_matrix:xe,u_image:1,u_dimension:[be,be],u_zoom:le.overscaledZ}})(d.tileID,L),p.id,V,Y,Q),d.needsHillshadePrepare=!1}class _a{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Vie extends _a{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const p=this.current;(d.r!==p.r||d.g!==p.g||d.b!==p.b||d.a!==p.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class HI extends _a{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class z5 extends _a{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class wk extends _a{getDefault(){return[!0,!0,!0,!0]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class B5 extends _a{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class $g extends _a{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class yy extends _a{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const p=this.current;(d.func!==p.func||d.ref!==p.ref||d.mask!==p.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class cv extends _a{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class vy extends _a{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.STENCIL_TEST):p.disable(p.STENCIL_TEST),this.current=d,this.dirty=!1}}class WI extends _a{getDefault(){return[0,1]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class $5 extends _a{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.DEPTH_TEST):p.disable(p.DEPTH_TEST),this.current=d,this.dirty=!1}}class GI extends _a{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class _y extends _a{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.BLEND):p.disable(p.BLEND),this.current=d,this.dirty=!1}}class jk extends _a{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class kk extends _a{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const p=this.current;(d.r!==p.r||d.g!==p.g||d.b!==p.b||d.a!==p.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class U5 extends _a{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(d,d),this.current=d,this.dirty=!1)}}class Nk extends _a{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.CULL_FACE):p.disable(p.CULL_FACE),this.current=d,this.dirty=!1}}class dv extends _a{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class KI extends _a{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let ZI=class extends _a{getDefault(){return null}set(_){(_!==this.current||this.dirty)&&(this.gl.useProgram(_),this.current=_,this.dirty=!1)}};class YI extends _a{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class by extends _a{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class XI extends _a{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindFramebuffer(p.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class Hie extends _a{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindRenderbuffer(p.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Wie extends _a{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindTexture(p.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Gie extends _a{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindBuffer(p.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class q5 extends _a{getDefault(){return null}set(d){const p=this.gl;p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class V5 extends _a{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class H5 extends _a{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class W5 extends _a{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class QI extends _a{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Sk extends _a{constructor(d,p){super(d),this.context=d,this.parent=p}getDefault(){return null}}class Ck extends Sk{constructor(d,p,b=0){super(d,p),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+b}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferTexture2D(p.FRAMEBUFFER,this.attachmentPoint,p.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class wy extends Sk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferRenderbuffer(p.FRAMEBUFFER,this.attachment(),p.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class uv extends Sk{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferTexture2D(p.FRAMEBUFFER,this.attachment(),p.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class JI extends wy{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const iu=(_,d,p,b)=>({u_matrix:_,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:p,u_emissive_texture_available:b}),Mk=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe)=>({u_proj_matrix:Float32Array.from(_),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(b),u_merc_matrix:p,u_zoom_transition:M,u_merc_center:L,u_image0:0,u_image1:1,u_frustum_tl:O,u_frustum_tr:z,u_frustum_br:V,u_frustum_bl:Y,u_globe_pos:Q,u_globe_radius:ce,u_viewport:le,u_grid_matrix:Pe?Float32Array.from(Pe):new Float32Array(9),u_skirt_height:de,u_far_z_cutoff:be,u_emissive_texture_available:xe});function hv(_,d){return _!=null&&d!=null&&!(!_.hasData()||!d.hasData())&&_.demTexture!=null&&d.demTexture!=null&&_.tileID.key!==d.tileID.key}const hp=new class{constructor(){this.operations={}}newMorphing(_,d,p,b,M){if(_ in this.operations){const L=this.operations[_];L.to.tileID.key!==p.tileID.key&&(L.queued=p)}else this.operations[_]={startTime:b,phase:0,duration:M,from:d,to:p,queued:null}}getMorphValuesForProxy(_){if(!(_ in this.operations))return null;const d=this.operations[_];return{from:d.from,to:d.to,phase:d.phase}}update(_){for(const d in this.operations){const p=this.operations[d];for(p.phase=(_-p.startTime)/p.duration;p.phase>=1||!this._validOp(p);)if(!this._nextOp(p,_)){delete this.operations[d];break}}}_nextOp(_,d){return!!_.queued&&(_.from=_.to,_.to=_.queued,_.queued=null,_.phase=0,_.startTime=d,!0)}_validOp(_){return _.from.hasData()&&_.to.hasData()}},Tk={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Ak(_,d,p){if(d===0)return 0;const b=d<1&&p===514?.25/d:1;return 6*Math.pow(1.5,22-_)*Math.max(d,1)*b}function G5(_,d){const p=1<<_.z;return!d&&(_.x===0||_.x===p-1)||_.y===0||_.y===p-1}function jy(_,d){if(!_.style||!_.style.enable3dLights())return;const p=_.context,b=p.gl;p.activeTexture.set(b.TEXTURE1),d?d.bind(b.LINEAR,b.CLAMP_TO_EDGE):_.emptyTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE)}const fv=_=>({u_matrix:_});function pv(_,d,p,b,M){if(M>0){const L=a.o.now(),O=(L-_.timeAdded)/M,z=d?(L-d.timeAdded)/M:-1,V=p.getSource(),Y=b.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(_.tileID.overscaledZ-Y),ce=Q&&_.refreshedUponExpiration?1:a.aA(Q?O:1-z,0,1);return d?{opacity:1,mix:1-ce,isFading:O<1}:{opacity:ce,mix:0,isFading:O<1}}return{opacity:1,mix:0,isFading:!1}}class Ek extends Vc{constructor(d){const p=Do("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",p,!1),p.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,p){d.state="loaded",p(null)}}class K5 extends Vc{constructor(d){const p=Do("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",p,!1),p.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,p,b){if(d.freezeTileCoverage)return;this.transform=d;const M=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((L,O)=>{if(L[O.key]="",!this._tiles[O.key]){const z=new ap(O,this._source.tileSize*O.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);z.state="loaded",this._tiles[O.key]=z}return L},{});for(const L in this._tiles)L in M||(this.freeFBO(L),this._tiles[L].unloadVectorData(),delete this._tiles[L])}freeFBO(d){const p=this.proxyCachedFBO[d];if(p!==void 0){const b=Object.values(p);this.renderCachePool.push(...b),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Z5 extends a.aQ{constructor(d,p,b){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=p,this.projMatrix=b}}class Y5 extends a.bV{constructor(d,p){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[b,M,L]=function(V){const Y=new a.bd,Q=new a.b0,ce=131;Y.reserve(17161),Q.reserve(33800);const le=a.al/128,de=a.al+le/2,be=de+le;for(let Pe=-le;Pede||Pe<0||Pe>de?24575:0,Ke=a.aA(Math.round(Ee),0,a.al),Ue=a.aA(Math.round(Pe),0,a.al);Y.emplaceBack(Ke+$e,Ue)}const xe=(Pe,Ee)=>{const $e=Ee*ce+Pe;Q.emplaceBack($e+1,$e,$e+ce),Q.emplaceBack($e+ce,$e+ce+1,$e+1)};for(let Pe=1;Pe<129;Pe++)for(let Ee=1;Ee<129;Ee++)xe(Ee,Pe);return[0,129].forEach(Pe=>{for(let Ee=0;Ee<130;Ee++)xe(Ee,Pe),xe(Pe,Ee)}),[Y,Q,32768]}(),O=d.context;this.gridBuffer=O.createVertexBuffer(b,a.bf.members),this.gridIndexBuffer=O.createIndexBuffer(M),this.gridSegments=a.bg.simpleSegment(0,0,b.length,M.length),this.gridNoSkirtSegments=a.bg.simpleSegment(0,0,b.length,L),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new K5(p.map),this.orthoMatrix=a.bC(),a.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.al,0,a.al,0,1);const z=O.gl;this._overlapStencilMode=new zn({func:z.GEQUAL,mask:255},0,255,z.KEEP,z.KEEP,z.REPLACE),this._previousZoom=d.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=p,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Ek(p.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(d){d.on("data",this._onStyleDataEvent.bind(this)),this._style=d,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(d,p,b){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const M=d.terrain.properties,L=d.terrain.drapeRenderMode===0,O=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.o.now();const z=d.terrain&&d.terrain.scope,V=M.get("source"),Y=L?this._mockSourceCache:d.getSourceCache(V,z);if(!Y)return void a.w(`Couldn't find terrain source "${V}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=O?this.calculateExaggeration(p):M.get("exaggeration"),!p.projection.requiresDraping&&O&&this._exaggeration===0)return void this._disable();this.enabled=!0;const Q=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const ce=this.getScaledDemTileSize();this.sourceCache.update(p,ce,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,Q(),this._initializing=!0),Q(),p.updateElevation(!0,b),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(p),this._emptyDEMTextureDirty=!0,this._previousZoom=p.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const p=this._previousCameraAltitude,b=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=b;const M=p!=null?b-p:Number.MAX_VALUE;if(Math.abs(M)<2)return this._exaggeration;const L=d.zoom,O=this._style.terrain;if(!this._previousUpdateTimestamp)return O.getExaggeration(L);let z=L-this._previousZoom;const V=this._previousUpdateTimestamp;let Y=L;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(L-Y)>.5&&(z=.5*(L-Y+z)),z*M<0&&(Y+=z)),this._evaluationZoom=Y;const Q=O.getExaggeration(Y),ce=Q===O.getExaggeration(Math.max(0,Y-.1));if(ce&&Math.abs(Q-this._exaggeration)<.01)return Q;let le=Math.min(.1,.00375*(this._updateTimestamp-V));return(ce||Q<.1||Math.abs(z)<1e-4)&&(le=Math.min(.2,4*le)),a.ak(this._exaggeration,Q,le)}resetTileLookupCache(d){this._findCoveringTileCache[d]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(d){d.dataType==="source"&&d.coord?this._clearRenderCacheForTile(d.sourceCacheId,d.coord):d.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const d in this._style._mergedSourceCaches)this._style._mergedSourceCaches[d].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(d=>d.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const d=2*this.proxySourceCache.getSource().tileSize;return[d,d]}set useVertexMorphing(d){this._useVertexMorphing=d}updateTileBinding(d){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const p=this.proxySourceCache,b=this.painter.transform;this._initializing&&(this._initializing=b._centerAltitude===0&&this.getAtPointOrZero(a.ae.fromLngLat(b.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const M=this.proxyCoords=p.getIds().map(V=>{const Y=p.getTileByID(V).tileID;return Y.projMatrix=b.calculateProjMatrix(Y.toUnwrapped()),Y});(function(V,Y){const Q=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),ce=new a.P(Q.x,Q.y);V.sort((le,de)=>{if(de.overscaledZ-le.overscaledZ)return de.overscaledZ-le.overscaledZ;const be=new a.P(le.canonical.x+(1<{this.proxyToSource[V.key]={}}),this.terrainTileForTile={};const O=this._style._mergedSourceCaches;for(const V in O){const Y=O[V];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[V],L),Y.usedForTerrain))continue;const Q=d[V];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(Q)}this.proxiedCoords[p.id]=M.map(V=>new Z5(V,V.key,this.orthoMatrix)),this._assignTerrainTiles(M),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(L),this.renderingToTexture=!1;const z={};this._visibleDemTiles=[];for(const V of this.proxyCoords){const Y=this.terrainTileForTile[V.key];if(!Y)continue;const Q=Y.tileID.key;Q in z||(this._visibleDemTiles.push(Y),z[Q]=Q)}}_assignTerrainTiles(d){this._initializing||d.forEach(p=>{if(this.terrainTileForTile[p.key])return;const b=this._findTileCoveringTileID(p,this.sourceCache);b&&(this.terrainTileForTile[p.key]=b)})}_prepareDEMTextures(){const d=this.painter.context,p=d.gl;for(const b in this.terrainTileForTile){const M=this.terrainTileForTile[b],L=M.dem;!L||M.demTexture&&!M.needsDEMTextureUpload||(d.activeTexture.set(p.TEXTURE1),F5(this.painter,M,L))}}_prepareDemTileUniforms(d,p,b,M){if(!p||p.demTexture==null)return!1;const L=d.tileID.canonical,O=Math.pow(2,p.tileID.canonical.z-L.z),z=M||"";return b[`u_dem_tl${z}`]=[L.x*O%1,L.y*O%1],b[`u_dem_scale${z}`]=O,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const p=this._visibleDemTiles.reduce((b,M)=>{if(!M.dem)return b;const L=M.dem.tree.minimums[0];return L>0&&d++,b+L},0);return d?p/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,p=d.gl;d.activeTexture.set(p.TEXTURE2);const b=this._getLoadedAreaMinimum(),M=new a.dL({width:1,height:1},new Float32Array([b]));this._emptyDEMTextureDirty=!1;let L=this._emptyDEMTexture;return L?L.update(M,{premultiply:!1}):L=this._emptyDEMTexture=new a.T(d,M,p.R32F,{premultiply:!1}),L}setupElevationDraw(d,p,b){const M=this.painter.context,L=M.gl,O={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};O.u_exaggeration=this.exaggeration();let z=null,V=null,Y=1;if(b&&b.morphing&&this._useVertexMorphing){const de=b.morphing.srcDemTile,be=b.morphing.dstDemTile;Y=b.morphing.phase,de&&be&&(this._prepareDemTileUniforms(d,de,O,"_prev")&&(V=de),this._prepareDemTileUniforms(d,be,O)&&(z=be))}const Q=de=>de&&de.demTexture&&this.painter.linearFloatFilteringSupported()?L.LINEAR:L.NEAREST;let ce=null;var le;if(this.enabled?V&&z?(ce=z.demTexture,M.activeTexture.set(L.TEXTURE4),V.demTexture.bind(Q(V),L.CLAMP_TO_EDGE),O.u_dem_lerp=Y):(z=this.terrainTileForTile[d.tileID.key],ce=this._prepareDemTileUniforms(d,z,O)?z.demTexture:this.emptyDEMTexture):ce=this.emptyDEMTexture,M.activeTexture.set(L.TEXTURE2),ce&&(O.u_dem_size=(le=ce).size[0]===1?1:le.size[0]-2,ce.bind(Q(z),L.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(b&&b.useDepthForOcclusion,p,O),b&&b.useMeterToDem&&z){const de=(1<{if(Ee===Ht)return;const nr=[Tk[Ht],"PROJECTION_GLOBE_VIEW"];Ke&&nr.push("CUSTOM_ANTIALIASING");const br=Y.isTileAffectedByFog(Vt);Pe=Y.getOrCreateProgram("globeRaster",{defines:nr,overrideFog:br}),Ee=Ht},mt=Y.colorModeForRenderPass(),ct=new cn(xe.LEQUAL,cn.ReadWrite,Y.depthRangeFor3D);hp.update(de);const ht=a.dF($e),ot=[a.aF($e.center.lng),a.aJ($e.center.lat)],st=Y.globeSharedBuffers,_t=[$e.width*a.o.devicePixelRatio,$e.height*a.o.devicePixelRatio],It=Float32Array.from($e.globeMatrix),Tt={useDenormalizedUpVectorScale:!0};{const Vt=Y.transform,Ht=Ak(Vt.zoom,Q.exaggeration(),Q.sourceCache._source.tileSize);Ee=-1;const nr=xe.TRIANGLES;for(const br of le){const zt=ce.getTile(br),Nt=zn.disabled,Zt=Q.prevTerrainTileForTile[br.key],qt=Q.terrainTileForTile[br.key];hv(Zt,qt)&&hp.newMorphing(br.key,Zt,qt,de,250),jy(Y,zt.emissiveTexture),be.activeTexture.set(xe.TEXTURE0),zt.texture&&zt.texture.bind(xe.LINEAR,xe.CLAMP_TO_EDGE);const ur=hp.getMorphValuesForProxy(br.key),Ar=ur?1:0;ur&&Object.assign(Tt,{morphing:{srcDemTile:ur.from,dstDemTile:ur.to,phase:a.dD(ur.phase)}});const qr=a.dG(br.canonical),Sr=a.dH(qr.getCenter().lat),wr=a.dI(br.canonical,qr,Sr,Vt.worldSize/Vt._pixelsPerMercatorPixel),nn=a.bk(a.dJ(br.canonical)),Jr=Y.emissiveMode==="mrt-fallback"?1:0,Rr=Mk(Vt.expandedFarZProjMatrix,It,ht,nn,a.aj(Vt.zoom),ot,Vt.frustumCorners.TL,Vt.frustumCorners.TR,Vt.frustumCorners.BR,Vt.frustumCorners.BL,Vt.globeCenterInViewSpace,Vt.globeRadius,_t,Ht,Vt._farZ,Jr,wr);if(Ue(br,Ar),Pe&&(Q.setupElevationDraw(zt,Pe,Tt),Y.uploadCommonUniforms(be,Pe,br.toUnwrapped()),st)){const[Vr,jn,Kn]=st.getGridBuffers(Sr,Ht!==0);Pe.draw(Y,nr,ct,Nt,mt,Fn.backCCW,Rr,"globe_raster",Vr,jn,Kn)}}}if(st&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Vt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Ke&&Vt.push("CUSTOM_ANTIALIASING"),Pe=Y.getOrCreateProgram("globeRaster",{defines:Vt});for(const Ht of le){const{x:nr,y:br,z:zt}=Ht.canonical,Nt=br===0,Zt=br===(1<Vr.draw(Y,xe.TRIANGLES,ct,zn.disabled,mt,Fn.disabled,Mk($e.expandedFarZProjMatrix,wr,wr,nn,0,ot,$e.frustumCorners.TL,$e.frustumCorners.TR,$e.frustumCorners.BR,$e.frustumCorners.BL,$e.globeCenterInViewSpace,$e.globeRadius,_t,0,$e._farZ,Jr),"globe_pole_raster",jn,Ar,qr);Q.setupElevationDraw(Sr,Pe,Tt),Y.uploadCommonUniforms(be,Pe,Ht.toUnwrapped()),Nt&&Y.renderDefaultNorthPole&&Rr(Pe,qt),Zt&&Y.renderDefaultSouthPole&&(wr=a.cS(a.bC(),wr,[1,-1,1]),Rr(Pe,ur))}}}})(M,L,O,z,V);else{const Y=M.context,Q=Y.gl;let ce,le;const de=M.shadowRenderer,be=Nm(M,M.longestCutoffRange),xe=mt=>{if(le===mt)return;const ct=[];ct.push(Tk[mt]),be.shouldRenderCutoff&&ct.push("RENDER_CUTOFF"),de&&(ct.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&ct.push("NORMAL_OFFSET")),ce=M.getOrCreateProgram("terrainRaster",{defines:ct}),le=mt},Pe=M.colorModeForRenderPass(),Ee=new cn(Q.LEQUAL,cn.ReadWrite,M.depthRangeFor3D);hp.update(V);const $e=M.transform,Ke=Ak($e.zoom,L.exaggeration(),L.sourceCache._source.tileSize);let Ue=[0,0,0];if(de){const mt=M.style.directionalLight,ct=M.style.ambientLight;mt&&ct&&(Ue=up(M.style,mt,ct))}{le=-1;const mt=Q.TRIANGLES,[ct,ht]=[L.gridIndexBuffer,L.gridSegments];for(const ot of z){const st=O.getTile(ot),_t=zn.disabled,It=L.prevTerrainTileForTile[ot.key],Tt=L.terrainTileForTile[ot.key];hv(It,Tt)&&hp.newMorphing(ot.key,It,Tt,V,250),jy(M,st.emissiveTexture),Y.activeTexture.set(Q.TEXTURE0),st.texture&&st.texture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const Vt=hp.getMorphValuesForProxy(ot.key),Ht=Vt?1:0;let nr;Vt&&(nr={morphing:{srcDemTile:Vt.from,dstDemTile:Vt.to,phase:a.dD(Vt.phase)}});const br=M.emissiveMode==="mrt-fallback"?1:0,zt=iu(ot.projMatrix,G5(ot.canonical,$e.renderWorldCopies)?Ke/10:Ke,Ue,br);if(xe(Ht),!ce)continue;L.setupElevationDraw(st,ce,nr);const Nt=ot.toUnwrapped();de&&de.setupShadows(Nt,ce),M.uploadCommonUniforms(Y,ce,Nt,null,be),ce.draw(M,mt,Ee,_t,Pe,Fn.backCCW,zt,"terrain_raster",L.gridBuffer,ct,ht)}}}}(p,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,p.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const p=this.painter,b=this.painter.context,M=this.proxySourceCache,L=this.proxiedCoords[M.id],O=this._drapedRenderBatches.shift(),z=p.style.order,V=[];this._updateFBOs(p.emissiveMode==="mrt-fallback");let Y=0;for(const Q of L){const ce=M.getTileByID(Q.proxyTileKey),le=M.proxyCachedFBO[Q.key]?M.proxyCachedFBO[Q.key][d]:void 0,de=le!==void 0?M.renderCache[le]:this.pool[Y++],be=le!==void 0;if(ce.texture=de.tex,ce.emissiveTexture=de.emissiveTex,be&&!de.dirty){V.push(ce.tileID);continue}b.bindFramebuffer.set(de.fb.framebuffer);const xe=b.gl;let Pe;xe.drawBuffers(p.emissiveMode==="mrt-fallback"?[xe.COLOR_ATTACHMENT0,xe.COLOR_ATTACHMENT1]:[xe.COLOR_ATTACHMENT0]),this.renderedToTile=!1,de.dirty&&(b.clear({color:a.ao.transparent,stencil:0}),de.dirty=!1);for(let Ee=O.start;Ee<=O.end;++Ee){const $e=p.style._mergedLayers[z[Ee]];if($e.isHidden(p.transform.zoom))continue;const Ke=p.style.getLayerSourceCache($e),Ue=Ke?this.proxyToSource[Q.key][Ke.id]:[Q];if(!Ue)continue;const mt=Ue;b.viewport.set([0,0,de.fb.width,de.fb.height]),Pe!==(Ke?Ke.id:null)&&(this._setupStencil(de,Ue,$e,Ke),Pe=Ke?Ke.id:null),p.renderLayer(p,Ke,$e,mt)}if(xe.drawBuffers([xe.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Ee of this._pendingGroundEffectLayers){const $e=p.style._mergedLayers[z[Ee]];if($e.isHidden(p.transform.zoom))continue;const Ke=p.style.getLayerSourceCache($e),Ue=Ke?this.proxyToSource[Q.key][Ke.id]:[Q];if(!Ue)continue;const mt=Ue;b.viewport.set([0,0,de.fb.width,de.fb.height]),Pe!==(Ke?Ke.id:null)&&(this._setupStencil(de,Ue,$e,Ke),Pe=Ke?Ke.id:null),p.renderLayer(p,Ke,$e,mt)}this.renderedToTile?(de.dirty=!0,V.push(ce.tileID)):be||--Y,Y===5&&(Y=0,this.renderToBackBuffer(V))}return this.renderToBackBuffer(V),this.renderingToTexture=!1,b.bindFramebuffer.set(null),b.viewport.set([0,0,p.width,p.height]),O.end+1}postRender(){}isLayerOrderingCorrect(d){const p=d.order.length;let b=-1,M=p;for(let L=0;Lb}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(p=>p.dem).forEach(p=>{d=Math.min(d,p.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,p,b){if(!this._visibleDemTiles)return null;const M=this._visibleDemTiles.filter(L=>L.dem).map(L=>{const O=L.tileID,z=1<(L.t!==null?L.t:Number.MAX_VALUE)-(O.t!==null?O.t:Number.MAX_VALUE));for(const L of M){if(L.t==null)return null;const O=L.tile.dem.tree.raycast(L.minx,L.miny,L.maxx,L.maxy,d,p,b);if(O!=null)return O}return null}_createFBO(){const d=this.painter.context,p=d.gl,b=this.drapeBufferSize;d.activeTexture.set(p.TEXTURE0);const M=new a.T(d,{width:b[0],height:b[1],data:null},p.RGBA8);M.bind(p.LINEAR,p.CLAMP_TO_EDGE);const L=d.createFramebuffer(b[0],b[1],1,null);let O;return L.colorAttachment0.set(M.texture),this._emissiveTexture&&(O=new a.T(d,{width:b[0],height:b[1],data:null},p.R8),O.bind(p.LINEAR,p.CLAMP_TO_EDGE),L.createColorAttachment(d,1),L.colorAttachment1.set(O.texture)),L.depthAttachment=new JI(d,L.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,b[0],b[1]),this._stencilRef=0,L.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):L.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:L,tex:M,emissiveTex:O,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const p of this.pool)this._updateFBO(p,d);for(const p of this.proxySourceCache.renderCache)this._updateFBO(p,d);this._emissiveTexture=d}}_updateFBO(d,p){const b=d.fb,M=this.painter.context,L=M.gl,O=this.drapeBufferSize;if(p){const z=new a.T(M,{width:O[0],height:O[1],data:null},L.R8);z.bind(L.LINEAR,L.CLAMP_TO_EDGE),d.emissiveTex=z,b.createColorAttachment(M,1),b.colorAttachment1.set(z.texture)}else d.emissiveTex=void 0,b.removeColorAttachment(M,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const p=this._style._mergedLayers[d],b=p.isHidden(this.painter.transform.zoom);return p.type==="hillshade"||p.type==="custom"?!b&&p.shouldRedrape():!b&&p.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const b of this._style.getSources())if(b instanceof np){d=!0;break}if(!d)return;const p={};for(let b=0;bV>z.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=b}_setupRenderCache(d){const p=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,p.renderCache.length>p.renderCachePool.length){const O=Object.values(p.proxyCachedFBO);p.proxyCachedFBO={};for(let z=0;z=0;O--){const z=b[O];if(p.getTileByID(z.key),p.proxyCachedFBO[z.key]!==void 0){const V=d[z.key],Y=this.proxyToSource[z.key];let Q=0;for(const ce in Y){const le=Y[ce],de=V[ce];if(!de||de.length!==le.length||le.some((be,xe)=>be!==de[xe]||M[ce]&&M[ce].hasOwnProperty(be.key))){Q=-1;break}++Q}for(const ce in p.proxyCachedFBO[z.key])p.renderCache[p.proxyCachedFBO[z.key][ce]].dirty=Q<0||Q!==Object.values(V).length}}const L=[...this._drapedRenderBatches];L.sort((O,z)=>z.end-z.start-(O.end-O.start));for(const O of L)for(const z of b){if(p.proxyCachedFBO[z.key])continue;let V=p.renderCachePool.pop();V===void 0&&p.renderCache.length<50&&(V=p.renderCache.length,p.renderCache.push(this._createFBO())),V!==void 0&&(p.proxyCachedFBO[z.key]={},p.proxyCachedFBO[z.key][O.start]=V,p.renderCache[V].dirty=!0)}this._tilesDirty={}}_setupStencil(d,p,b,M){if(!M||!this._sourceTilesOverlap[M.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const L=this.painter.context,O=L.gl;if(p.length<=1)return void(this._overlapStencilType=!1);let z;if(b.isTileClipped())z=p.length,this._overlapStencilMode.test={func:O.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(p[0].overscaledZ>p[p.length-1].overscaledZ))return void(this._overlapStencilType=!1);z=1,this._overlapStencilMode.test={func:O.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+z>255&&(L.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=z,this._overlapStencilMode.ref=this._stencilRef,b.isTileClipped()&&this._renderTileClippingMasks(p,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(d){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[d.key]),this._overlapStencilMode):zn.disabled}_renderTileClippingMasks(d,p){const b=this.painter,M=this.painter.context,L=M.gl;b._tileClippingMaskIDs={},M.setColorMode(ns.disabled),M.setDepthMode(cn.disabled);const O=b.getOrCreateProgram("clippingMask");for(const z of d){const V=b._tileClippingMaskIDs[z.key]=--p;O.draw(b,L.TRIANGLES,cn.disabled,new zn({func:L.ALWAYS,mask:0},V,255,L.KEEP,L.KEEP,L.REPLACE),ns.disabled,Fn.disabled,fv(z.projMatrix),"$clipping",b.tileExtentBuffer,b.quadTriangleIndexBuffer,b.tileExtentSegments)}}pointCoordinate(d){const p=this.painter.transform;if(d.x<0||d.x>p.width||d.y<0||d.y>p.height)return null;const b=[d.x,d.y,1,1];a.aC(b,b,p.pixelMatrixInverse),a.cK(b,b,1/b[3]),b[0]/=p.worldSize,b[1]/=p.worldSize;const M=p._camera.position,L=a.cf(1,p.center.lat),O=[M[0],M[1],M[2]/L,0],z=a.da([],b.slice(0,3),O);a.aw(z,z);const V=this.raycast(O,z,this._exaggeration);return V!==null&&V?(a.bH(O,O,z,V),O[3]=O[2],O[2]*=L,O):null}_setupProxiedCoordsForOrtho(d,p,b){if(d.getSource()instanceof a.aU)return this._setupProxiedCoordsForImageSource(d,p,b);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const M=this.proxiedCoords[d.id]=[],L=this.proxyCoords;for(let V=0;VQ.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,p,b){if(!d.getSource().loaded())return;const M=this.proxiedCoords[d.id]=[],L=this.proxyCoords,O=d.getSource(),z=O.tileID;if(!z)return;const V=new a.P(z.x,z.y)._div(1<(ce.min.x=Math.min(ce.min.x,le.x-V.x),ce.min.y=Math.min(ce.min.y,le.y-V.y),ce.max.x=Math.max(ce.max.x,le.x-V.x),ce.max.y=Math.max(ce.max.y,le.y-V.y),ce),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),Q=(ce,le)=>{const de=ce.wrap+ce.canonical.x/(1<Pe+Y.max.x||be+xeEe+Y.max.y};for(let ce=0;ceO.key===p.tileID.key);if(L)return L}if(p.tileID.key!==d.key){const L=d.canonical.z-p.tileID.canonical.z;let O,z,V;M=a.bC();const Y=p.tileID.wrap-d.wrap<0?(O=a.al>>L,z=O*((p.tileID.canonical.x<=ce){const le=d.canonical.z-ce;p.getSource().reparseOverscaled?(z=Math.max(d.canonical.z+2,p.transform.tileZoom),O=new a.aQ(z,d.wrap,ce,d.canonical.x>>le,d.canonical.y>>le)):le!==0&&(z=ce,O=new a.aQ(z,d.wrap,ce,d.canonical.x>>le,d.canonical.y>>le))}O.key!==d.key&&(Y.push(O.key),b=p.getTile(O))}const Q=ce=>{Y.forEach(le=>{M[le]=ce}),Y.length=0};for(z-=1;z>=V&&(!b||!b.hasData());z--){b&&Q(b.tileID.key);const ce=O.calculateScaledKey(z);if(b=p.getTileByID(ce),b&&b.hasData())break;const le=M[ce];if(le===null)break;le===void 0?Y.push(ce):b=p.getTileByID(le)}return Q(b?b.tileID.key:null),b&&b.hasData()?b:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,p){let b=this._tilesDirty[d];b||(b=this._tilesDirty[d]={}),b[p.key]=!0}}function ky(_,d,p){const b=function(z,V,Y){const Q=a.bJ(V,z),ce=a.bJ(Y,[.2126,.7152,.0722]),le=(be,xe,Pe)=>(1-Pe)*be+Pe*xe,de=le(1-.3*Math.min(ce,1),1,Math.min(Q+1,1));return le(.92,1,Math.asin(a.aA(V[2],-1,1))/Math.PI+.5)*de}(_,[0,0,1],d),M=[0,0,0];a.c5(M,p.slice(0,3),b);const L=[0,0,0];a.c5(L,d.slice(0,3),_[2]);const O=[0,0,0];return a.d8(O,M,L),a.db(O)}const Kie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Zie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class eP{static cacheKey(d,p,b,M){const L=[p];M&&L.push(M.cacheKey);for(const O of b)d.usedDefines.has(O)&&L.push(O);return L.join("/")}constructor(d,p,b,M,L,O){const z=d.gl;this.program=z.createProgram(),this.configuration=M,this.name=p,this.fixedDefines=[...O];const V=`#version 300 es ${(M?M.defines():[]).concat(O.map(xe=>`#define ${xe}`)).join(` `)}`,Y=[V,zie];for(const xe of b.fragmentIncludes)Y.push(Tm[xe]);Y.push(b.fragmentSource);const Q=Y.join(` `),ce=[V,VI];for(const xe of b.vertexIncludes)ce.push(Tm[xe]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&b.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&ce.push("uniform int u_instanceID;"),ce.push(b.vertexSource);let le=ce.join(` `);this.forceManualRenderingForInstanceIDShaders&&(le=le.replaceAll("gl_InstanceID","u_instanceID"));const de=z.createShader(z.FRAGMENT_SHADER);if(z.isContextLost())return void(this.failedToCreate=!0);z.shaderSource(de,Q),z.compileShader(de),z.attachShader(this.program,de);const be=z.createShader(z.VERTEX_SHADER);z.isContextLost()?this.failedToCreate=!0:(z.shaderSource(be,le),z.compileShader(be),z.attachShader(this.program,be),this.attributes={},z.linkProgram(this.program),z.deleteShader(be),z.deleteShader(de),this.fixedUniforms=L(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=M?M.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(xe=>({u_instanceID:new a.ch(xe)}))(d)),(O.includes("TERRAIN")||p.includes("symbol")||p.includes("circle"))&&(this.terrainUniforms=(xe=>({u_dem:new a.ch(xe),u_dem_prev:new a.ch(xe),u_dem_tl:new a.ck(xe),u_dem_scale:new a.cj(xe),u_dem_tl_prev:new a.ck(xe),u_dem_scale_prev:new a.cj(xe),u_dem_size:new a.cj(xe),u_dem_lerp:new a.cj(xe),u_exaggeration:new a.cj(xe),u_depth:new a.ch(xe),u_depth_size_inv:new a.ck(xe),u_depth_range_unpack:new a.ck(xe),u_occluder_half_size:new a.cj(xe),u_occlusion_depth_offset:new a.cj(xe),u_meter_to_dem:new a.cj(xe),u_label_plane_matrix_inv:new a.cl(xe)}))(d)),O.includes("GLOBE")&&(this.globeUniforms=(xe=>({u_tile_tl_up:new a.ci(xe),u_tile_tr_up:new a.ci(xe),u_tile_br_up:new a.ci(xe),u_tile_bl_up:new a.ci(xe),u_tile_up_scale:new a.cj(xe)}))(d)),O.includes("FOG")&&(this.fogUniforms=(xe=>({u_fog_matrix:new a.cl(xe),u_fog_range:new a.ck(xe),u_fog_color:new a.d3(xe),u_fog_horizon_blend:new a.cj(xe),u_fog_vertical_limit:new a.ck(xe),u_fog_temporal_offset:new a.cj(xe),u_frustum_tl:new a.ci(xe),u_frustum_tr:new a.ci(xe),u_frustum_br:new a.ci(xe),u_frustum_bl:new a.ci(xe),u_globe_pos:new a.ci(xe),u_globe_radius:new a.cj(xe),u_globe_transition:new a.cj(xe),u_is_globe:new a.ch(xe),u_viewport:new a.ck(xe)}))(d)),O.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(xe=>({u_cutoff_params:new a.d3(xe)}))(d)),O.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(xe=>({u_lighting_ambient_color:new a.ci(xe),u_lighting_directional_dir:new a.ci(xe),u_lighting_directional_color:new a.ci(xe),u_ground_radiance:new a.ci(xe)}))(d)),O.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(xe=>({u_light_matrix_0:new a.cl(xe),u_light_matrix_1:new a.cl(xe),u_fade_range:new a.ck(xe),u_shadow_normal_offset:new a.ci(xe),u_shadow_intensity:new a.cj(xe),u_shadow_texel_size:new a.cj(xe),u_shadow_map_resolution:new a.cj(xe),u_shadow_direction:new a.ci(xe),u_shadow_bias:new a.ci(xe),u_shadowmap_0:new a.ch(xe),u_shadowmap_1:new a.ch(xe)}))(d)))}getAttributeLocation(d,p){let b=this.attributes[p];return b===void 0&&(b=this.attributes[p]=d.getAttribLocation(this.program,p)),b}setTerrainUniformValues(d,p){if(!this.terrainUniforms)return;const b=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M]&&b[M].set(this.program,M,p[M])}}setGlobeUniformValues(d,p){if(!this.globeUniforms)return;const b=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M]&&b[M].set(this.program,M,p[M])}}setFogUniformValues(d,p){if(!this.fogUniforms)return;const b=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}}setCutoffUniformValues(d,p){if(!this.cutoffUniforms)return;const b=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}}setLightsUniformValues(d,p){if(!this.lightsUniforms)return;const b=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}}setShadowUniformValues(d,p){if(this.failedToCreate||!this.shadowUniforms)return;const b=this.shadowUniforms;d.program.set(this.program);for(const M in p)b[M].set(this.program,M,p[M])}_drawDebugWireframe(d,p,b,M,L,O,z,V,Y,Q){const ce=d.options.wireframe;if(ce.terrain===!1&&ce.layers2D===!1&&ce.layers3D===!1)return;const le=d.context;if(!(!(!ce.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!ce.layers2D||d._terrain&&d._terrain.renderingToTexture||!Kie.includes(this.name))||!(!ce.layers3D||!Zie.includes(this.name))))return;const de=le.gl,be=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,L,le);if(!be)return;const xe=[...this.fixedDefines,"DEBUG_WIREFRAME"],Pe=d.getOrCreateProgram(this.name,{config:this.configuration,defines:xe});le.program.set(Pe.program);const Ee=(Ue,mt,ct)=>{if(mt[Ue]&&ct[Ue])for(const ht in mt[Ue])ct[Ue][ht]&&ct[Ue][ht].set(ct.program,ht,mt[Ue][ht].current)};Y&&Y.setUniforms(Pe.program,le,Pe.binderUniforms,z,{zoom:V}),Ee("fixedUniforms",this,Pe),Ee("terrainUniforms",this,Pe),Ee("globeUniforms",this,Pe),Ee("fogUniforms",this,Pe),Ee("lightsUniforms",this,Pe),Ee("shadowUniforms",this,Pe),be.bind(),le.setColorMode(new ns([de.ONE,de.ONE_MINUS_SRC_ALPHA,de.ZERO,de.ONE],a.ao.transparent,[!0,!0,!0,!1])),le.setDepthMode(new cn(p.func===de.LESS?de.LEQUAL:p.func,cn.ReadOnly,p.range)),le.setStencilMode(zn.disabled);const $e=3*O.primitiveLength*2,Ke=3*O.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ue=Q||1;for(let mt=0;mt1?de.drawElementsInstanced(de.LINES,$e,de.UNSIGNED_SHORT,Ke,Q):de.drawElements(de.LINES,$e,de.UNSIGNED_SHORT,Ke);L.bind(),le.program.set(this.program),le.setDepthMode(p),le.setStencilMode(b),le.setColorMode(M)}checkUniforms(d,p,b){if(this.fixedDefines.includes(p)){for(const M of Object.keys(b))if(!b[M].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${M} not set but required by ${p} being defined`)}}draw(d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe){const Ee=d.context,$e=Ee.gl;if(this.failedToCreate)return;Ee.program.set(this.program),Ee.setDepthMode(b),Ee.setStencilMode(M),Ee.setColorMode(L),Ee.setCullFace(O);for(const[ot,st]of this.fixedUniformsEntries)st.set(this.program,ot,z[ot]);be&&be.setUniforms(this.program,Ee,this.binderUniforms,le,{zoom:de});const Ke={[$e.POINTS]:1,[$e.LINES]:2,[$e.TRIANGLES]:3,[$e.LINE_STRIP]:1}[p];this.checkUniforms(V,"RENDER_SHADOWS",this.shadowUniforms);const Ue=xe||[],mt=be?be.getPaintVertexBuffers():[],ct=p===$e.TRIANGLES&&Q,ht=Pe&&Pe>0?1:void 0;for(const ot of ce.get()){const st=ot.vaos||(ot.vaos={});if((st[V]||(st[V]=new Bie)).bind(Ee,this,Y,mt,Q,ot.vertexOffset,Ue,ht),this.forceManualRenderingForInstanceIDShaders){const _t=Pe||1;for(let It=0;It<_t;++It)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",It),Q?$e.drawElements(p,ot.primitiveLength*Ke,$e.UNSIGNED_SHORT,ot.primitiveOffset*Ke*2):$e.drawArrays(p,ot.vertexOffset,ot.vertexLength)}else Pe&&Pe>1?$e.drawElementsInstanced(p,ot.primitiveLength*Ke,$e.UNSIGNED_SHORT,ot.primitiveOffset*Ke*2,Pe):Q?$e.drawElements(p,ot.primitiveLength*Ke,$e.UNSIGNED_SHORT,ot.primitiveOffset*Ke*2):$e.drawArrays(p,ot.vertexOffset,ot.vertexLength);ct&&this._drawDebugWireframe(d,b,M,L,Q,ot,le,de,be,Pe)}}}function tP(_,d,p=0){const b=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,_.transform.tileZoom)/b,L=M*(d.tileID.canonical.x+d.tileID.wrap*b),O=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.ay(d,1,_.transform.tileZoom),u_pixel_coord_upper:[L>>16,O>>16],u_pixel_coord_lower:[65535&L,65535&O],u_pattern_transition:p}}const Ik={terrain:0,flat:1},Yie=a.bC(),Pk=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee)=>{const $e=d.style.light,Ke=$e.properties.get("position"),Ue=[Ke.x,Ke.y,Ke.z],mt=a.dO();$e.properties.get("anchor")==="viewport"&&(a.dP(mt,-d.transform.angle),a.dQ(Ue,Ue,mt));const ct=$e.properties.get("color").toPremultipliedRenderColor(null),ht=d.transform,ot={u_matrix:_,u_lightpos:Ue,u_lightintensity:$e.properties.get("intensity"),u_lightcolor:[ct.r,ct.g,ct.b],u_vertical_gradient:+p,u_opacity:b,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Yie,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ik[Y],u_base_type:Ik[Q],u_ao:M,u_edge_radius:L,u_width_scale:O,u_flood_light_color:be,u_vertical_scale:xe,u_flood_light_intensity:Pe,u_ground_shadow_factor:Ee};return ht.projection.name==="globe"&&(ot.u_tile_id=[z.canonical.x,z.canonical.y,1<({u_matrix:_,u_edge_radius:d,u_width_scale:p,u_vertical_scale:b,u_height_type:Ik[M],u_base_type:Ik[L]}),rP=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee)=>{const $e=Pk(_,d,p,b,M,L,O,z,Y,Q,ce,le,de,be,xe,Pe,1,[0,0,0]),Ke={u_height_factor:-Math.pow(2,z.overscaledZ)/V.tileSize/8};return Object.assign($e,tP(d,V,Ee),Ke)},Ny=(_,d,p,b,M,L,O,z,V,Y,Q)=>({u_matrix:d,u_opacity:p,u_ao_pass:b?1:0,u_meter_to_tile:M,u_ao:L,u_flood_light_intensity:O,u_flood_light_color:z,u_attenuation:V,u_edge_radius:Y,u_fb:0,u_fb_size:Q,u_dynamic_offset:1}),Q5=(_,d,p)=>({u_matrix:_,u_emissive_strength:d,u_ground_shadow_factor:p}),J5=(_,d,p,b,M,L=0)=>Object.assign(Q5(_,d,M),tP(p,b,L)),nP=(_,d,p,b)=>({u_matrix:_,u_world:p,u_emissive_strength:d,u_ground_shadow_factor:b}),e3=(_,d,p,b,M,L,O=0)=>Object.assign(J5(_,d,p,b,L,O),{u_world:M}),Em=(_,d)=>({u_matrix:_,u_ground_shadow_factor:d}),Ug=(_,d,p,b,M)=>({u_matrix:_,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:p,u_height_scale:b,u_reset_depth:M}),Lk=(_,d,p,b,M,L,O,z,V)=>({u_matrix:_,u_normal_matrix:d,u_opacity:p,u_faux_facade_ao_intensity:b,u_camera_pos:M,u_tile_to_meter:L,u_facade_emissive_chance:O,u_flood_light_color:z,u_flood_light_intensity:V}),sP=_=>({u_matrix:_}),Im=_=>({u_matrix:_}),t3=(_,d,p,b,M,L,O,z)=>{const V=a.al/L.tileSize;return{u_matrix:_,u_inv_rot_matrix:d,u_camera_to_center_distance:p.getCameraToCenterDistance(z),u_extrude_scale:[p.pixelsToGLUnits[0]/V,p.pixelsToGLUnits[1]/V],u_zoom_transition:b,u_tile_id:O,u_merc_center:M}},mv=(_,d,p=1)=>({u_matrix:_,u_color:d,u_overlay:0,u_overlay_scale:p}),iP=a.bC(),aP=(_,d,p,b,M,L,O)=>{const z=_.transform,V=z.projection.name==="globe",Y=V?a.dR(z.zoom,d.canonical)*z._pixelsPerMercatorPixel:a.ay(p,1,L),Q={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:O,u_inv_rot_matrix:iP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(V){Q.u_inv_rot_matrix=b,Q.u_merc_center=M,Q.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:p,u_merc_matrix:b,u_grid_matrix:M,u_tl_parent:L,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity*ce.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:ce.paint.get("raster-brightness-min"),u_brightness_high:ce.paint.get("raster-brightness-max"),u_saturation_factor:a.dT(ce.paint.get("raster-saturation")),u_contrast_factor:a.dS(ce.paint.get("raster-contrast")),u_spin_weights:lP(ce.paint.get("raster-hue-rotate")),u_perspective_transform:le,u_raster_elevation:de,u_zoom_transition:O,u_merc_center:z,u_cutoff_params:V,u_colorization_mix:Ok(a.dU,xe,Ee),u_colorization_offset:Dk(a.dU,Pe,Ee),u_color_ramp:be,u_texture_offset:[Ke/($e+2*Ke),$e/($e+2*Ke)],u_texture_res:[$e+2*Ke,$e+2*Ke],u_emissive_strength:Ue});function lP(_){_*=Math.PI/180;const d=Math.sin(_),p=Math.cos(_);return[(2*p+1)/3,(-Math.sqrt(3)*d-p+1)/3,(Math.sqrt(3)*d-p+1)/3]}const uf=.05,Xie=(_,d,p,b,M,L,O,z,V,Y,Q,ce)=>({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:p,u_merc_matrix:b,u_grid_matrix:M,u_tl_parent:L,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity,u_image0:0,u_image1:1,u_raster_elevation:ce,u_zoom_transition:O,u_merc_center:z,u_cutoff_params:V}),Qie=(_,d,p,b,M,L,O,z,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_tile_offset:p,u_velocity:b,u_color_ramp:L,u_velocity_res:M,u_max_speed:O,u_uv_offset:z,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[uf,uf]}),cP=(_,d,p,b,M,L,O,z,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_velocity:p,u_velocity_res:b,u_max_speed:M,u_speed_factor:L,u_reset_rate:O,u_rand_seed:Math.random(),u_uv_offset:z,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[uf,uf]}),dP=a.bC(),Rk=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee,$e,Ke,Ue,mt,ct,ht)=>{const ot=M.transform,st={u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ot.getCameraToCenterDistance($e),u_rotate_symbol:+p,u_aspect_ratio:ot.width/ot.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:L,u_label_plane_matrix:O,u_coord_matrix:z,u_is_text:+Y,u_elevation_from_sea:V?1:0,u_pitch_with_map:+b,u_texsize:Q,u_texsize_icon:ce,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:dP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:dP,u_up_vector:[0,-1,0],u_color_adj_mat:mt,u_icon_transition:ct||0,u_gamma_scale:b?M.transform.getCameraToCenterDistance($e)*Math.cos(M.terrain?0:M.transform._pitch):1,u_device_pixel_ratio:a.o.devicePixelRatio,u_is_halo:1,u_scale_factor:ht||1,u_ground_shadow_factor:Ke,u_inv_matrix:a.bl(a.bC(),O),u_normal_scale:Ue,u_lutTexture:wl.LUT};return $e.name==="globe"&&(st.u_tile_id=[de.canonical.x,de.canonical.y,1<({u_matrix:_,u_emissive_strength:d,u_opacity:p,u_color:b}),Pm=(_,d,p,b,M,L,O,z,V)=>Object.assign(function(Y,Q,ce,le,de,be){const{width:xe,height:Pe}=le.imageManager.getPixelSize(Q),Ee=Math.pow(2,be.tileID.overscaledZ),$e=be.tileSize*Math.pow(2,le.transform.tileZoom)/Ee,Ke=$e*(be.tileID.canonical.x+be.tileID.wrap*Ee),Ue=$e*be.tileID.canonical.y;return{u_image:0,u_pattern_tl:ce.tl,u_pattern_br:ce.br,u_texsize:[xe,Pe],u_pattern_size:ce.displaySize,u_pattern_units_to_pixels:de?[le.transform.width,-1*le.transform.height]:[1/a.ay(be,1,le.transform.tileZoom),1/a.ay(be,1,le.transform.tileZoom)],u_pixel_coord_upper:[Ke>>16,Ue>>16],u_pixel_coord_lower:[65535&Ke,65535&Ue]}}(0,L,O,b,z,V),{u_matrix:_,u_emissive_strength:d,u_opacity:p}),Sy=new Float32Array(a.bA([])),qg=(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de=[0,0,0],be,xe,Pe)=>{const Ee=M.style.light,$e=Ee.properties.get("position"),Ke=[-$e.x,-$e.y,$e.z],Ue=a.dO();Ee.properties.get("anchor")==="viewport"&&(a.dP(Ue,-M.transform.angle),a.dQ(Ke,Ke,Ue));const mt=Q.alphaMode==="MASK",ct=Ee.properties.get("color").toNonPremultipliedRenderColor(null),ht=le.paint.get("model-ambient-occlusion-intensity"),ot=le.paint.get("model-color").constantOr(a.ao.white).toNonPremultipliedRenderColor(null);return ot.a=le.paint.get("model-color-mix-intensity").constantOr(0),Pe&&(ot.r=Pe[0],ot.g=Pe[1],ot.b=Pe[2],ot.a=Pe[3]),xe&&(ot.r=xe.color.r,ot.g=xe.color.g,ot.b=xe.color.b,ot.a=xe.colorMix,ce=xe.emissionStrength,L*=xe.opacity),{u_matrix:_,u_lighting_matrix:d,u_normal_matrix:p,u_node_matrix:b||Sy,u_lightpos:Ke,u_lightintensity:Ee.properties.get("intensity"),u_lightcolor:[ct.r,ct.g,ct.b],u_camera_pos:de,u_opacity:L,u_baseTextureIsAlpha:0,u_alphaMask:+mt,u_alphaCutoff:Q.alphaCutoff,u_baseColorFactor:O.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:z.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:V,u_roughnessFactor:Y,u_baseColorTexture:wl.BaseColor,u_metallicRoughnessTexture:wl.MetallicRoughness,u_normalTexture:wl.Normal,u_occlusionTexture:wl.Occlusion,u_emissionTexture:wl.Emission,u_lutTexture:wl.LUT,u_color_mix:ot.toArray01(),u_aoIntensity:ht,u_emissive_strength:ce,u_occlusionTextureTransform:be||[0,0,0,0]}},r3=(_,d=Sy,p=Sy)=>({u_matrix:_,u_instance:d,u_node_matrix:p}),Fk={fillExtrusion:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_opacity:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_flood_light_color:new a.ci(_),u_vertical_scale:new a.cj(_),u_flood_light_intensity:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillExtrusionDepth:_=>({u_matrix:new a.cl(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_vertical_scale:new a.cj(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_)}),fillExtrusionPattern:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_height_factor:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_opacity:new a.cj(_),u_pattern_transition:new a.cj(_)}),fillExtrusionGroundEffect:_=>({u_matrix:new a.cl(_),u_opacity:new a.cj(_),u_ao_pass:new a.cj(_),u_meter_to_tile:new a.cj(_),u_ao:new a.ck(_),u_flood_light_intensity:new a.cj(_),u_flood_light_color:new a.ci(_),u_attenuation:new a.cj(_),u_edge_radius:new a.cj(_),u_fb:new a.ch(_),u_fb_size:new a.cj(_),u_dynamic_offset:new a.cj(_)}),fill:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),fillOutline:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_ground_shadow_factor:new a.ci(_)}),fillOutlinePattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),building:_=>({u_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_opacity:new a.cj(_),u_faux_facade_ao_intensity:new a.cj(_),u_camera_pos:new a.ci(_),u_tile_to_meter:new a.cj(_),u_facade_emissive_chance:new a.cj(_),u_flood_light_color:new a.ci(_),u_flood_light_intensity:new a.cj(_)}),buildingBloom:_=>({u_matrix:new a.cl(_)}),buildingDepth:_=>({u_matrix:new a.cl(_)}),elevatedStructuresDepth:_=>({u_matrix:new a.cl(_),u_depth_bias:new a.cj(_)}),elevatedStructures:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),elevatedStructuresDepthReconstruct:_=>({u_matrix:new a.cl(_),u_camera_pos:new a.ci(_),u_depth_bias:new a.cj(_),u_height_scale:new a.cj(_),u_reset_depth:new a.cj(_)}),circle:a.dY,collisionBox:_=>({u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_extrude_scale:new a.ck(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_)}),collisionCircle:_=>({u_matrix:new a.cl(_),u_inv_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_viewport_size:new a.ck(_)}),debug:_=>({u_color:new a.dB(_),u_matrix:new a.cl(_),u_overlay:new a.ch(_),u_overlay_scale:new a.cj(_)}),clippingMask:_=>({u_matrix:new a.cl(_)}),heatmap:_=>({u_extrude_scale:new a.cj(_),u_intensity:new a.cj(_),u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_up_dir:new a.ci(_)}),heatmapTexture:_=>({u_image:new a.ch(_),u_color_ramp:new a.ch(_),u_opacity:new a.cj(_)}),hillshade:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_latrange:new a.ck(_),u_light:new a.ck(_),u_shadow:new a.dB(_),u_highlight:new a.dB(_),u_emissive_strength:new a.cj(_),u_accent:new a.dB(_)}),hillshadePrepare:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_dimension:new a.ck(_),u_zoom:new a.cj(_)}),line:a.dX,linePattern:a.dW,raster:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_brightness_low:new a.cj(_),u_brightness_high:new a.cj(_),u_saturation_factor:new a.cj(_),u_contrast_factor:new a.cj(_),u_spin_weights:new a.ci(_),u_perspective_transform:new a.ck(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_),u_colorization_mix:new a.d3(_),u_colorization_offset:new a.cj(_),u_color_ramp:new a.ch(_),u_texture_offset:new a.ck(_),u_texture_res:new a.ck(_),u_emissive_strength:new a.cj(_)}),rasterParticle:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_)}),rasterParticleTexture:_=>({u_texture:new a.ch(_),u_opacity:new a.cj(_)}),rasterParticleDraw:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_tile_offset:new a.ck(_),u_velocity:new a.ch(_),u_color_ramp:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),rasterParticleUpdate:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_velocity:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_speed_factor:new a.cj(_),u_reset_rate:new a.cj(_),u_rand_seed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),symbol:_=>({u_is_size_zoom_constant:new a.ch(_),u_is_size_feature_constant:new a.ch(_),u_size_t:new a.cj(_),u_size:new a.cj(_),u_camera_to_center_distance:new a.cj(_),u_rotate_symbol:new a.ch(_),u_aspect_ratio:new a.cj(_),u_fade_change:new a.cj(_),u_matrix:new a.cl(_),u_label_plane_matrix:new a.cl(_),u_coord_matrix:new a.cl(_),u_is_text:new a.ch(_),u_elevation_from_sea:new a.ch(_),u_pitch_with_map:new a.ch(_),u_texsize:new a.ck(_),u_texsize_icon:new a.ck(_),u_texture:new a.ch(_),u_texture_icon:new a.ch(_),u_gamma_scale:new a.cj(_),u_device_pixel_ratio:new a.cj(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_camera_forward:new a.ci(_),u_tile_matrix:new a.cl(_),u_up_vector:new a.ci(_),u_ecef_origin:new a.ci(_),u_is_halo:new a.ch(_),u_icon_transition:new a.cj(_),u_color_adj_mat:new a.cl(_),u_scale_factor:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_inv_matrix:new a.cl(_),u_normal_scale:new a.cj(_),u_lutTexture:new a.ch(_)}),background:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_color:new a.dB(_)}),backgroundPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_image:new a.ch(_),u_pattern_tl:new a.ck(_),u_pattern_br:new a.ck(_),u_texsize:new a.ck(_),u_pattern_size:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_pattern_units_to_pixels:new a.ck(_)}),terrainRaster:_=>({u_matrix:new a.cl(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_skirt_height:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_emissive_texture_available:new a.cj(_)}),skybox:_=>({u_matrix:new a.cl(_),u_sun_direction:new a.ci(_),u_cubemap:new a.ch(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxGradient:_=>({u_matrix:new a.cl(_),u_color_ramp:new a.ch(_),u_center_direction:new a.ci(_),u_radius:new a.cj(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxCapture:_=>({u_matrix_3f:new a.dC(_),u_sun_direction:new a.ci(_),u_sun_intensity:new a.cj(_),u_color_tint_r:new a.d3(_),u_color_tint_m:new a.d3(_),u_luminance:new a.cj(_)}),globeRaster:_=>({u_proj_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_grid_matrix:new a.dC(_),u_skirt_height:new a.cj(_),u_far_z_cutoff:new a.cj(_),u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_globe_pos:new a.ci(_),u_globe_radius:new a.cj(_),u_viewport:new a.ck(_),u_emissive_texture_available:new a.cj(_)}),globeAtmosphere:_=>({u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_horizon:new a.cj(_),u_transition:new a.cj(_),u_fadeout_range:new a.cj(_),u_atmosphere_fog_color:new a.d3(_),u_high_color:new a.d3(_),u_space_color:new a.d3(_),u_temporal_offset:new a.cj(_),u_horizon_angle:new a.cj(_)}),model:_=>({u_matrix:new a.cl(_),u_lighting_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_node_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_camera_pos:new a.ci(_),u_opacity:new a.cj(_),u_baseColorFactor:new a.d3(_),u_emissiveFactor:new a.d3(_),u_metallicFactor:new a.cj(_),u_roughnessFactor:new a.cj(_),u_baseTextureIsAlpha:new a.ch(_),u_alphaMask:new a.ch(_),u_alphaCutoff:new a.cj(_),u_baseColorTexture:new a.ch(_),u_metallicRoughnessTexture:new a.ch(_),u_normalTexture:new a.ch(_),u_occlusionTexture:new a.ch(_),u_emissionTexture:new a.ch(_),u_lutTexture:new a.ch(_),u_color_mix:new a.d3(_),u_aoIntensity:new a.cj(_),u_emissive_strength:new a.cj(_),u_occlusionTextureTransform:new a.d3(_)}),modelDepth:_=>({u_matrix:new a.cl(_),u_instance:new a.cl(_),u_node_matrix:new a.cl(_)}),groundShadow:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),stars:_=>({u_matrix:new a.cl(_),u_up:new a.ci(_),u_right:new a.ci(_),u_intensity_multiplier:new a.cj(_)}),snowParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_horizontalOscillationRadius:new a.cj(_),u_horizontalOscillationRate:new a.cj(_),u_boxSize:new a.cj(_),u_billboardSize:new a.cj(_),u_simpleShapeParameters:new a.ck(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_particleColor:new a.d3(_),u_direction:new a.ci(_)}),rainParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_texScreen:new a.ch(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_boxSize:new a.cj(_),u_rainDropletSize:new a.ck(_),u_distortionStrength:new a.cj(_),u_rainDirection:new a.ci(_),u_color:new a.d3(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_shapeDirectionalPower:new a.cj(_),u_shapeNormalPower:new a.cj(_),u_mode:new a.cj(_)}),vignette:_=>({u_vignetteShape:new a.ci(_),u_vignetteColor:new a.d3(_)}),occlusion:_=>({u_matrix:new a.cl(_),u_anchorPos:new a.ci(_),u_screenSizePx:new a.ck(_),u_occluderSizePx:new a.ck(_),u_color:new a.d3(_)})};class wh{constructor(d,p,b,M){this.id=wh.uniqueIdxCounter,wh.uniqueIdxCounter++,this.context=d;const L=d.gl;this.buffer=L.createBuffer(),this.dynamicDraw=!!b,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),L.bufferData(L.ELEMENT_ARRAY_BUFFER,p.arrayBuffer,this.dynamicDraw?L.DYNAMIC_DRAW:L.STATIC_DRAW),this.dynamicDraw||M||p.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=wh.uniqueIdxCounter,wh.uniqueIdxCounter++;const p=this.context.gl;this.context.unbindVAO(),this.bind(),p.bufferSubData(p.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}wh.uniqueIdxCounter=0;const n3={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class uP{constructor(d,p,b,M,L,O){this.length=p.length,this.attributes=b,this.itemSize=p.bytesPerElement,this.dynamicDraw=M,this.instanceCount=O,this.context=d;const z=d.gl;this.buffer=z.createBuffer(),d.bindVertexBuffer.set(this.buffer),z.bufferData(z.ARRAY_BUFFER,p.arrayBuffer,this.dynamicDraw?z.DYNAMIC_DRAW:z.STATIC_DRAW),this.dynamicDraw||L||p.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const p=this.context.gl;this.bind(),p.bufferSubData(p.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,p){for(let b=0;b0&&d.vertexAttribDivisor(L,b)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class hP{constructor(d,p,b,M,L){this.context=d,this.width=p,this.height=b;const O=this.framebuffer=d.gl.createFramebuffer();M>0&&(this.colorAttachment0=new Ck(d,O,0)),M>1&&(this.colorAttachment1=new Ck(d,O,1)),L&&(this.depthAttachmentType=L,this.depthAttachment=L==="renderbuffer"?new wy(d,O):new uv(d,O))}createColorAttachment(d,p){p===0?this.colorAttachment0=new Ck(d,this.framebuffer,0):p===1&&(this.colorAttachment1=new Ck(d,this.framebuffer,1))}removeColorAttachment(d,p){const b=this.context.gl;let M;p===0?(M=this.colorAttachment0.get(),this.colorAttachment0=void 0):p===1&&(M=this.colorAttachment1.get(),this.colorAttachment1=void 0),M&&b.deleteTexture(M)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const p=this.colorAttachment0.get();p&&d.deleteTexture(p)}if(this.colorAttachment1){const p=this.colorAttachment1.get();p&&d.deleteTexture(p)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const p=this.depthAttachment.get();p&&d.deleteRenderbuffer(p)}else{const p=this.depthAttachment.get();p&&d.deleteTexture(p)}d.deleteFramebuffer(this.framebuffer)}}class Cy{constructor(d,p){this.gl=d,this.clearColor=new Vie(this),this.clearDepth=new HI(this),this.clearStencil=new z5(this),this.colorMask=new wk(this),this.depthMask=new B5(this),this.stencilMask=new $g(this),this.stencilFunc=new yy(this),this.stencilOp=new cv(this),this.stencilTest=new vy(this),this.depthRange=new WI(this),this.depthTest=new $5(this),this.depthFunc=new GI(this),this.blend=new _y(this),this.blendFunc=new jk(this),this.blendColor=new kk(this),this.blendEquation=new U5(this),this.cullFace=new Nk(this),this.cullFaceSide=new dv(this),this.frontFace=new KI(this),this.program=new ZI(this),this.activeTexture=new YI(this),this.viewport=new by(this),this.bindFramebuffer=new XI(this),this.bindRenderbuffer=new Hie(this),this.bindTexture=new Wie(this),this.bindVertexBuffer=new Gie(this),this.bindElementBuffer=new q5(this),this.bindVertexArrayOES=new V5(this),this.pixelStoreUnpack=new H5(this),this.pixelStoreUnpackPremultiplyAlpha=new W5(this),this.pixelStoreUnpackFlipY=new QI(this),this.options=p?Object.assign({},p):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=d.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=d.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=d.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=p&&!!p.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=d.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=d.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(d,p,b){return new wh(this,d,p,b)}createVertexBuffer(d,p,b,M,L){return new uP(this,d,p,b,M,L)}createRenderbuffer(d,p,b){const M=this.gl,L=M.createRenderbuffer();return this.bindRenderbuffer.set(L),M.renderbufferStorage(M.RENDERBUFFER,d,p,b),this.bindRenderbuffer.set(null),L}createFramebuffer(d,p,b,M){return new hP(this,d,p,b,M)}clear({color:d,depth:p,stencil:b,colorMask:M}){const L=this.gl;let O=0;d&&(O|=L.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(M||[!0,!0,!0,!0])),p!==void 0&&(O|=L.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(p),this.depthMask.set(!0)),b!==void 0&&(O|=L.STENCIL_BUFFER_BIT,this.clearStencil.set(b),this.stencilMask.set(255)),L.clear(O)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){a.by(d.blendFunction,ns.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor),d.blendEquation?this.blendEquation.set(d.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(d.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Vg;function Xr(_,d,p,b,M,L,O){const z=_.context,V=z.gl,Y=_.transform,Q=[a.aF(Y.center.lng),a.aJ(Y.center.lat)],ce=p.layout.get("symbol-placement"),le=p.layout.get("text-variable-anchor"),de=p.layout.get("icon-rotation-alignment")==="map",be=p.layout.get("text-rotation-alignment")==="map",xe=ce!=="point",Pe=[];let Ee=0,$e=0;for(let st=0;st0){const Rr=a.bC(),Vr=Sr;a.cP(Rr,Tt.placementInvProjMatrix,Y.glCoordMatrix),a.cP(Rr,Rr,Tt.placementViewportMatrix),Pe.push({circleArray:nn,circleOffset:$e,transform:Vr,invTransform:Rr,projection:Tt.getProjection()}),Ee+=nn.length/4,$e=Ee}if(!wr)continue;_.terrain&&_.terrain.setupElevationDraw(It,qr);const Jr=ur?[_t.canonical.x,_t.canonical.y,1<<_t.canonical.z]:[0,0,0];qr.draw(_,V.LINES,cn.disabled,zn.disabled,_.colorModeForRenderPass(),Fn.disabled,t3(Sr,Vt,Y,Ar,Q,It,Jr,Tt.getProjection()),p.id,wr.layoutVertexBuffer,wr.indexBuffer,wr.segments,null,Y.zoom,null,[wr.collisionVertexBuffer,wr.collisionVertexBufferExt])}if(!O||!Pe.length)return;const Ke=_.getOrCreateProgram("collisionCircle"),Ue=new a.dZ;Ue.resize(4*Ee),Ue._trim();let mt=0;for(const st of Pe)for(let _t=0;_t=0&&(de[Ke.associatedIconIndex]={x:Tt,y:Vt,z:Ht,angle:Zt})}else vh(ct,ce)}if(Y){le.clear();const $e=_.icon.placedSymbolArray;for(let Ke=0;Ke<$e.length;Ke++){const Ue=$e.get(Ke),{numGlyphs:mt}=Ue,ct=de[Ke];if(Ue.hidden||!ct)vh(mt,le);else{const{x:ht,y:ot,z:st,angle:_t}=ct;for(let It=0;It{let Zs=[0,0,0];if(mi){const is=_.style.directionalLight,sa=_.style.ambientLight;is&&sa&&(Zs=up(_.style,is,sa))}return Zs},ri=mi=>{st.depthOcclusionForSymbolsAndCircles&&(p.hasOcclusionOpacityProperties||_.terrain)&&(mi.push("DEPTH_D24"),mi.push("DEPTH_OCCLUSION"))},Hn=mi=>{p.lut&&!ct&&(p.lut.texture||(p.lut.texture=new a.d$(_.context,p.lut.image,[p.lut.image.height,p.lut.image.height,p.lut.image.height],ht.gl.RGBA8)),ht.activeTexture.set(ht.gl.TEXTURE0+wl.LUT),p.lut.texture&&p.lut.texture.bind(ht.gl.LINEAR,ht.gl.CLAMP_TO_EDGE),mi.push("APPLY_LUT_ON_GPU"))},pi=()=>{const mi=_t&&p.layout.get("symbol-placement")!=="point",Zs=[];ri(Zs),Hn(Zs);const is=mi||Kn,sa=wr.elevationType==="road",Ya=_.shadowRenderer,Na=sa&&Tt&&!!Ya&&Ya.enabled,$i=on(Na),Yc=sa&&Tt&&!_.terrain?zt:br,Xl=p.paint.get("icon-image-cross-fade");_.terrainRenderModeElevated()&&Tt&&Zs.push("PITCH_WITH_MAP_TERRAIN"),nn&&(Zs.push("PROJECTION_GLOBE_VIEW"),is&&Zs.push("PROJECTED_POS_ON_VIEWPORT")),Xl>0&&wr.hasAnySecondaryIcon&&Zs.push("ICON_TRANSITION"),!wr.icon.zOffsetVertexBuffer||sa&&_.terrain||Zs.push("Z_OFFSET"),Ee===0&&$e===0&&Ke===0&&Ue===1||Zs.push("COLOR_ADJUSTMENT"),wr.sdfIcons&&Zs.push("RENDER_SDF"),Na&&Zs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),sa&&Tt&&!_.terrain&&wr.icon.orientationVertexBuffer&&Zs.push("ELEVATED_ROADS");const zo=wr.icon.programConfigurations.get(p.id),uc=_.getOrCreateProgram("symbol",{config:zo,defines:Zs}),hc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],Ll=wr.iconSizeData,lu=a.bK(Ll,st.zoom),Yu=Tt||!st.isOrthographic,vd=Mc(Rr,Sr.tileID.canonical,Tt,_t,st,wr.getProjection(),Vr),za=J1(Rr,Sr.tileID.canonical,Tt,_t,st,wr.getProjection(),Vr),ro=_.translatePosMatrix(za,Sr,z,Y,!0),Ui=_.translatePosMatrix(Rr,Sr,z,Y),mo=is?xv:vd,Pa=_t&&!Tt&&!mi;let Sa=Ar;!qt&&!st.mercatorFromTransition||_t||(Sa=fp(st));const Xu=nn?Sa:Ar,Av=p.getColorAdjustmentMatrix(Ee,$e,Ke,Ue),Nh=Rk(Ll.kind,lu,Pa,Tt,_,Ui,mo,ro,mt,!1,hc,[0,0],0,qr,Jr,Nt,Is,Xu,wr.getProjection(),$i,ci,Av,Xl,null),Ev=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,Dy=p.layout.get("icon-size").constantOr(0)!==1||wr.iconsNeedLinear,gf=wr.sdfIcons||_.options.rotating||_.options.zooming||Dy||Yu?ot.LINEAR:ot.NEAREST,wp=wr.sdfIcons&&p.paint.get("icon-halo-width").constantOr(1)!==0,Ry=_.terrain&&Tt&&mi?a.bl(a.bC(),vd):xv;if(mi&&wr.icon){const zm=a.bV.getAtTileOffsetFunc(qr,st.center.lat,st.worldSize,wr.getProjection()),jp=ak(Rr,Sr.tileID.canonical,Tt,_t,st,wr.getProjection(),Vr),Sh=p.layout.get("icon-size-scale-range"),kp=a.aA(_.scaleFactor,Sh[0],Sh[1]);DI(wr,Rr,_,!1,jp,za,Tt,xe,zm,qr,kp)}return{program:uc,buffers:wr.icon,uniformValues:Nh,atlasTexture:Ev,atlasTextureIcon:null,atlasInterpolation:gf,atlasInterpolationIcon:null,isSDF:wr.sdfIcons,hasHalo:wp,depthMode:Yc,tile:Sr,renderWithShadows:Na,labelPlaneMatrixInv:Ry}},Ai=()=>{const mi=It&&p.layout.get("symbol-placement")!=="point",Zs=[],is=mi||Zt||Kn,sa=wr.elevationType==="road",Ya=_.shadowRenderer,Na=sa&&Vt&&!!Ya&&Ya.enabled,$i=on(Na),Yc=sa&&Vt&&!_.terrain?zt:br;_.terrainRenderModeElevated()&&Vt&&Zs.push("PITCH_WITH_MAP_TERRAIN"),nn&&(Zs.push("PROJECTION_GLOBE_VIEW"),is&&Zs.push("PROJECTED_POS_ON_VIEWPORT")),!wr.text.zOffsetVertexBuffer||sa&&_.terrain||Zs.push("Z_OFFSET"),wr.iconsInText&&Zs.push("RENDER_TEXT_AND_SYMBOL"),Zs.push("RENDER_SDF"),Na&&Zs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),sa&&Vt&&!_.terrain&&wr.text.orientationVertexBuffer&&Zs.push("ELEVATED_ROADS"),ri(Zs);const Xl=wr.text.programConfigurations.get(p.id),zo=_.getOrCreateProgram("symbol",{config:Xl,defines:Zs});let uc,hc=[0,0],Ll=null;const lu=wr.textSizeData;wr.iconsInText&&(hc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],Ll=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,uc=Vt||!st.isOrthographic||_.options.rotating||_.options.zooming||lu.kind==="composite"||lu.kind==="camera"?ot.LINEAR:ot.NEAREST);const Yu=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture.size:[0,0],vd=p.layout.get("text-size-scale-range"),za=a.aA(_.scaleFactor,vd[0],vd[1]),ro=a.bK(lu,st.zoom,za),Ui=Mc(Rr,Sr.tileID.canonical,Vt,It,st,wr.getProjection(),Vr),mo=J1(Rr,Sr.tileID.canonical,Vt,It,st,wr.getProjection(),Vr),Pa=_.translatePosMatrix(mo,Sr,V,Q,!0),Sa=_.translatePosMatrix(Rr,Sr,V,Q),Xu=is?xv:Ui,Av=It&&!Vt&&!mi;let Nh=Ar;!qt&&!st.mercatorFromTransition||It||(Nh=fp(st));const Ev=Rk(lu.kind,ro,Av,Vt,_,Sa,Xu,Pa,mt,!0,Yu,hc,0,qr,Jr,Nt,Is,nn?Nh:Ar,wr.getProjection(),$i,ci,null,null,za),Dy=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture:null,gf=ot.LINEAR,wp=p.paint.get("text-halo-width").constantOr(1)!==0,Ry=_.terrain&&Vt&&mi?a.bl(a.bC(),Ui):xv;if(mi&&wr.text){const zm=a.bV.getAtTileOffsetFunc(qr,st.center.lat,st.worldSize,wr.getProjection()),jp=ak(Rr,Sr.tileID.canonical,Vt,It,st,wr.getProjection(),Vr);DI(wr,Rr,_,!0,jp,mo,Vt,Pe,zm,qr,za)}return{program:zo,buffers:wr.text,uniformValues:Ev,atlasTexture:Dy,atlasTextureIcon:Ll,atlasInterpolation:gf,atlasInterpolationIcon:uc,isSDF:!0,hasHalo:wp,depthMode:Yc,tile:Sr,renderWithShadows:Na,labelPlaneMatrixInv:Ry}},_i=wr.icon.segments.get().length,ei=wr.text.segments.get().length,ss=_i&&!O.onlyText?pi():null,hi=ei&&!O.onlyIcons?Ai():null,Ia=p.paint.get("icon-opacity").constantOr(1),pa=p.paint.get("text-opacity").constantOr(1);if(Ht&&wr.canOverlap){nr=!0;const mi=Ia&&!O.onlyText?wr.icon.segments.get():[],Zs=pa&&!O.onlyIcons?wr.text.segments.get():[];for(const is of mi)ur.push({segments:new a.bg([is]),sortKey:is.sortKey,state:ss});for(const is of Zs)ur.push({segments:new a.bg([is]),sortKey:is.sortKey,state:hi})}else O.onlyText||ur.push({segments:Ia?wr.icon.segments:new a.bg([]),sortKey:0,state:ss}),O.onlyIcons||ur.push({segments:pa?wr.text.segments:new a.bg([]),sortKey:0,state:hi})}nr&&ur.sort((qr,Sr)=>qr.sortKey-Sr.sortKey);for(const qr of ur){const Sr=qr.state;if(Sr)if(_.terrain?_.terrain.setupElevationDraw(Sr.tile,Sr.program,{useDepthForOcclusion:st.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Sr.labelPlaneMatrixInv}):_.setupDepthForOcclusion(st.depthOcclusionForSymbolsAndCircles,Sr.program),ht.activeTexture.set(ot.TEXTURE0),Sr.atlasTexture&&Sr.atlasTexture.bind(Sr.atlasInterpolation,ot.CLAMP_TO_EDGE,!0),Sr.atlasTextureIcon&&(ht.activeTexture.set(ot.TEXTURE1),Sr.atlasTextureIcon&&Sr.atlasTextureIcon.bind(Sr.atlasInterpolationIcon,ot.CLAMP_TO_EDGE,!0)),Sr.renderWithShadows&&_.shadowRenderer.setupShadows(Sr.tile.tileID.toUnwrapped(),Sr.program,"vector-tile"),_.uploadCommonLightUniforms(_.context,Sr.program),Sr.hasHalo){const wr=Sr.uniformValues;wr.u_is_halo=1,s3(Sr.buffers,qr.segments,p,_,Sr.program,Sr.depthMode,M,L,wr,2),wr.u_is_halo=0}else{if(Sr.isSDF){const wr=Sr.uniformValues;Sr.hasHalo&&(wr.u_is_halo=1,s3(Sr.buffers,qr.segments,p,_,Sr.program,Sr.depthMode,M,L,wr,1)),wr.u_is_halo=0}s3(Sr.buffers,qr.segments,p,_,Sr.program,Sr.depthMode,M,L,Sr.uniformValues,1)}}}function s3(_,d,p,b,M,L,O,z,V,Y){const Q=[_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer,_.iconTransitioningVertexBuffer,_.globeExtVertexBuffer,_.zOffsetVertexBuffer,_.orientationVertexBuffer];M.draw(b,b.context.gl.TRIANGLES,L,O,z,Fn.disabled,V,p.id,_.layoutVertexBuffer,_.indexBuffer,d,p.paint,b.transform.zoom,_.programConfigurations.get(p.id),Q,Y)}function fP(_,d){const p=1<<_.canonical.z,b=(d.x*p-_.canonical.x-_.wrap*p)*a.al,M=(d.y*p-_.canonical.y)*a.al,L=a.e8(d.z,d.y);return a.d5(b,M,L)}function zk(_,d,p,b,M){if(!p.layout||p.layout.get("fill-elevation-reference")==="none"||p.paint.get("fill-opacity").constantOr(1)===0)return;const L=_.context.gl,O=new cn(_.context.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D),z=new cn(_.context.gl.GREATER,cn.ReadWrite,_.depthRangeFor3D),V=function(de){let be=.01;return de.isOrthographic&&(be=a.ak(1e-4,be,a.d0(de.pitch>=bh?1:de.pitch/bh))),2*be}(_.transform),Y=_.transform.getFreeCameraOptions().position,Q="elevatedStructuresDepthReconstruct",ce=_.getOrCreateProgram(Q,{defines:["DEPTH_RECONSTRUCTION"]}),le=_.getOrCreateProgram(Q);for(const de of b){const be=d.getTile(de),xe=be.getBucket(p);if(!xe)continue;const Pe=xe.elevatedStructures;if(!Pe)continue;const Ee=xe.elevationBufferData.heightRange,$e=fP(de.toUnwrapped(),Y),Ke=_.translatePosMatrix(de.projMatrix,be,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));let Ue,mt,ct,ht;if(M==="initialize"){if(!Ee||Ee.min>=1||Pe.depthSegments.segments[0].primitiveLength===0)continue;Ue=Ug(Ke,$e,V,1,0),mt=O,ct=Pe.depthSegments,ht=ce}else if(M==="reset"){if(!Ee||Ee.min>=0||Pe.maskSegments.segments[0].primitiveLength===0)continue;Ue=Ug(Ke,$e,0,0,1),mt=z,ct=Pe.maskSegments,ht=ce}else if(M==="geometry"){if(Pe.depthSegments.segments[0].primitiveLength===0)continue;Ue=Ug(Ke,$e,V,1,0),mt=O,ct=Pe.depthSegments,ht=le}ht.draw(_,L.TRIANGLES,mt,zn.disabled,ns.disabled,Fn.disabled,Ue,p.id,Pe.vertexBuffer,Pe.indexBuffer,ct,p.paint,_.transform.zoom)}}function Bk(_,d,p,b){const{painter:M,sourceCache:L,layer:O,coords:z,colorMode:V,elevationType:Y,terrainEnabled:Q,pass:ce}=_,le=M.context.gl,de=O.paint.get("fill-pattern"),be=O.paint.get("fill-pattern-cross-fade"),xe=de.constantOr(null);let Pe=Y;Y!=="road"||d&&!Q||(Pe="none");const Ee=Pe==="road",$e=_.painter.shadowRenderer,Ke=Ee&&!!$e&&$e.enabled,Ue=new cn(M.context.gl.LEQUAL,cn.ReadOnly,M.depthRangeFor3D);let mt=[0,0,0];if(Ke){const st=M.style.directionalLight,_t=M.style.ambientLight;st&&_t&&(mt=up(M.style,st,_t))}const ct=de&&de.constantOr(1),ht=M.terrain&&M.terrain.renderingToTexture,ot=(st,_t)=>{let It,Tt,Vt,Ht,nr;_t?(It=ct&&!O.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Vt=le.LINES):(It=ct?"fillPattern":"fill",Vt=le.TRIANGLES);for(const br of z){const zt=L.getTile(br);if(ct&&!zt.patternsLoaded())continue;const Nt=zt.getBucket(O);if(!Nt)continue;const Zt=d?Nt.elevationBufferData:Nt.bufferData;if(Zt.isEmpty())continue;M.prepareDrawTile();const qt=Zt.programConfigurations.get(O.id),ur=M.isTileAffectedByFog(br),Ar=[],qr=[];Ee&&(Ar.push("ELEVATED_ROADS"),qr.push(Zt.elevatedLayoutVertexBuffer)),Ke&&Ar.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ht&&p&&Ar.push("USE_MRT1"),ct&&(M.context.activeTexture.set(le.TEXTURE0),zt.imageAtlasTexture&&zt.imageAtlasTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE),qt.updatePaintBuffers());let Sr=!1;if(xe&&zt.imageAtlas){const Vr=zt.imageAtlas,jn=a.e3.from(xe),Kn=jn.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Is=jn.getSecondary(),ci=Vr.patternPositions.get(Kn),on=Is?Vr.patternPositions.get(Is.scaleSelf(a.o.devicePixelRatio).toString()):null;Sr=!!ci&&!!on,ci&&qt.setConstantPatternPositions(ci,on)}be>0&&(Sr||qt.getPatternTransitionVertexBuffer("fill-pattern"))&&Ar.push("FILL_PATTERN_TRANSITION");const wr=M.getOrCreateProgram(It,{config:qt,overrideFog:ur,defines:Ar}),nn=M.translatePosMatrix(br.projMatrix,zt,O.paint.get("fill-translate"),O.paint.get("fill-translate-anchor"));Ke&&$e.setupShadows(zt.tileID.toUnwrapped(),wr,"vector-tile");const Jr=O.paint.get("fill-emissive-strength");if(_t){Ht=Zt.lineIndexBuffer,nr=Zt.lineSegments;const Vr=M.terrain&&M.terrain.renderingToTexture?M.terrain.drapeBufferSize:[le.drawingBufferWidth,le.drawingBufferHeight];Tt=It==="fillOutlinePattern"&&ct?e3(nn,Jr,M,zt,Vr,mt,be):nP(nn,Jr,Vr,mt)}else Ht=Zt.indexBuffer,nr=Zt.triangleSegments,Tt=ct?J5(nn,Jr,M,zt,mt,be):Q5(nn,Jr,mt);M.uploadCommonUniforms(M.context,wr,br.toUnwrapped());let Rr=st;(Y==="road"&&!Q||Y==="offset")&&(Rr=Ue),wr.draw(M,Vt,Rr,b||M.stencilModeForClipping(br),V,Fn.disabled,Tt,O.id,Zt.layoutVertexBuffer,Ht,nr,O.paint,M.transform.zoom,qt,qr)}};M.renderPass===ce&&ot(M.depthModeForSublayer(1,M.renderPass==="opaque"?cn.ReadWrite:cn.ReadOnly),!1),Pe==="none"&&M.renderPass==="translucent"&&O.paint.get("fill-antialias")&&ot(M.depthModeForSublayer(O.getPaintProperty("fill-outline-color")?2:0,cn.ReadOnly),!0)}function $k(_,d,p,b,M,L,O,z){p.resetLayerRenderingStats(_);const V=_.context,Y=V.gl,Q=_.transform,ce=p.paint.get("fill-extrusion-pattern"),le=p.paint.get("fill-extrusion-pattern-cross-fade"),de=ce.constantOr(null),be=ce.constantOr(1),xe=p.paint.get("fill-extrusion-opacity"),Pe=_.style.enable3dLights(),Ee=p.paint.get(Pe&&!be?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),$e=[p.paint.get("fill-extrusion-ambient-occlusion-intensity"),Ee],Ke=p.layout.get("fill-extrusion-edge-radius"),Ue=Ke>0&&!p.paint.get("fill-extrusion-rounded-roof"),mt=Ue?0:Ke,ct=Q.projection.name==="globe"?a.eb():0,ht=Q.projection.name==="globe",ot=ht?a.aj(Q.zoom):0,st=[a.aF(Q.center.lng),a.aJ(Q.center.lat)],_t=p.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",It=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(_t?null:p.lut).toArray01().slice(0,3),Tt=p.paint.get("fill-extrusion-flood-light-intensity"),Vt=p.paint.get("fill-extrusion-vertical-scale"),Ht=p.paint.get("fill-extrusion-line-width").constantOr(1)!==0,nr=p.paint.get("fill-extrusion-height-alignment"),br=p.paint.get("fill-extrusion-base-alignment"),zt=Nm(_,p.paint.get("fill-extrusion-cutoff-fade-range")),Nt=[];let Zt;ht&&Nt.push("PROJECTION_GLOBE_VIEW"),$e[0]>0&&Nt.push("FAUX_AO"),Ue&&Nt.push("ZERO_ROOF_RADIUS"),z&&Nt.push("HAS_CENTROID"),Tt>0&&Nt.push("FLOOD_LIGHT"),zt.shouldRenderCutoff&&Nt.push("RENDER_CUTOFF"),Ht&&Nt.push("RENDER_WALL_MODE");const qt=_.renderPass==="shadow",ur=_.shadowRenderer,Ar=qt&&!!ur,qr=qt?Fn.disabled:Fn.backCCW;_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0);let Sr=[0,0,0];if(ur){const Jr=_.style.directionalLight,Rr=_.style.ambientLight;Jr&&Rr&&(Sr=up(_.style,Jr,Rr)),qt||(Nt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ur.useNormalOffset&&Nt.push("NORMAL_OFFSET")),Zt=Nt.concat(["SHADOWS_SINGLE_CASCADE"])}const wr=Ar?"fillExtrusionDepth":be?"fillExtrusionPattern":"fillExtrusion",nn=p.getLayerRenderingStats();for(const Jr of b){const Rr=d.getTile(Jr),Vr=Rr.getBucket(p);if(!Vr||Vr.projection.name!==Q.projection.name)continue;let jn=!1;ur&&(jn=ur.getMaxCascadeForTile(Jr.toUnwrapped())===0);const Kn=_.isTileAffectedByFog(Jr),Is=Vr.programConfigurations.get(p.id);let ci=!1;if(de&&Rr.imageAtlas){const ei=Rr.imageAtlas,ss=a.e3.from(de),hi=ss.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Ia=ss.getSecondary(),pa=ei.patternPositions.get(hi),mi=Ia?ei.patternPositions.get(Ia.scaleSelf(a.o.devicePixelRatio).toString()):null;ci=!!pa&&!!mi,pa&&Is.setConstantPatternPositions(pa,mi)}le>0&&(ci||Is.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Nt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const on=_.getOrCreateProgram(wr,{config:Is,defines:jn?Zt:Nt,overrideFog:Kn});if(_.terrain&&_.terrain.setupElevationDraw(Rr,on,{useMeterToDem:!0}),!Vr.centroidVertexBuffer){const ei=on.getAttributeLocation(Y,"a_centroid_pos");ei!==-1&&Y.vertexAttrib2f(ei,0,0)}!qt&&ur&&ur.setupShadows(Rr.tileID.toUnwrapped(),on,"vector-tile"),be&&(_.context.activeTexture.set(Y.TEXTURE0),Rr.imageAtlasTexture&&Rr.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Is.updatePaintBuffers());const ri=p.paint.get("fill-extrusion-vertical-gradient"),Hn=1/Vr.tileToMeter;let pi;if(qt&&ur){if(mp(Rr.tileID,Vr.maxHeight,_))continue;const ei=ur.calculateShadowPassMatrixFromTile(Rr.tileID.toUnwrapped());pi=X5(ei,mt,Hn,Vt,nr,br)}else{const ei=_.translatePosMatrix(Jr.expandedProjMatrix,Rr,p.paint.get("fill-extrusion-translate"),p.paint.get("fill-extrusion-translate-anchor")),ss=Q.projection.createInversionMatrix(Q,Jr.canonical);pi=be?rP(ei,_,ri,xe,$e,mt,Hn,Jr,Rr,ct,nr,br,ot,st,ss,It,Vt,le):Pk(ei,_,ri,xe,$e,mt,Hn,Jr,ct,nr,br,ot,st,ss,It,Vt,Tt,Sr)}_.uploadCommonUniforms(V,on,Jr.toUnwrapped(),null,zt);let Ai=Vr.segments;if(Q.projection.name==="mercator"&&!qt&&(Ai=Vr.getVisibleSegments(Rr.tileID,_.terrain,_.transform.getFrustum(0)),!Ai.get().length))continue;if(nn)if(qt)for(const ei of Ai.get())nn.numRenderedVerticesInShadowPass+=ei.primitiveLength;else for(const ei of Ai.get())nn.numRenderedVerticesInTransparentPass+=ei.primitiveLength;const _i=[];(_.terrain||z)&&_i.push(Vr.centroidVertexBuffer),ht&&_i.push(Vr.layoutVertexExtBuffer),Ht&&_i.push(Vr.wallVertexBuffer),on.draw(_,V.gl.TRIANGLES,M,L,O,qr,pi,p.id,Vr.layoutVertexBuffer,Vr.indexBuffer,Ai,p.paint,_.transform.zoom,Is,_i)}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1)}class i3{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function pp(_,d,p,b,M,L,O,z,V,Y,Q,ce,le,de,be,xe,Pe,Ee,$e,Ke){const Ue=d.context,mt=Ue.gl,ct=d.transform,ht=d.transform.zoom,ot=[],st=_.translate,_t=_.translateAnchor,It=_.edgeRadius,Tt=Nm(d,_.cutoffFadeRange);Q==="clear"?(ot.push("CLEAR_SUBPASS"),Ke&&(ot.push("CLEAR_FROM_TEXTURE"),Ue.activeTexture.set(mt.TEXTURE0),Ke.bind(mt.LINEAR,mt.CLAMP_TO_EDGE))):Q==="sdf"?ot.push("SDF_SUBPASS"):Q==="emissive"&&(ot.push("USE_MRT1"),Ue.activeTexture.set(mt.TEXTURE0),Ke.bind(mt.LINEAR,mt.CLAMP_TO_EDGE)),Ee&&ot.push("HAS_CENTROID"),Tt.shouldRenderCutoff&&ot.push("RENDER_CUTOFF");const Vt=(Ht,nr,br,zt,Nt)=>{let Zt=ot;nr.groundRadiusBuffer!=null&&(Zt=ot.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const qt=nr.programConfigurations.get(b.id),ur=d.isTileAffectedByFog(Ht),Ar=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:qt,defines:Zt,overrideFog:ur}),qr=Ny(d,zt,ce,Y,Nt,[le,de*Nt],be,xe,Pe,ht>=17?0:It*Nt,Ke?Ke.size[0]:0),Sr=[];Ee&&Sr.push(nr.hiddenByLandmarkVertexBuffer),nr.groundRadiusBuffer!=null&&Sr.push(nr.groundRadiusBuffer),d.uploadCommonUniforms(Ue,Ar,Ht.toUnwrapped(),null,Tt),Ar.draw(d,Ue.gl.TRIANGLES,L,O,z,V,qr,b.id,nr.vertexBuffer,nr.indexBuffer,br,b.paint,ht,qt,Sr)};for(const Ht of M){const nr=p.getTile(Ht),br=nr.getBucket(b);if(!br||br.projection.name!==ct.projection.name||!br.groundEffect||br.groundEffect&&!br.groundEffect.hasData())continue;const zt=br.groundEffect,Nt=1/br.tileToMeter;{const Zt=d.translatePosMatrix(Ht.projMatrix,nr,st,_t),qt=zt.getDefaultSegment();Vt(Ht,zt,qt,Zt,Nt)}if($e)for(let Zt=0;Zt<4;Zt++){const qt=a.e9[Zt](Ht),ur=p.getTile(qt);if(!ur)continue;const Ar=ur.getBucket(b);if(!Ar||Ar.projection.name!==ct.projection.name||!Ar.groundEffect||Ar.groundEffect&&!Ar.groundEffect.hasData())continue;const qr=Ar.groundEffect;let Sr,wr;Zt===0?(Sr=[-a.al,0,0],wr=1):Zt===1?(Sr=[a.al,0,0],wr=0):Zt===2?(Sr=[0,-a.al,0],wr=3):(Sr=[0,a.al,0],wr=2);const nn=qr.regionSegments[wr];if(!nn)continue;const Jr=new Float32Array(16);a.br(Jr,Ht.projMatrix,Sr),Vt(Ht,qr,nn,d.translatePosMatrix(Jr,nr,st,_t),Nt)}}}function Jie(_,d,p,b,M,L,O){b.centroidVertexArray.length===0&&b.createCentroidsBuffer();const z=L?L.findDEMTileFor(p):null;if(!(z&&z.dem||O))return;L&&z&&z.dem&&b.selfDEMTileTimestamp!==z.dem._timestamp&&(b.borderDoneWithNeighborZ=[-1,-1,-1,-1],b.selfDEMTileTimestamp=z.dem._timestamp);const V=Ee=>new a.P(Math.ceil((Ee+a.ed)*a.ee),0),Y=Ee=>{const $e=d.getSource().minzoom,Ke=mt=>{const ct=d.getTileByID(mt);if(ct&&ct.hasData())return ct.getBucket(M)},Ue=[0,-1,1];for(const mt of Ue){if(Ee.overscaledZ+mt<$e)continue;const ct=Ke(Ee.calculateScaledKey(Ee.overscaledZ+mt));if(ct)return ct}},Q=[0,0,0],ce=(Ee,$e)=>(Q[0]=Math.min(Ee.min.y,$e.min.y),Q[1]=Math.max(Ee.max.y,$e.max.y),Q[2]=a.al-$e.min.x>Ee.max.x?$e.min.x-a.al:Ee.max.x,Q),le=(Ee,$e)=>(Q[0]=Math.min(Ee.min.x,$e.min.x),Q[1]=Math.max(Ee.max.x,$e.max.x),Q[2]=a.al-$e.min.y>Ee.max.y?$e.min.y-a.al:Ee.max.y,Q),de=[(Ee,$e)=>ce(Ee,$e),(Ee,$e)=>ce($e,Ee),(Ee,$e)=>le(Ee,$e),(Ee,$e)=>le($e,Ee)],be=(Ee,$e,Ke,Ue,mt,ct,ht)=>{if(!L)return 0;const ot=[[ct?Ke:Ee,ct?Ee:Ke,0],[ct?Ke:$e,ct?$e:Ke,0]],st=ht<0?a.al+ht:ht,_t=[ct?st:(Ee+$e)/2,ct?(Ee+$e)/2:st,0];return Ke===0&&ht<0||Ke!==0&&ht>0?L.getForTilePoints(mt,[_t],!0,Ue):ot.push(_t),L.getForTilePoints(p,ot,!0,z),Math.max(ot[0][2],ot[1][2],_t[2])/L.exaggeration()};for(let Ee=0;Ee<4;Ee++){const $e=b.borderFeatureIndices[Ee];if($e.length===0)continue;const Ke=a.e9[Ee](p),Ue=Y(Ke);if(!(Ue&&Ue instanceof a.ea))continue;const mt=L?L.findDEMTileFor(Ke):null;if(!(mt&&mt.dem||O)||(L&&mt&&mt.dem&&b.borderDEMTileTimestamp[Ee]!==mt.dem._timestamp&&(b.borderDoneWithNeighborZ[Ee]=-1,b.borderDEMTileTimestamp[Ee]=mt.dem._timestamp),b.borderDoneWithNeighborZ[Ee]===Ue.canonical.z))continue;Ue.centroidVertexArray.length===0&&Ue.createCentroidsBuffer();const ct=(Ee<2?1:5)-Ee,ht=Ue.borderDoneWithNeighborZ[ct]!==b.canonical.z,ot=Ue.borderFeatureIndices[ct];let st=0;if(b.canonical.z!==Ue.canonical.z){for(const _t of $e)b.showCentroid(b.featuresOnBorder[_t]);if(ht)for(const _t of ot)Ue.showCentroid(Ue.featuresOnBorder[_t]);b.borderDoneWithNeighborZ[Ee]=Ue.canonical.z,Ue.borderDoneWithNeighborZ[ct]=b.canonical.z}for(const _t of $e){const It=b.featuresOnBorder[_t],Tt=b.centroidData[It.centroidDataIndex],Vt=It.borders[Ee];let Ht;for(;stVt[0]+3||nr[0]>Vt[0]-3)break;Ue.showCentroid(Ht),st++}if(Ht&&stVt[1]-3)&&(br++,++st!==ot.length);)Ht=Ue.featuresOnBorder[ot[st]];Ht=Ue.featuresOnBorder[ot[nr]];let zt=!1;if(br>=1){const qt=Ht.borders[ct];Math.abs(Vt[0]-qt[0])<3&&Math.abs(Vt[1]-qt[1])<3&&(br=1,zt=!0,st=nr+1)}else if(br===0){b.showCentroid(It);continue}const Nt=Ue.centroidData[Ht.centroidDataIndex];O&&zt&&(((xe=Tt).flags|(Pe=Nt).flags)&a.ec?(xe.flags|=a.ec,Pe.flags|=a.ec):(xe.flags&=~a.ec,Pe.flags&=~a.ec));const Zt=It.intersectsCount()>1||Ht.intersectsCount()>1;if(br>1)st=nr,Tt.centroidXY=Nt.centroidXY=new a.P(0,0);else if(mt&&mt.dem&&!Zt){const qt=de[Ee](Tt,Nt),ur=Ee%2?a.al-1:0,Ar=be(qt[0],Math.min(a.al-1,qt[1]),ur,mt,Ke,Ee<2,qt[2]);Tt.centroidXY=Nt.centroidXY=V(Ar)}else Zt?Tt.centroidXY=Nt.centroidXY=new a.P(0,0):(Tt.centroidXY=b.encodeBorderCentroid(It),Nt.centroidXY=Ue.encodeBorderCentroid(Ht));b.writeCentroidToBuffer(Tt),Ue.writeCentroidToBuffer(Nt)}else b.showCentroid(It)}b.borderDoneWithNeighborZ[Ee]=Ue.canonical.z,Ue.borderDoneWithNeighborZ[ct]=b.canonical.z}var xe,Pe;(b.needsCentroidUpdate||!b.centroidVertexBuffer&&b.centroidVertexArray.length!==0)&&b.uploadCentroid(_)}const Rd=[1,0,0],a3=[0,1,0],Kc=[0,0,1];function mp(_,d,p){const b=p.transform,M=p.shadowRenderer;if(!M)return!0;const L=_.toUnwrapped(),O=b.tileSize*M._cascades[p.currentShadowCascade].scale;let z=d;if(b.elevation){const xe=b.elevation.getMinMaxForTile(_);xe&&(z+=xe.max)}const V=[...M.shadowDirection];V[2]=-V[2];const Y=M.computeSimplifiedTileShadowVolume(L,z,O,V);if(!Y)return!1;const Q=[Rd,a3,Kc,V,[V[0],0,V[2]],[0,V[1],V[2]]],ce=b.projection.name==="globe",le=b.scaleZoom(O),de=a.cB.fromInvProjectionMatrix(b.invProjMatrix,b.worldSize,le,!ce),be=M.getCurrentCascadeFrustum();return de.intersectsPrecise(Y.vertices,Y.planes,Q)===0||be.intersectsPrecise(Y.vertices,Y.planes,Q)===0}function vv(_){const{painter:d,source:p,layer:b,coords:M}=_;let L=_.defines;const O=d.context,z=d.renderPass==="shadow",V=d.renderPass==="light-beam",Y=d.shadowRenderer,Q=a.ef(d.transform.center.lat,d.transform.zoom),ce=Nm(d,b.paint.get("building-cutoff-fade-range"));ce.shouldRenderCutoff&&(L=L.concat("RENDER_CUTOFF")),_.floodLightIntensity>0&&(L=L.concat("FLOOD_LIGHT"));for(const le of M){const de=p.getTile(le),be=de.getBucket(b);if(!be)continue;Y&&Y.getMaxCascadeForTile(le.toUnwrapped())===0&&(L=L.concat("SHADOWS_SINGLE_CASCADE"));const xe=be.programConfigurations.get(b.id);let Pe,Ee,$e,Ke=d.translatePosMatrix(le.expandedProjMatrix,de,[0,0],"map");if(Ke=a.cS(a.bC(),Ke,[1,1,_.verticalScale]),z&&Y){if(mp(de.tileID,be.maxHeight*Q,d))continue;let mt=Y.calculateShadowPassMatrixFromTile(de.tileID.toUnwrapped());mt=a.cS(a.bC(),mt,[1,1,_.verticalScale]),$e=Im(mt),Pe=Ee=d.getOrCreateProgram("buildingDepth",{config:xe,defines:L,overrideFog:!1})}else if(V)Pe=Ee=d.getOrCreateProgram("buildingBloom",{config:xe,defines:L,overrideFog:!1}),$e=sP(Ke);else{const mt=d.transform.calculatePosMatrix(le.toUnwrapped(),d.transform.worldSize);a.cS(mt,mt,[1,1,_.verticalScale]);const ct=a.bC();a.cS(ct,mt,[1,-1,1/Q]),a.bl(ct,ct),a.eg(ct,ct);const ht=d.transform.getFreeCameraOptions().position,ot=1<{if(V){const ht=mt.entranceBloom;ct.draw(d,O.gl.TRIANGLES,_.depthMode,zn.disabled,_.blendMode,Fn.disabled,$e,b.id,ht.layoutVertexBuffer,ht.indexBuffer,ht.segmentsBucket,b.paint,d.transform.zoom,xe,[ht.layoutAttenuationBuffer,ht.layoutColorBuffer])}else{const ht=mt.segmentsBucket;let ot=[mt.layoutNormalBuffer,mt.layoutCentroidBuffer,mt.layoutColorBuffer,mt.layoutFloodLightDataBuffer];mt.layoutFacadePaintBuffer&&(ot=ot.concat([mt.layoutFacadeDataBuffer,mt.layoutFacadeVerticalRangeBuffer,mt.layoutFacadePaintBuffer])),ct.draw(d,O.gl.TRIANGLES,_.depthMode,zn.disabled,_.blendMode,z?Fn.disabled:Fn.backCW,$e,b.id,mt.layoutVertexBuffer,mt.indexBuffer,ht,b.paint,d.transform.zoom,xe,ot)}};d.uploadCommonUniforms(O,Ee,le.toUnwrapped(),null,ce),be.buildingWithoutFacade&&Ue(be.buildingWithoutFacade,Ee),be.buildingWithFacade&&(Pe!==Ee&&d.uploadCommonUniforms(O,Pe,le.toUnwrapped(),null,ce),Ue(be.buildingWithFacade,Pe))}}function Uk(_,d,p,b,M,L,O,z,V,Y,Q,ce,le){const de=_.context.gl,be=_.depthModeForSublayer(1,cn.ReadOnly,de.LEQUAL,!0),xe=.1*(1-(Pe=Q))+3*Pe;var Pe;const Ee=_._showOverdrawInspector,$e=ce,Ke=new i3;Ee||pp(Ke,_,d,p,b,be,new zn({func:de.ALWAYS,mask:255},255,255,de.KEEP,de.KEEP,de.REPLACE),new ns([de.ONE,de.ONE,de.ONE,de.ONE],a.ao.transparent,[!1,!1,!1,!0],de.MIN),Fn.disabled,M,"sdf",L,O,z,V,Y,xe,$e,!1);{const Ue=Ee?zn.disabled:new zn({func:de.EQUAL,mask:255},255,255,de.KEEP,de.DECR,de.DECR),mt=Ee?_.colorModeForRenderPass():new ns([de.ONE_MINUS_DST_ALPHA,de.DST_ALPHA,de.ONE,de.ONE],a.ao.transparent,[!0,!0,!0,!0]);pp(Ke,_,d,p,b,be,Ue,mt,Fn.disabled,M,"color",L,O,z,V,Y,xe,$e,!1)}}function qk(_){return[_[0]*a.eh,_[1]*a.eh,_[2]*a.eh,0]}function _v(_,d,p,b,M,L,O,z,V){const Y=b.getSource(),Q=p.globeSharedBuffers;if(!Q)return;let ce,le,de;if(d&&(ce=b.getTile(d)),Y instanceof a.aU?(le=Y.texture,de=a.dK(0,0,p.transform)):ce&&d&&(le=ce.texture,de=a.dK(d.canonical.z,d.canonical.x,p.transform)),!le||!de)return;_||(de=a.cS(a.bC(),de,[1,-1,1]));const be=p.context,xe=be.gl,Pe=M.paint.get("raster-resampling")==="nearest"?xe.NEAREST:xe.LINEAR,Ee=p.colorModeForDrapableLayerRenderPass(L),$e=O.defines;$e.push("GLOBE_POLES");const Ke=new cn(xe.LEQUAL,cn.ReadWrite,p.depthRangeFor3D),Ue=Float32Array.from(p.transform.expandedFarZProjMatrix),mt=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0))));p.terrain&&p.terrain.prepareDrawTile(),be.activeTexture.set(xe.TEXTURE0),le.bind(Pe,xe.CLAMP_TO_EDGE),be.activeTexture.set(xe.TEXTURE1),le.bind(Pe,xe.CLAMP_TO_EDGE),"useMipmap"in le&&be.extTextureFilterAnisotropic&&p.transform.pitch>20&&xe.texParameterf(xe.TEXTURE_2D,be.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,be.extTextureFilterAnisotropicMax);const[ct,ht,ot,st]=d?Q.getPoleBuffers(d.canonical.z,!1):Q.getPoleBuffers(0,!0),_t=M.paint.get("raster-elevation");let It;_?(It=ct,p.renderDefaultNorthPole=_t!==0):(It=ht,p.renderDefaultSouthPole=_t!==0);const Tt=qk(O.mix),Vt=((nr,br,zt,Nt,Zt,qt,ur,Ar,qr,Sr,wr,nn,Jr)=>oP(nr,br,zt,new Float32Array(16),new Float32Array(9),[0,0],Nt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},qt,[0,0],Ar,2,Sr,wr,nn,1,0,Jr))(Ue,mt,de,a.aj(p.transform.zoom),0,M,0,_t,0,Tt,O.offset,O.range,L),Ht=p.getOrCreateProgram("raster",{defines:$e});p.uploadCommonUniforms(be,Ht,null),Ht.draw(p,xe.TRIANGLES,Ke,V,Ee,z,Vt,M.id,It,ot,st)}function pP(_){const d=_._nearZ,p=_.projection.farthestPixelDistance(_),b=p-d,M=.2*_.height,L=d+M;return[d,p,(L-M-d)/b,(L-d)/b]}function gp(_,d,p,b){if(_)return d instanceof Jo&&_ instanceof op?d.getTextureDescriptor(_,p,!0):{texture:_.texture,mix:qk(b.mix),offset:b.offset,buffer:0,tileSize:1}}var Ji=a.ei([{name:"a_index",type:"Int16",components:1}]);class Vk{constructor(d,p,b,M){const L={width:b[0],height:b[1],data:null},O=d.gl;this.targetColorTexture=new a.T(d,L,O.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new a.T(d,L,O.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(p,M),this.lastInvalidatedAt=0}updateParticleTexture(d,p){if(this.particleTextureDimension===p.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const b=this.context.gl,M=p.width*p.height;this.particleTexture0=new a.T(this.context,p,b.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new a.T(this.context,p,b.RGBA8,{premultiply:!1,useMipmap:!1});const L=new a.ej;L.reserve(M);for(let O=0;O0){const Tt=a.bj(p.canonical,V),Vt=a.el(Tt);le=a.aB(new Float32Array(16),V.globeMatrix,Vt),a.aB(le,V.projMatrix,le)}const de=a.bC();de[12]+=2*M/(a.o.devicePixelRatio*V.width),de[13]+=2*L/(a.o.devicePixelRatio*V.height),a.aB(le,de,le);const be=_.getOrCreateProgram("debug",{defines:ce}),xe=d.getTileByID(p.key);_.terrain&&_.terrain.setupElevationDraw(xe,be);const Pe=cn.disabled,Ee=zn.disabled,$e=_.colorModeForRenderPass(),Ke="$debug";z.activeTexture.set(Y.TEXTURE0),_.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Q?xe._makeGlobeTileDebugBuffers(_.context,V):xe._makeDebugTileBoundsBuffers(_.context,V.projection);const Ue=xe._tileDebugBuffer||_.debugBuffer,mt=xe._tileDebugIndexBuffer||_.debugIndexBuffer,ct=xe._tileDebugSegments||_.debugSegments;if(be.draw(_,Y.LINE_STRIP,Pe,Ee,$e,Fn.disabled,mv(le,b.toPremultipliedRenderColor(null)),Ke,Ue,mt,ct,null,null,null,[xe._globeTileDebugBorderBuffer]),O){const Tt=xe.latestRawTileData,Vt=Math.floor((Tt&&Tt.byteLength||0)/1024);let Ht=p.canonical.toString();p.overscaledZ!==p.canonical.z&&(Ht+=` => ${p.overscaledZ}`),Ht+=` ${xe.state}`,Ht+=` ${Vt}kb`,function(nr,br){nr.initDebugOverlayCanvas();const zt=nr.debugOverlayCanvas,Nt=nr.context.gl,Zt=nr.debugOverlayCanvas.getContext("2d");Zt.clearRect(0,0,zt.width,zt.height),Zt.shadowColor="white",Zt.shadowBlur=2,Zt.lineWidth=1.5,Zt.strokeStyle="white",Zt.textBaseline="top",Zt.font="bold 36px Open Sans, sans-serif",Zt.fillText(br,5,5),Zt.strokeText(br,5,5),nr.debugOverlayTexture.update(zt),nr.debugOverlayTexture.bind(Nt.LINEAR,Nt.CLAMP_TO_EDGE)}(_,Ht)}const ht=d.getTile(p).tileSize,ot=512/Math.min(ht,512)*(p.overscaledZ/V.zoom)*.5,st=xe._tileDebugTextBuffer||_.debugBuffer,_t=xe._tileDebugTextIndexBuffer||_.quadTriangleIndexBuffer,It=xe._tileDebugTextSegments||_.debugSegments;be.draw(_,Y.TRIANGLES,Pe,Ee,ns.alphaBlended,Fn.disabled,mv(le,a.ao.transparent.toPremultipliedRenderColor(null),ot),Ke,st,_t,It,null,null,null,[xe._globeTileDebugTextBuffer])}function Gg(_,d,p,b){Rt(_,0,d+p/2,_.transform.width,p,b)}function Fa(_,d,p,b){Rt(_,d-p/2,0,p,_.transform.height,b)}function Rt(_,d,p,b,M,L){const O=_.context,z=O.gl;z.enable(z.SCISSOR_TEST),z.scissor(d*a.o.devicePixelRatio,p*a.o.devicePixelRatio,b*a.o.devicePixelRatio,M*a.o.devicePixelRatio),O.clear({color:L}),z.disable(z.SCISSOR_TEST)}const vP=a.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Hk}=vP;function hf(_,d,p,b){_.emplaceBack(d,p,b)}class Wk{constructor(d){this.vertexArray=new a.em,this.indices=new a.b0,hf(this.vertexArray,-1,-1,1),hf(this.vertexArray,1,-1,1),hf(this.vertexArray,-1,1,1),hf(this.vertexArray,1,1,1),hf(this.vertexArray,-1,-1,-1),hf(this.vertexArray,1,-1,-1),hf(this.vertexArray,-1,1,-1),hf(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=d.createVertexBuffer(this.vertexArray,Hk),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=a.bg.simpleSegment(0,0,36,12)}}function Kg(_,d,p,b,M,L){const O=_.context.gl,z=d.paint.get("sky-atmosphere-color"),V=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),Q=((ce,le,de,be,xe)=>({u_matrix_3f:ce,u_sun_direction:le,u_sun_intensity:de,u_color_tint_r:[be.r,be.g,be.b,be.a],u_color_tint_m:[xe.r,xe.g,xe.b,xe.a],u_luminance:5e-5}))(a.eo(a.dO(),b),M,Y,z.toPremultipliedRenderColor(null),V.toPremultipliedRenderColor(null));O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+L,d.skyboxTexture,0),p.draw(_,O.TRIANGLES,cn.disabled,zn.disabled,ns.unblended,Fn.frontCW,Q,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const _P=a.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class My{constructor(d){const p=new a.ep;p.emplaceBack(-1,1,1,0,0),p.emplaceBack(1,1,1,1,0),p.emplaceBack(1,-1,1,1,1),p.emplaceBack(-1,-1,1,0,1);const b=new a.b0;b.emplaceBack(0,1,2),b.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(p,_P.members),this.indexBuffer=d.createIndexBuffer(b),this.segments=a.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const eae=a.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 tae{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class bP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new ns([1,lf,1,lf],a.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ns([1,0,1,0],a.ao.transparent,[!1,!1,!1,!0]),this.params=new tae,this.updateNeeded=!0}update(d){const p=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new My(p);const b=this.params.sizeRange,M=this.params.intensityRange,L=function(Q){const ce=a.eq(30),le=[];for(let de=0;de{const ot=L.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ht&&ot.push("ALPHA_PASS");const st=d.getOrCreateProgram("globeAtmosphere",{defines:ot}),_t=((Tt,Vt,Ht,nr,br,zt,Nt,Zt,qt,ur,Ar,qr)=>({u_frustum_tl:Tt,u_frustum_tr:Vt,u_frustum_br:Ht,u_frustum_bl:nr,u_horizon:br,u_transition:zt,u_fadeout_range:Nt,u_atmosphere_fog_color:Zt.toArray01(),u_high_color:qt.toArray01(),u_space_color:ur.toArray01(),u_temporal_offset:Ar,u_horizon_angle:qr}))(L.frustumCorners.TL,L.frustumCorners.TR,L.frustumCorners.BR,L.frustumCorners.BL,L.frustumCorners.horizon,z,Pe,Q,le,be,$e,mt);d.uploadCommonUniforms(b,st);const It=this.atmosphereBuffer;It&&st.draw(d,M.TRIANGLES,O,zn.disabled,ht?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Fn.backCW,_t,ht?"atmosphere_glow_alpha":"atmosphere_glow",It.vertexBuffer,It.indexBuffer,It.segments)};ct(!1),ct(!0)}drawStars(d,p){const b=a.aA(p.properties.get("star-intensity"),0,1);if(b===0)return;const M=d.context,L=M.gl,O=d.transform,z=d.getOrCreateProgram("stars"),V=a.c7([]);a.c9(V,V,-O._pitch),a.c8(V,V,-O.angle),a.c9(V,V,a.an(O._center.lat)),a.et(V,V,-a.an(O._center.lng));const Y=a.cc(new Float32Array(16),V),Q=a.aB([],O.starsProjMatrix,Y),ce=a.eo([],Y),le=a.eu([],ce),de=[0,1,0];a.dQ(de,de,le),a.c5(de,de,this.params.sizeMultiplier);const be=[1,0,0];a.dQ(be,be,le),a.c5(be,be,this.params.sizeMultiplier);const xe=(Pe=de,Ee=be,$e=b,{u_matrix:Float32Array.from(Q),u_up:Pe,u_right:Ee,u_intensity_multiplier:$e});var Pe,Ee,$e;d.uploadCommonUniforms(M,z),this.starsVx&&this.starsIdx&&z.draw(d,L.TRIANGLES,cn.disabled,zn.disabled,this.colorModeAlphaBlendedWriteRGB,Fn.disabled,xe,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Gk{constructor(){this.visibleTiles=[]}updateBorders(d,p){const b=[],M=[],L=d._getRenderableCoordinates(!1,!0);for(const V of L){const Y=d.getTile(V);if(!Y.hasData())continue;const Q=Y.getBucket(p);Q&&(Q.isEmpty()||(b.push(V.key),M.push({bucket:Q,tileID:V.canonical})))}let O=b.length!==this.visibleTiles.length;if(!O){b.sort();for(let V=0;VV.tileID.z-Y.tileID.z||V.tileID.x-Y.tileID.x||V.tileID.y-Y.tileID.y);for(const V of M){const Y=new Array,Q=new Array,ce=V.bucket;for(const le of ce.featuresOnBorder)z.has(le.featureId)?Q.push(le.footprintIndex):(z.add(le.featureId),Y.push(le.footprintIndex));ce.updateFootprintHiddenFlags(Y,a.ev,!1),ce.updateFootprintHiddenFlags(Q,a.ev,!0)}}}function Kk(_,d){const p=[..._],b=d.cameraWorldSizeForFog/d.worldSize,M=a.bA([]);return a.cS(M,M,[b,b,1]),a.aB(p,M,p),a.aB(p,d.worldToFogMatrix,p),p}function Zk(_,d,p,b,M){const L=p.material,O=b.context,{baseColorTexture:z,metallicRoughnessTexture:V}=L.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:Q,emissionTexture:ce}=L;function le(be,xe,Pe){if(be&&(_.push(xe),O.activeTexture.set(O.gl.TEXTURE0+Pe),be.gfxTexture)){const{minFilter:Ee,magFilter:$e,wrapS:Ke,wrapT:Ue}=be.sampler;be.gfxTexture.bindExtraParam(Ee,$e,Ke,Ue)}}le(z,"HAS_TEXTURE_u_baseColorTexture",wl.BaseColor),le(V,"HAS_TEXTURE_u_metallicRoughnessTexture",wl.MetallicRoughness),le(Y,"HAS_TEXTURE_u_normalTexture",wl.Normal),le(Q,"HAS_TEXTURE_u_occlusionTexture",wl.Occlusion),le(ce,"HAS_TEXTURE_u_emissionTexture",wl.Emission),M&&(M.texture||(M.texture=new a.d$(b.context,M.image,[M.image.height,M.image.height,M.image.height],O.gl.RGBA8)),O.activeTexture.set(O.gl.TEXTURE0+wl.LUT),M.texture&&M.texture.bind(O.gl.LINEAR,O.gl.CLAMP_TO_EDGE),_.push("APPLY_LUT_ON_GPU")),p.texcoordBuffer&&(_.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(p.texcoordBuffer)),p.colorBuffer&&(_.push(p.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(p.colorBuffer)),p.normalBuffer&&(_.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(p.normalBuffer)),p.pbrBuffer&&(_.push("HAS_ATTRIBUTE_a_pbr"),_.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(p.pbrBuffer)),L.alphaMode!=="OPAQUE"&&L.alphaMode!=="MASK"||_.push("UNPREMULT_TEXTURE_IN_SHADER"),L.defined||_.push("DIFFUSE_SHADED");const de=b.shadowRenderer;de&&(_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&_.push("NORMAL_OFFSET"))}function Yk(_,d,p,b,M,L){const O=_.modelOpacity,z=d.context,V=new cn(d.context.gl.LEQUAL,_.isLightMesh?cn.ReadOnly:cn.ReadWrite,d.depthRangeFor3D),Y=d.transform,Q=_.mesh,ce=Q.material,le=ce.pbrMetallicRoughness,de=d.style.fog;let be;be=d.transform.projection.zAxisUnit==="pixels"?[..._.nodeModelMatrix]:a.aB([],b.zScaleMatrix,_.nodeModelMatrix),a.aB(be,b.negCameraPosMatrix,be);const xe=a.bl([],be);a.eg(xe,xe);const Pe=p.paint.get("model-color-use-theme").constantOr("default")==="none",Ee=p.paint.get("model-emissive-strength").constantOr(0),$e=qg(new Float32Array(_.worldViewProjection),new Float32Array(be),new Float32Array(xe),null,d,O,le.baseColorFactor,ce.emissiveFactor,le.metallicFactor,le.roughnessFactor,ce,Ee,p,void 0,void 0,_.materialOverride,_.modelColor),Ke={defines:[]},Ue=[],mt=d.shadowRenderer;mt&&(mt.useNormalOffset=!1),Zk(Ke.defines,Ue,Q,d,Pe?null:p.lut);let ct=null;if(de){const st=Kk(_.nodeModelMatrix,d.transform);if(ct=new Float32Array(st),Y.projection.name!=="globe"){const _t=Q.aabb.min,It=Q.aabb.max,[Tt,Vt]=de.getOpacityForBounds(st,_t[0],_t[1],It[0],It[1]);Ke.overrideFog=Tt>=ar||Vt>=ar}}const ht=Nm(d,p.paint.get("model-cutoff-fade-range"));ht.shouldRenderCutoff&&Ke.defines.push("RENDER_CUTOFF");const ot=d.getOrCreateProgram("model",Ke);d.uploadCommonUniforms(z,ot,null,ct,ht),d.renderPass!=="shadow"&&mt&&mt.setupShadowsFromMatrix(_.nodeModelMatrix,ot),ot.draw(d,z.gl.TRIANGLES,V,M,L,Q.material.doubleSided?Fn.disabled:Fn.backCCW,$e,p.id,Q.vertexBuffer,Q.indexBuffer,Q.segments,p.paint,d.transform.zoom,void 0,Ue)}function bv(_,d){return _.style._importedAsBasemap?"basemap":d.scope}function Zg(_,d,p,b,M,L,O,z,V,Y){const Q=_.transform,ce=!!d.isGeometryBloom&&d.isGeometryBloom;if(ce&&_.renderPass==="shadow")return;const le=Q.projection.name==="globe"?a.eD(p,Q):[...p];a.aB(le,le,d.globalMatrix);const de=a.aB([],b,le);if(d.meshes)for(const be of d.meshes){const xe=z.get(be.material.name);if(xe&&xe.opacity<=0)continue;if(be.material.alphaMode!=="BLEND"){O.push({mesh:be,depth:0,modelIndex:M,worldViewProjection:de,nodeModelMatrix:le,isLightMesh:ce,materialOverride:xe,modelOpacity:V,modelColor:Y});continue}const Pe=a.af([],be.centroid,de);!Q.isOrthographic&&Pe[2]<=0||L.push({mesh:be,depth:Pe[2],modelIndex:M,worldViewProjection:de,nodeModelMatrix:le,isLightMesh:ce,materialOverride:xe,modelOpacity:V,modelColor:Y})}if(d.children)for(const be of d.children)Zg(_,be,p,b,M,L,O,z,V,Y)}function jh(_,d,p,b){const M=p.shadowRenderer;if(!M)return;const L=M.getShadowPassDepthMode(),O=M.getShadowPassColorMode(),z=M.calculateShadowPassMatrixFromMatrix(d),V=r3(z);p.getOrCreateProgram("modelDepth",{defines:p._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(p,p.context.gl.TRIANGLES,L,zn.disabled,O,Fn.disabled,V,b.id,_.vertexBuffer,_.indexBuffer,_.segments,b.paint,p.transform.zoom,void 0,void 0)}function wP(_,d,p,b,M,L){for(const O of M){const z=Object.assign({},b);z.part=O;const V={type:"Unknown",id:d,properties:z},Y={orientation:_.paint.get("model-rotation").evaluate(V,p)};L.set(O,Y)}}function jP(_,d,p,b,M,L){for(const O of M){const z=Object.assign({},b);z.part=O;const V={type:"Unknown",id:d,properties:z},Y={color:_.paint.get("model-color").evaluate(V,p),colorMix:_.paint.get("model-color-mix-intensity").evaluate(V,p),opacity:_.paint.get("model-opacity").evaluate(V,p),emissionStrength:_.paint.get("model-emissive-strength").evaluate(V,p)};L.set(O,Y)}}function kP(_,d,p,b,M){let L=!1;for(const z of b)z.modelOpacity!==1&&(Yk(z,_,d,M[z.modelIndex],zn.disabled,ns.disabled),L=!0);for(const z of b)Yk(z,_,d,M[z.modelIndex],z.modelOpacity!==1?_.stencilModeFor3D():zn.disabled,_.colorModeForRenderPass());L&&_.resetStencilClippingMasks();const O=ns.additive;for(const z of p)Yk(z,_,d,M[z.modelIndex],zn.disabled,z.isLightMesh?O:_.colorModeForRenderPass())}function NP(_,d,p){const b=d.updateZoomBasedPaintProperties(),M=function(L,O,z){let V,Y,Q,ce=L.terrain?L.terrain.exaggeration():0;if(L.terrain&&ce>0){const le=L.terrain,de=le.findDEMTileFor(z);de&&de.dem?V=a.eF.create(le,z,de):ce=0}if(ce===0&&(O.terrainElevationMin=0,O.terrainElevationMax=0),ce===O.validForExaggeration&&(ce===0||V&&V._demTile&&V._demTile.tileID===O.validForDEMTile.id&&V._dem._timestamp===O.validForDEMTile.timestamp))return!1;for(const le in O.instancesPerModel){const de=O.instancesPerModel[le];for(let be=0;beY&&(Y=de.max)}const Q=a.aA(b.x,L,O)-b.x,ce=a.aA(b.y,z,V)-b.y,le=a.cf(Y,d.center.lat)-b.z;return d._zoomFromMercatorZ(Math.sqrt(Q*Q+ce*ce+le*le))}function SP(_,d,p,b,M,L,O){const z=_.context,V=_.renderPass==="shadow",Y=_.shadowRenderer,Q=V&&Y?Y.getShadowPassDepthMode():new cn(z.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D),ce=_.isTileAffectedByFog(L),le=_.transform.projection.name==="globe";if(p.meshes)for(const de of p.meshes){const be=le?[]:["MODEL_POSITION_ON_GPU"],xe=[];let Pe,Ee,$e;const Ke=!le&&b.instancedDataArray.length>20;Ke&&be.push("INSTANCED_ARRAYS");const Ue=Nm(_,d.paint.get("model-cutoff-fade-range"));if(Ue.shouldRenderCutoff&&be.push("RENDER_CUTOFF"),V&&Y)Pe=_.getOrCreateProgram("modelDepth",{defines:be}),Ee=r3(O.shadowTileMatrix,O.shadowTileMatrix,Float32Array.from(p.globalMatrix)),$e=Y.getShadowPassColorMode();else{Zk(be,xe,de,_,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Pe=_.getOrCreateProgram("model",{defines:be,overrideFog:ce});const ct=de.material,ht=ct.pbrMetallicRoughness,ot=d.paint.get("model-opacity").constantOr(1),st=d.paint.get("model-emissive-strength").constantOr(0);Ee=qg(L.expandedProjMatrix,Float32Array.from(p.globalMatrix),new Float32Array(16),null,_,ot,ht.baseColorFactor,ct.emissiveFactor,ht.metallicFactor,ht.roughnessFactor,ct,st,d,M),Y&&(O.shadowUniformsInitialized?Pe.setShadowUniformValues(z,Y.getShadowUniformValues()):(Y.setupShadows(L.toUnwrapped(),Pe,"model-tile"),O.shadowUniformsInitialized=!0)),$e=Ue.shouldRenderCutoff||ot<1||ct.alphaMode!=="OPAQUE"?ns.alphaBlended:ns.unblended}_.uploadCommonUniforms(z,Pe,L.toUnwrapped(),null,Ue);const mt=de.material.doubleSided?Fn.disabled:Fn.backCCW;if(Ke)xe.push(b.instancedDataBuffer),Pe.draw(_,z.gl.TRIANGLES,Q,zn.disabled,$e,mt,Ee,d.id,de.vertexBuffer,de.indexBuffer,de.segments,d.paint,_.transform.zoom,void 0,xe,b.instancedDataArray.length);else{const ct=V?"u_instance":"u_normal_matrix";for(let ht=0;htV[1]?O:V,L[0]=p.max[0],O=a.aC(a.eG(),L,M),z=O[1]V[1]?O:V,L[1]=p.min[1],O=a.aC(a.eG(),L,M),z=O[1]V[1]?O:V;const Y=a.aA(b[0],0,1),Q=100*d.pixelsPerMeter*a.aA(b[1],0,1),ce=a.aA(b[2],0,1),le=a.eH(a.eG(),z,V,Y),de=Math.tan(.5*d.fovX),be=-le[2]*de;if(Q===0)return le[1]<-Math.abs(be)?ce:1;const xe=(-Math.abs(be)-le[1])/Q,Pe=($e,Ke,Ue)=>(1-Ue)*$e+Ue*Ke,Ee=a.aA(Pe(1,ce,xe),ce,1);return Pe(1,Ee,a.aA((d.pitch-20)/20,0,1))}class CP{}class Om{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,p,b){{const ce=this._storage.get(p.id);if(ce)return ce.lastUsedFrameIdx=d,ce.buf}const M=b.gl,L=M.getBufferParameter(M.ELEMENT_ARRAY_BUFFER,M.BUFFER_SIZE),O=new ArrayBuffer(L),z=new Int16Array(O);M.getBufferSubData(M.ELEMENT_ARRAY_BUFFER,0,new Int16Array(O));const V=new a.eJ;for(let ce=0;ce30&&(b.buf.destroy(),this._storage.delete(p))}destroy(){for(const[d,p]of this._storage)p.buf.destroy(),this._storage.delete(d)}}class Ty{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Ay=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class xp{constructor(d){this.revealStart=11,this.revealRange=2}}const l3=a.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class c3{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,p){const b=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const O=new a.eK,z=new a.b0;O.emplaceBack(-1,-1),O.emplaceBack(1,-1),O.emplaceBack(1,1),O.emplaceBack(-1,1),z.emplaceBack(0,1,2),z.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(O,l3.members),this.vignetteIdx=d.context.createIndexBuffer(z)}const M=a.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,b);const O={u_vignetteShape:(L={vignetteShape:[p.start,p.range,Math.pow(10,p.fadePower)],vignetteColor:[p.color.r,p.color.g,p.color.b,p.color.a*p.strength]}).vignetteShape,u_vignetteColor:L.vignetteColor};b.draw(d,d.context.gl.TRIANGLES,cn.disabled,zn.disabled,ns.alphaBlended,Fn.disabled,O,"vignette",this.vignetteVx,this.vignetteIdx,M)}var L}}class d3{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,p){const b=d.getFreeCameraOptions().position,M=b.toAltitude(),L=b.toLngLat(),O=a.an(L.lng),z=a.an(L.lat),V=d.pixelsPerMeter/p,Y=O*a.eM,Q=a.eM*Math.log(Math.tan(Math.PI/4+z/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const ce=-this._offsetYPrev+Q,le=-this._elevationPrev+M;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*V,this._accumulatedOffsetY+=ce*V,this._accumulatedElevation+=le*V,this._offsetXPrev=Y,this._offsetYPrev=Q,this._elevationPrev=M}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Xk(_,d){return[-(_[0]-Math.floor(_[0]/d)*d),-(_[1]-Math.floor(_[1]/d)*d),-(_[2]-Math.floor(_[2]/d)*d)]}function au(_){const d=a.eq(1323123451230),p=[];for(let b=0;b<_;++b){const M=2*d()-1,L=2*d()-1,O=2*d()-1;p.push(a.d5(M,L,O))}return p}function xd(_,d,p,b,M){const L=a.aA((M-p)/(b-p),0,1);return(1-L)*_+L*d}class Yg{constructor(d){this._movement=new d3,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new c3,this._ppmScaleFactor=d}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(d,p){const b=d.transform;this._movement.update(b,this._ppmScaleFactor);const M=b.starsProjMatrix,L=a.c7([]);a.c9(L,L,a.an(90)-b._pitch),a.c8(L,L,-b.angle);const O=a.cc(new Float32Array(16),L),z=a.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),V=a.eg([],z),Y=a.aB([],V,O),Q=Date.now()/1e3;return this._accumulatedTimeFromStart+=(Q-this._prevTime)*p,this._prevTime=Q,{projectionMatrix:M,modelviewMatrix:Y}}}class Qk extends Yg{constructor(d){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new xp("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(d){const p=d.context;if(!this.particlesVx){const b=au(this.particlesCount),M=new a.eN,L=new a.b0;let O=0;const z=a.eq(1323123451230);for(let V=0;Vb)return;const M=xd(0,1,p.revealStart,p.revealStart+p.revealRange,b);if(!this.particlesVx||!this.particlesIdx)return;const L=structuredClone(this._params);let O=[-L.direction.x,L.direction.y,-100];a.aw(O,O);const z=structuredClone(this._vignetteParams);z.strength*=M,L.overrideStyleParameters||(L.intensity=d.style.rain.state.density,L.timeFactor=d.style.rain.state.intensity,L.color=structuredClone(d.style.rain.state.color),O=structuredClone(d.style.rain.state.direction),L.screenThinning.intensity=d.style.rain.state.centerThinning,L.dropletSizeX=d.style.rain.state.dropletSize[0],L.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],L.distortionStrength=100*d.style.rain.state.distortionStrength,z.strength=1,z.color=structuredClone(d.style.rain.state.vignetteColor));const V=this.updateOnRender(d,L.timeFactor),Y=d.context,Q=Y.gl,ce=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new a.T(Y,{width:d.width,height:d.height,data:null},Q.RGBA8)),L.distortionStrength>0&&(Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE),Q.copyTexSubImage2D(Q.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const le=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,le),Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const de=[L.color.r,L.color.g,L.color.b,L.color.a],be=(xe,Pe)=>{const Ee=Xk(this._movement.getPosition(),xe),$e=L.dropletSizeX,Ke=L.dropletSizeX*L.dropletSizeYScale,Ue=d.width/2,mt=d.height/2,ct=xd(0,L.screenThinning.start,0,1,L.screenThinning.intensity),ht=xd(.001,L.screenThinning.range,0,1,L.screenThinning.intensity),ot=xd(0,L.screenThinning.particleOffset,0,1,L.screenThinning.intensity),st=(_t={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Ee,velocityConeAperture:L.velocityConeAperture,velocity:L.velocity,boxSize:xe,rainDropletSize:[$e,Ke],distortionStrength:L.distortionStrength,rainDirection:O,color:de,screenSize:[ce.width,ce.height],thinningCenterPos:[Ue,mt],thinningShape:[ct,ht,Math.pow(10,L.screenThinning.fadePower)],thinningAffectedRatio:L.screenThinning.affectedRatio,thinningParticleOffset:ot,shapeDirectionalPower:L.shapeDirPower,shapeNormalPower:L.shapeNormalPower,mode:Pe?0:1},{u_modelview:Float32Array.from(_t.modelview),u_projection:Float32Array.from(_t.projection),u_time:_t.time,u_cam_pos:_t.camPos,u_texScreen:0,u_velocityConeAperture:_t.velocityConeAperture,u_velocity:_t.velocity,u_boxSize:_t.boxSize,u_rainDropletSize:_t.rainDropletSize,u_distortionStrength:_t.distortionStrength,u_rainDirection:_t.rainDirection,u_color:_t.color,u_screenSize:_t.screenSize,u_thinningCenterPos:_t.thinningCenterPos,u_thinningShape:_t.thinningShape,u_thinningAffectedRatio:_t.thinningAffectedRatio,u_thinningParticleOffset:_t.thinningParticleOffset,u_shapeDirectionalPower:_t.shapeDirectionalPower,u_shapeNormalPower:_t.shapeNormalPower,u_mode:_t.mode});var _t;const It=Math.round(L.intensity*this.particlesCount),Tt=a.bg.simpleSegment(0,0,4*It,2*It);le.draw(d,Q.TRIANGLES,cn.disabled,zn.disabled,ns.alphaBlended,Fn.disabled,st,"rain_particles",this.particlesVx,this.particlesIdx,Tt)};L.distortionStrength>0&&be(L.boxSize,!0),be(L.boxSize,!1),this._vignette.draw(d,z)}}const u3=a.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 h3 extends Yg{constructor(d){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new xp("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(d){const p=d.context;if(!this.particlesVx){const b=au(this.particlesCount),M=new a.eO,L=new a.b0;let O=0;const z=a.eq(1323123451230);for(let V=0;VO)return;const z=xd(0,1,L.revealStart,L.revealStart+L.revealRange,O);M.strength*=z,p.overrideStyleParameters||(p.intensity=d.style.snow.state.density,p.timeFactor=d.style.snow.state.intensity,p.color=structuredClone(d.style.snow.state.color),b=structuredClone(d.style.snow.state.direction),p.screenThinning.intensity=d.style.snow.state.centerThinning,p.billboardSize=2.79*d.style.snow.state.flakeSize,M.strength=1,M.color=structuredClone(d.style.snow.state.vignetteColor));const V=this.updateOnRender(d,p.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,Q=Y.gl,ce=d.transform,le=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,le),((de,be,xe)=>{const Pe=Xk(this._movement.getPosition(),de),Ee=ce.width/2,$e=ce.height/2,Ke=xd(0,xe.screenThinning.start,0,1,xe.screenThinning.intensity),Ue=xd(.001,xe.screenThinning.range,0,1,xe.screenThinning.intensity),mt=xd(0,xe.screenThinning.particleOffset,0,1,xe.screenThinning.intensity),ct=(ht={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Pe,velocityConeAperture:xe.velocityConeAperture,velocity:xe.velocity,horizontalOscillationRadius:xe.horizontalOscillationRadius,horizontalOscillationRate:xe.horizontalOscillationRate,boxSize:de,billboardSize:1*xe.billboardSize,simpleShapeParameters:[xe.shapeFadeStart,xe.shapeFadePower],screenSize:[ce.width,ce.height],thinningCenterPos:[Ee,$e],thinningShape:[Ke,Ue,Math.pow(10,xe.screenThinning.fadePower)],thinningAffectedRatio:xe.screenThinning.affectedRatio,thinningParticleOffset:mt,color:[xe.color.r,xe.color.g,xe.color.b,xe.color.a],direction:b},{u_modelview:Float32Array.from(ht.modelview),u_projection:Float32Array.from(ht.projection),u_time:ht.time,u_cam_pos:ht.camPos,u_velocityConeAperture:ht.velocityConeAperture,u_velocity:ht.velocity,u_horizontalOscillationRadius:ht.horizontalOscillationRadius,u_horizontalOscillationRate:ht.horizontalOscillationRate,u_boxSize:ht.boxSize,u_billboardSize:ht.billboardSize,u_simpleShapeParameters:ht.simpleShapeParameters,u_screenSize:ht.screenSize,u_thinningCenterPos:ht.thinningCenterPos,u_thinningShape:ht.thinningShape,u_thinningAffectedRatio:ht.thinningAffectedRatio,u_thinningParticleOffset:ht.thinningParticleOffset,u_particleColor:ht.color,u_direction:ht.direction});var ht;const ot=Math.round(xe.intensity*this.particlesCount),st=a.bg.simpleSegment(0,0,4*ot,2*ot);this.particlesVx&&this.particlesIdx&&le.draw(d,Q.TRIANGLES,cn.disabled,zn.disabled,ns.alphaBlended,Fn.disabled,ct,"snow_particles",this.particlesVx,this.particlesIdx,st)})(p.boxSize,0,p),this._vignette.draw(d,M)}}const Dm={symbol:function(_,d,p,b,M){if(_.renderPass!=="translucent")return;const L=zn.disabled,O=_.colorModeForRenderPass(),z=p.layout.get("text-variable-anchor"),V=p.layout.get("text-size-scale-range"),Y=a.aA(_.scaleFactor,V[0],V[1]);z&&function(le,de,be,xe,Pe,Ee,$e,Ke){const Ue=de.transform,mt=Pe==="map",ct=Ee==="map";for(const ht of le){const ot=xe.getTile(ht),st=ot.getBucket(be);if(!st||!st.text||!st.text.segments.get().length)continue;const _t=a.bK(st.textSizeData,Ue.zoom,Ke),It=af(ht,st.getProjection(),Ue),Tt=Ue.calculatePixelsToTileUnitsMatrix(ot),Vt=Mc(It,ot.tileID.canonical,ct,mt,Ue,st.getProjection(),Tt),Ht=st.hasIconTextFit()&&st.hasIconData();_t&&Tn(st,mt,ct,$e,Ue,Vt,ht,Math.pow(2,Ue.zoom-ot.tileID.overscaledZ),_t,Ht)}}(b,_,p,d,p.layout.get("text-rotation-alignment"),p.layout.get("text-pitch-alignment"),M,Y);const Q=p.paint.get("icon-opacity").constantOr(1)!==0,ce=p.paint.get("text-opacity").constantOr(1)!==0;p.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(Q||ce)?yv(_,d,p,b,L,O):(Q&&yv(_,d,p,b,L,O,{onlyIcons:!0}),ce&&yv(_,d,p,b,L,O,{onlyText:!0})),d.map.showCollisionBoxes&&(Xr(_,d,p,b,p.paint.get("text-translate"),p.paint.get("text-translate-anchor"),!0),Xr(_,d,p,b,p.paint.get("icon-translate"),p.paint.get("icon-translate-anchor"),!1))},circle:function(_,d,p,b){if(_.renderPass!=="translucent")return;const M=p.paint.get("circle-opacity"),L=p.paint.get("circle-stroke-width"),O=p.paint.get("circle-stroke-opacity"),z=p.layout.get("circle-sort-key").constantOr(1)!==void 0,V=p.paint.get("circle-emissive-strength");if(M.constantOr(1)===0&&(L.constantOr(1)===0||O.constantOr(1)===0))return;const Y=_.context,Q=Y.gl,ce=_.transform,le=!(!_.terrain||!_.terrain.enabled),de=p.layout.get("circle-elevation-reference"),be=_.depthModeForSublayer(0,cn.ReadOnly),xe=new cn(_.context.gl.LEQUAL,cn.ReadOnly,_.depthRangeFor3D),Pe=de==="none"||le?be:xe,Ee=zn.disabled,$e=_.colorModeForDrapableLayerRenderPass(V),Ke=ce.projection.name==="globe",Ue=[a.aF(ce.center.lng),a.aJ(ce.center.lat)],mt=[];for(let ht=0;htht.sortKey-ot.sortKey);const ct={useDepthForOcclusion:ce.depthOcclusionForSymbolsAndCircles};for(const ht of mt){const{programConfiguration:ot,program:st,layoutVertexBuffer:_t,dynamicBuffers:It,indexBuffer:Tt,uniformValues:Vt,tile:Ht}=ht.state,nr=ht.segments;_.terrain&&_.terrain.setupElevationDraw(Ht,st,ct),_.uploadCommonUniforms(Y,st,Ht.tileID.toUnwrapped()),st.draw(_,Q.TRIANGLES,Pe,Ee,$e,Fn.disabled,Vt,p.id,_t,Tt,nr,p.paint,ce.zoom,ot,It)}},heatmap:function(_,d,p,b){if(p.paint.get("heatmap-opacity")!==0)if(_.renderPass==="offscreen"){const M=_.context,L=M.gl,O=zn.disabled,z=new ns([L.ONE,L.ONE,L.ONE,L.ONE],a.ao.transparent,[!0,!0,!0,!0]);(function(de,be,xe,Pe){const Ee=de.gl,$e=be.width*Pe,Ke=be.height*Pe;de.activeTexture.set(Ee.TEXTURE1),de.viewport.set([0,0,$e,Ke]);let Ue=xe.heatmapFbo;if(!Ue||Ue&&(Ue.width!==$e||Ue.height!==Ke)){Ue&&Ue.destroy();const mt=Ee.createTexture();Ee.bindTexture(Ee.TEXTURE_2D,mt),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_WRAP_S,Ee.CLAMP_TO_EDGE),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_WRAP_T,Ee.CLAMP_TO_EDGE),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_MIN_FILTER,Ee.LINEAR),Ee.texParameteri(Ee.TEXTURE_2D,Ee.TEXTURE_MAG_FILTER,Ee.LINEAR),Ue=xe.heatmapFbo=de.createFramebuffer($e,Ke,1,null),function(ct,ht,ot,st,_t,It){const Tt=ct.gl;Tt.texImage2D(Tt.TEXTURE_2D,0,ct.extRenderToTextureHalfFloat?Tt.RGBA16F:Tt.RGBA,_t,It,0,Tt.RGBA,ct.extRenderToTextureHalfFloat?Tt.HALF_FLOAT:Tt.UNSIGNED_BYTE,null),st.colorAttachment0.set(ot)}(de,0,mt,Ue,$e,Ke)}else Ee.bindTexture(Ee.TEXTURE_2D,Ue.colorAttachment0.get()),de.bindFramebuffer.set(Ue.framebuffer)})(M,_,p,_.transform.projection.name==="globe"?.5:.25),M.clear({color:a.ao.transparent});const V=_.transform,Y=V.projection.name==="globe",Q=Y?["PROJECTION_GLOBE_VIEW"]:[],ce=Y?Fn.frontCCW:Fn.disabled,le=[a.aF(V.center.lng),a.aJ(V.center.lat)];for(let de=0;de({u_image:0,u_color_ramp:1,u_opacity:ce.paint.get("heatmap-opacity")}))(0,L),L.id,M.viewportBuffer,M.quadTriangleIndexBuffer,M.viewportSegments,L.paint,M.transform.zoom)}(_,p))},line:function(_,d,p,b){if(_.renderPass!=="translucent")return;const M=p.paint.get("line-opacity"),L=p.paint.get("line-width");if(M.constantOr(1)===0||L.constantOr(1)===0)return;const O=p.paint.get("line-emissive-strength").isConstant(),z=p.paint.get("line-emissive-strength").constantOr(0),V=p.paint.get("line-occlusion-opacity"),Y=p.layout.get("line-elevation-reference"),Q=p.layout.get("line-width-unit")==="meters",ce=Y==="sea",le=!(!_.terrain||!_.terrain.enabled),de=_.context,be=de.gl;if(p.hasElevatedBuckets&&_.transform.projection.name==="globe")return;const xe=p.layout.get("line-cross-slope"),Pe=xe!==void 0,Ee=xe<1,$e=_.colorModeForDrapableLayerRenderPass(O?z:null),Ke=_.terrain&&_.terrain.renderingToTexture,Ue=Ke?1:a.o.devicePixelRatio,mt=p.paint.get("line-dasharray"),ct=mt.constantOr(1),ht=p.layout.get("line-cap"),ot=mt.constantOr(null),st=ht.constantOr(null),_t=p.paint.get("line-pattern"),It=_t.constantOr(1),Tt=p.paint.get("line-pattern-cross-fade"),Vt=_t.constantOr(null),Ht=p.paint.get("line-opacity").constantOr(1);let nr=!It&&Ht!==1||_.depthOcclusion&&V>0&&V<1;const br=p.paint.get("line-gradient"),zt=It?"linePattern":"line",Nt=a.e2(p);let Zt;if(Ke&&_.terrain&&_.terrain.clipOrMaskOverlapStencilType()&&(nr=!1),V!==0&&_.depthOcclusion){const qr=p.paint._values["line-opacity"];qr&&qr.value&&qr.value.kind==="constant"?Zt=qr.value:a.w(`Occlusion opacity for layer ${p.id} is supported only when line-opacity isn't data-driven.`)}L.value.kind!=="constant"&&L.value.isLineProgressConstant===!1&&Nt.push("VARIABLE_LINE_WIDTH"),Ke&&(_.emissiveMode!=="dual-source-blending"||O?_.emissiveMode==="mrt-fallback"&&Nt.push("USE_MRT1"):Nt.push("DUAL_SOURCE_BLENDING"));const qt=(qr,Sr,wr,nn,Jr,Rr)=>{for(const Vr of qr){const jn=d.getTile(Vr);if(It&&!jn.patternsLoaded())continue;const Kn=jn.getBucket(p);if(!Kn||Kn.elevationType!=="none"&&!Jr||Kn.elevationType==="none"&&Jr)continue;_.prepareDrawTile();const Is=[...Sr],ci=_.shadowRenderer,on=Kn.elevationType==="road"&&!!ci&&ci.enabled;let ri=[0,0,0];if(on){const is=_.style.directionalLight,sa=_.style.ambientLight;is&&sa&&(ri=up(_.style,is,sa)),Is.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Hn=Kn.programConfigurations.get(p.id);let pi=!1;if(Vt&&jn.imageAtlas){const is=a.e3.from(Vt),sa=is.getPrimary().scaleSelf(Ue).toString(),Ya=jn.imageAtlas.patternPositions.get(sa),Na=is.getSecondary(),$i=Na?jn.imageAtlas.patternPositions.get(Na.scaleSelf(Ue).toString()):null;pi=!!Ya&&!!$i,Ya&&Hn.setConstantPatternPositions(Ya,$i)}Tt>0&&(pi||Hn.getPatternTransitionVertexBuffer("line-pattern"))&&Is.push("LINE_PATTERN_TRANSITION");const Ai=_.isTileAffectedByFog(Vr),_i=_.getOrCreateProgram(zt,{config:Hn,defines:Is,overrideFog:Ai});if(!It&&ot&&st&&jn.lineAtlas){const is=jn.lineAtlas.getDash(ot,st);is&&Hn.setConstantPatternPositions(is)}on&&ci.setupShadows(jn.tileID.toUnwrapped(),_i,"vector-tile");let[ei,ss]=p.paint.get("line-trim-offset");(st==="round"||st==="square")&&ei!==ss&&(ei===0&&(ei-=1),ss===1&&(ss+=1));const hi=Ke?Vr.projMatrix:null,Ia=Q?1/Kn.tileToMeter/a.ay(jn,1,_.transform.zoom):1,pa=Q?1/Kn.tileToMeter/a.ay(jn,1,Math.floor(_.transform.zoom)):1,mi=It?a.e4(_,jn,p,hi,Ue,Ia,pa,[ei,ss],ri,Tt):a.e5(_,jn,p,hi,Kn.lineClipsArray.length,Ue,Ia,pa,[ei,ss],ri);if(br){const is=Kn.gradients[p.id];let sa=is.texture;if(p.gradientVersion!==is.version){let Ya=256;if(p.stepInterpolant){const Na=d.getSource().maxzoom,$i=Vr.canonical.z===Na?Math.ceil(1<<_.transform.maxZoom-Vr.canonical.z):1;Ya=a.aA(a.e6(Kn.maxLineLength/a.al*1024*$i),256,de.maxTextureSize)}is.gradient=a.e7({expression:p.gradientExpression(),evaluationKey:"lineProgress",resolution:Ya,image:is.gradient||void 0,clips:Kn.lineClipsArray}),is.texture?is.texture.update(is.gradient):is.texture=new a.T(de,is.gradient,be.RGBA8),is.version=p.gradientVersion,sa=is.texture}de.activeTexture.set(be.TEXTURE1),sa.bind(p.stepInterpolant?be.NEAREST:be.LINEAR,be.CLAMP_TO_EDGE)}ct&&(de.activeTexture.set(be.TEXTURE0),jn.lineAtlasTexture&&jn.lineAtlasTexture.bind(be.LINEAR,be.REPEAT),Hn.updatePaintBuffers()),It&&(de.activeTexture.set(be.TEXTURE0),jn.imageAtlasTexture&&jn.imageAtlasTexture.bind(be.LINEAR,be.CLAMP_TO_EDGE),Hn.updatePaintBuffers()),Jr&&!ce&&_.terrain.setupElevationDraw(jn,_i),_.uploadCommonUniforms(de,_i,Vr.toUnwrapped());const Zs=is=>{Zt!=null&&(Zt.value=Ht*V),_i.draw(_,be.TRIANGLES,wr,is,$e,Fn.disabled,mi,p.id,Kn.layoutVertexBuffer,Kn.indexBuffer,Kn.segments,p.paint,_.transform.zoom,Hn,[Kn.layoutVertexBuffer2,Kn.patternVertexBuffer,Kn.zOffsetVertexBuffer]),Zt!=null&&(Zt.value=Ht)};if(nr&&!Jr){const is=_.stencilModeForClipping(Vr).ref;is===0&&Ke&&de.clear({stencil:0});const sa={func:be.EQUAL,mask:255};mi.u_alpha_discard_threshold=.8,Zs(new zn(sa,is,255,be.KEEP,be.KEEP,be.INVERT)),mi.u_alpha_discard_threshold=0,Zs(new zn(sa,is,255,be.KEEP,be.KEEP,be.KEEP))}else mi.u_alpha_discard_threshold=nr&&Jr&&Rr?.8:0,Zs(Jr?nn:_.stencilModeForClipping(Vr))}};let ur=_.depthModeForSublayer(0,cn.ReadOnly);const Ar=new cn(_.depthOcclusion?be.GREATER:be.LEQUAL,cn.ReadOnly,_.depthRangeFor3D);if(p.hasNonElevatedBuckets){const qr=!Ke&&_.terrain;V!==0&&qr?a.w(`Occlusion opacity for layer ${p.id} is supported on terrain only if the layer has line-z-offset enabled.`):qr?a.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${p.id}.`):qt(b,Nt,ur,zn.disabled,!1,!0)}if(p.hasElevatedBuckets){Y==="hd-road-markup"?le||(ur=Ar,Nt.push("ELEVATED_ROADS")):(Nt.push("ELEVATED"),ur=Ar,Pe&&Nt.push(Ee?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),ce&&Nt.push("ELEVATION_REFERENCE_SEA"));const qr=nr?_.stencilModeFor3D():zn.disabled;_.forceTerrainMode=!0,qt(b,Nt,ur,qr,!0,!0),nr&&qt(b,Nt,ur,qr,!0,!1),_.forceTerrainMode=!1}nr&&(_.resetStencilClippingMasks(),Ke&&de.clear({stencil:0})),V===0||_.depthOcclusion||Ke||_.layersWithOcclusionOpacity.push(_.currentLayer)},fill:function(_,d,p,b){const M=p.paint.get("fill-color"),L=p.paint.get("fill-opacity");if(L.constantOr(1)===0)return;const O=p.paint.get("fill-emissive-strength"),z=_.colorModeForDrapableLayerRenderPass(O),V=p.paint.get("fill-pattern"),Y=_.opaquePassEnabledForLayer()&&!V.constantOr(1)&&M.constantOr(a.ao.transparent).a===1&&L.constantOr(0)===1?"opaque":"translucent";let Q="none";p.layout.get("fill-elevation-reference")!=="none"?Q="road":p.paint.get("fill-z-offset").constantOr(1)!==0&&(Q="offset");const ce=!(!_.terrain||!_.terrain.enabled),le={painter:_,sourceCache:d,layer:p,coords:b,colorMode:z,elevationType:Q,terrainEnabled:ce,pass:Y};if(_.renderPass==="shadow")return void(_.shadowRenderer&&Q==="road"&&!ce&&function(be){const{painter:xe,sourceCache:Pe,layer:Ee,coords:$e}=be,Ke=xe.context.gl,Ue=be.painter.shadowRenderer;for(const mt of $e){const ct=Pe.getTile(mt),ht=ct.getBucket(Ee);if(!ht)continue;const ot=ht.elevatedStructures;if(!ot||!ot.shadowCasterSegments||ot.shadowCasterSegments.segments[0].primitiveLength===0)continue;xe.prepareDrawTile();const st=ht.bufferData.programConfigurations.get(Ee.id),_t=xe.isTileAffectedByFog(mt),It=xe.getOrCreateProgram("elevatedStructuresDepth",{config:st,overrideFog:_t}),Tt=Ue.calculateShadowPassMatrixFromTile(ct.tileID.toUnwrapped());xe.uploadCommonUniforms(xe.context,It,mt.toUnwrapped());const Vt={u_matrix:Tt,u_depth_bias:0};It.draw(xe,Ke.TRIANGLES,Ue.getShadowPassDepthMode(),zn.disabled,Ue.getShadowPassColorMode(),Fn.disabled,Vt,Ee.id,ot.vertexBuffer,ot.indexBuffer,ot.shadowCasterSegments,Ee.paint,xe.transform.zoom,st)}}(le));const de=_.emissiveMode==="mrt-fallback";if(Q!=="offset"){if(Bk(le,!1,de),Q==="road"){const be=!ce&&_.renderPass==="translucent";be&&zk(_,d,p,b,"geometry"),Bk(le,!0,de,zn.disabled),be&&function(xe){const{painter:Pe,sourceCache:Ee,layer:$e,coords:Ke,colorMode:Ue}=xe,mt=Pe.context.gl,ct=xe.painter.shadowRenderer,ht=!!ct&&ct.enabled,ot=new cn(Pe.context.gl.LEQUAL,cn.ReadOnly,Pe.depthRangeFor3D);let st=[0,0,0];if(ht){const It=Pe.style.directionalLight,Tt=Pe.style.ambientLight;It&&Tt&&(st=up(Pe.style,It,Tt))}const _t=It=>{for(const Tt of Ke){const Vt=Ee.getTile(Tt),Ht=Vt.getBucket($e);if(!Ht)continue;const nr=Ht.elevatedStructures;if(!nr)continue;let br,zt;if(It?(br=nr.renderableBridgeSegments,zt=nr.bridgeProgramConfigurations.get($e.id)):(br=nr.renderableTunnelSegments,zt=nr.tunnelProgramConfigurations.get($e.id)),!br||br.segments[0].primitiveLength===0)continue;zt.updatePaintBuffers(),Pe.prepareDrawTile();const Nt=Pe.isTileAffectedByFog(Tt),Zt=[];ht&&Zt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const qt=Pe.getOrCreateProgram("elevatedStructures",{config:zt,overrideFog:Nt,defines:Zt}),ur=Pe.translatePosMatrix(Tt.projMatrix,Vt,$e.paint.get("fill-translate"),$e.paint.get("fill-translate-anchor"));ht&&ct.setupShadows(Vt.tileID.toUnwrapped(),qt,"vector-tile");const Ar=Em(ur,st);Pe.uploadCommonUniforms(Pe.context,qt,Tt.toUnwrapped()),qt.draw(Pe,mt.TRIANGLES,ot,zn.disabled,Ue,Fn.backCCW,Ar,$e.id,nr.vertexBuffer,nr.indexBuffer,br,$e.paint,Pe.transform.zoom,zt,[nr.vertexBufferNormal])}};_t(!0),_t(!1)}(le)}}else Bk(le,!1,de,_.stencilModeFor3D())},"fill-extrusion":function(_,d,p,b){const M=p.paint.get("fill-extrusion-opacity"),L=_.context,O=L.gl,z=_.terrain,V=z&&z.renderingToTexture;if(M===0)return;const Y=_.emissiveMode==="mrt-fallback",Q=_.conflationActive&&_.style.isLayerClipped(p,d.getSource()),ce=_.style.order.indexOf(p.fqid);if(Q&&function(le,de,be,xe,Pe){for(const Ee of xe){const $e=de.getTile(Ee).getBucket(be);$e&&($e.updateReplacement(Ee,le.replacementSource,Pe),$e.uploadCentroid(le.context))}}(_,d,p,b,ce),z||Q)for(const le of b){const de=d.getTile(le).getBucket(p);de&&Jie(_.context,d,le,de,p,z,Q)}if(_.renderPass==="shadow"&&_.shadowRenderer){const le=_.shadowRenderer;if(z&&M<.65&&p._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.ad)return;const de=le.getShadowPassDepthMode(),be=le.getShadowPassColorMode();$k(_,d,p,b,de,zn.disabled,be,Q)}else if(_.renderPass==="translucent"){const le=!p.paint.get("fill-extrusion-pattern").constantOr(1),de=p.paint.get("fill-extrusion-color").constantOr(a.ao.white);if(!V&&de.a!==0){const be=new cn(_.context.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D);M===1&&le?$k(_,d,p,b,be,zn.disabled,ns.unblended,Q):($k(_,d,p,b,be,zn.disabled,ns.disabled,Q),$k(_,d,p,b,be,_.stencilModeFor3D(),_.colorModeForRenderPass(),Q),_.resetStencilClippingMasks())}if(_.style.enable3dLights()&&le&&(!z&&_.transform.projection.name!=="globe"||V)){const be=p.paint.get("fill-extrusion-opacity"),xe=p.paint.get("fill-extrusion-ambient-occlusion-intensity"),Pe=p.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Ee=p.paint.get("fill-extrusion-flood-light-intensity"),$e=p.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ke=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor($e?null:p.lut).toArray01().slice(0,3),Ue=xe>0&&Pe>0,mt=Ee>0,ct=(st,_t,It)=>(1-It)*st+It*_t,ht=new i3;ht.translate=p.paint.get("fill-extrusion-translate"),ht.translateAnchor=p.paint.get("fill-extrusion-translate-anchor"),ht.edgeRadius=p.layout.get("fill-extrusion-edge-radius"),ht.cutoffFadeRange=p.paint.get("fill-extrusion-cutoff-fade-range");const ot=st=>{const _t=_.depthModeForSublayer(1,cn.ReadOnly,O.LEQUAL,!0),It=p.paint.get(st?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Tt=ct(.1,3,It),Vt=_._showOverdrawInspector;if(!Vt){const Ht=new zn({func:O.ALWAYS,mask:255},255,255,O.KEEP,O.KEEP,O.REPLACE),nr=new ns([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!1,!1,!1,!0],O.MIN);pp(ht,_,d,p,b,_t,Ht,nr,Fn.disabled,st,"sdf",be,xe,Pe,Ee,Ke,Tt,Q,!1)}{const Ht=Vt?zn.disabled:new zn({func:O.EQUAL,mask:255},255,255,O.KEEP,O.DECR,O.DECR),nr=Vt?_.colorModeForRenderPass():new ns([O.ONE_MINUS_DST_ALPHA,O.DST_ALPHA,O.ONE,O.ONE],a.ao.transparent,[!0,!0,!0,!0]);pp(ht,_,d,p,b,_t,Ht,nr,Fn.disabled,st,"color",be,xe,Pe,Ee,Ke,Tt,Q,!1)}};if(V){const st=()=>{const It=z.drapeBufferSize[0],Tt=z.drapeBufferSize[1];let Vt=z.framebufferCopyTexture;return Vt&&(!Vt||Vt.size[0]===It&&Vt.size[1]===Tt)||(Vt&&Vt.destroy(),Vt=z.framebufferCopyTexture=new a.T(L,new a.q({width:It,height:Tt}),O.RGBA8)),Vt.bind(O.LINEAR,O.CLAMP_TO_EDGE),O.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,0,0,It,Tt),Vt},_t=(It,Tt,Vt)=>{const Ht=_.depthModeForSublayer(1,cn.ReadOnly,O.LEQUAL,!1),nr=p.paint.get(It?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),br=ct(.1,3,nr);{const zt=new ns([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!1,!1,!1,!0]);pp(ht,_,d,p,b,Ht,zn.disabled,zt,Fn.disabled,It,"clear",be,xe,Pe,Ee,Ke,br,Q,Tt)}{const zt=new zn({func:O.ALWAYS,mask:255},255,255,O.KEEP,O.KEEP,O.REPLACE),Nt=new ns([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!1,!1,!1,!0],O.MIN);pp(ht,_,d,p,b,Ht,zt,Nt,Fn.disabled,It,"sdf",be,xe,Pe,Ee,Ke,br,Q,Tt)}Y&&!It&&(Vt=st());{const zt=It?O.ZERO:O.ONE_MINUS_DST_ALPHA,Nt=new zn({func:O.EQUAL,mask:255},255,255,O.KEEP,O.DECR,O.DECR),Zt=new ns([zt,O.DST_ALPHA,O.ONE_MINUS_DST_ALPHA,O.ZERO],a.ao.transparent,[!0,!0,!0,!0]);pp(ht,_,d,p,b,Ht,Nt,Zt,Fn.disabled,It,"color",be,xe,Pe,Ee,Ke,br,Q,Tt)}if(!Y||It){const zt=new ns([O.ONE,O.ONE,O.ONE,It?O.ZERO:O.ONE],a.ao.transparent,[!1,!1,!1,!0],It?O.FUNC_ADD:O.MAX);pp(ht,_,d,p,b,Ht,zn.disabled,zt,Fn.disabled,It,"clear",be,xe,Pe,Ee,Ke,br,Q,Tt,Vt)}else{O.drawBuffers([O.NONE,O.COLOR_ATTACHMENT1]);const zt=new zn({func:O.EQUAL,mask:255},254,255,O.KEEP,O.DECR,O.DECR),Nt=new ns([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!0,!1,!1,!1],O.MAX);pp(ht,_,d,p,b,Ht,zt,Nt,Fn.disabled,It,"emissive",be,xe,Pe,Ee,Ke,br,Q,Tt,Vt),O.drawBuffers([O.COLOR_ATTACHMENT0])}};if(Ue||mt){let It;_.prepareDrawTile(),Y&&!Ue||(It=st()),Ue&&_t(!0,!1,It),mt&&_t(!1,!0,It)}}else Ue&&ot(!0),mt&&ot(!1),(Ue||mt)&&_.resetStencilClippingMasks()}}},building:function(_,d,p,b){_.currentLayer<_.firstLightBeamLayer&&(_.firstLightBeamLayer=_.currentLayer);const M=p.paint.get("building-ambient-occlusion-ground-intensity"),L=p.paint.get("building-ambient-occlusion-ground-radius"),O=p.paint.get("building-ambient-occlusion-ground-attenuation"),z=p.paint.get("building-opacity");if(z<=0)return;let V=M>0&&L>0,Y=!0;const Q=p.paint.get("building-vertical-scale");if(Q<=0)return;_.shadowRenderer||(Y=!1);const ce=_.conflationActive&&_.style.isLayerClipped(p,d.getSource()),le=_.style.order.indexOf(p.fqid);if(function(de,be,xe,Pe,Ee,$e){for(const Ke of $e){const Ue=be.getTile(Ke).getBucket(xe);Ue&&(Ee&&Ue.updateReplacement(Ke,de.replacementSource,Pe),Ue.uploadUpdatedIndexBuffer(de.context))}}(_,d,p,le,ce,b),function(de,be,xe,Pe){for(const Ee of Pe){const $e=be.getTile(Ee).getBucket(xe);$e&&$e.needsEvaluation()&&$e.uploadUpdatedColorBuffer(de.context)}}(_,d,p,b),p.resetLayerRenderingStats(_),_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0),_.renderPass==="shadow"&&_.shadowRenderer){const de=_.shadowRenderer,be=[],xe=de.getShadowPassDepthMode();vv({painter:_,source:d,layer:p,coords:b,defines:be,blendMode:de.getShadowPassColorMode(),depthMode:xe,opacity:z,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(_.renderPass==="translucent"){let de=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(de=de.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),_.shadowRenderer&&_.shadowRenderer.useNormalOffset&&(de=de.concat("NORMAL_OFFSET"));const be=p.paint.get("building-facade-emissive-chance"),xe=p.paint.get("building-ambient-occlusion-intensity"),Pe=p.paint.get("building-flood-light-intensity"),Ee=p.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",$e=p.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Ee?null:p.lut).toArray01().slice(0,3),Ke=p.paint.get("building-flood-light-ground-attenuation"),Ue=Pe>0,mt=new cn(_.context.gl.LEQUAL,cn.ReadWrite,_.depthRangeFor3D);z<1&&vv({painter:_,source:d,layer:p,coords:b,defines:de,blendMode:ns.disabled,depthMode:mt,opacity:z,verticalScale:Q,facadeEmissiveChance:be,facadeAOIntensity:xe,floodLightIntensity:Pe,floodLightColor:$e,depthOnly:!0});const ct=_.colorModeForRenderPass();vv({painter:_,source:d,layer:p,coords:b,defines:de,blendMode:ct,depthMode:mt,opacity:z,verticalScale:Q,facadeEmissiveChance:be,facadeAOIntensity:xe,floodLightIntensity:Pe,floodLightColor:$e}),V&&Uk(_,d,p,b,!0,z,M,L,Pe,$e,O,ce),Ue&&Uk(_,d,p,b,!1,z,M,L,Pe,$e,Ke,ce)}else if(_.renderPass==="light-beam"){const de=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],be=new cn(_.context.gl.LEQUAL,cn.ReadOnly,_.depthRangeFor3D);vv({painter:_,source:d,layer:p,coords:b,defines:de,blendMode:ns.alphaBlended,depthMode:be,opacity:z,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1),_.resetStencilClippingMasks()},hillshade:function(_,d,p,b){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent"||_.style.disableElevatedTerrain)return;const M=_.context,L=_.terrain&&_.terrain.renderingToTexture,[O,z]=_.renderPass!=="translucent"||L?[{},b]:_.stencilConfigForOverlap(b);for(const V of z){const Y=d.getTile(V);if(Y.needsHillshadePrepare&&_.renderPass==="offscreen")qie(_,Y,p);else if(_.renderPass==="translucent"){const Q=_.depthModeForSublayer(0,cn.ReadOnly),ce=p.paint.get("hillshade-emissive-strength"),le=_.colorModeForDrapableLayerRenderPass(ce),de=L&&_.terrain?_.terrain.stencilModeForRTTOverlap(V):O[V.overscaledZ];Uie(_,V,Y,p,Q,de,le)}}M.viewport.set([0,0,_.width,_.height]),_.resetStencilClippingMasks()},raster:function(_,d,p,b,M,L){if(_.renderPass!=="translucent"||p.paint.get("raster-opacity")===0)return;const O=_.transform.projection.name==="globe",z=p.paint.get("raster-elevation")!==0,V=z&&O;if(_.renderElevatedRasterBackface&&!V)return;const Y=_.context,Q=Y.gl,ce=d.getSource(),le=function(ct,ht,ot,st,_t){const It=ht.paint.get("raster-color"),Tt=ct.type==="raster-array",Vt=[],Ht=ht.paint.get("raster-resampling"),nr=ht.paint.get("raster-color-mix");let br=ht.paint.get("raster-color-range");const zt=[nr[0],nr[1],nr[2],0],Nt=nr[3];let Zt=Ht==="nearest"?st.NEAREST:st.LINEAR;if(Tt&&(Vt.push("RASTER_ARRAY"),It||Vt.push("RASTER_COLOR"),Ht==="linear"&&Vt.push("RASTER_ARRAY_LINEAR"),Zt=st.NEAREST,!br&&ct.rasterLayers)){const qt=ct.rasterLayers.find(({id:ur})=>ur===ht.sourceLayer);qt&&qt.fields&&qt.fields.range&&(br=qt.fields.range)}if(br=br||[0,1],It){Vt.push("RASTER_COLOR"),ot.activeTexture.set(st.TEXTURE2),ht.updateColorRamp(br);let qt=ht.colorRampTexture;qt||(qt=ht.colorRampTexture=new a.T(ot,ht.colorRamp,st.RGBA8)),qt.bind(st.LINEAR,st.CLAMP_TO_EDGE)}return _t&&Vt.push("USE_MRT1"),{mix:zt,range:br,offset:Nt,defines:Vt,resampling:Zt}}(ce,p,Y,Q,_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback");if(ce instanceof a.aU&&!b.length&&!O)return;const de=p.paint.get("raster-emissive-strength"),be=_.colorModeForDrapableLayerRenderPass(de),xe=_.terrain&&_.terrain.renderingToTexture,Pe=!_.options.moving,Ee=p.paint.get("raster-resampling")==="nearest"?Q.NEAREST:Q.LINEAR;if(ce instanceof a.aU&&!b.length&&(ce.onNorthPole||ce.onSouthPole)){const ct=z?_.stencilModeFor3D():zn.disabled;return void _v(!!ce.onNorthPole,null,_,d,p,de,le,Fn.disabled,ct)}if(!b.length)return;const[$e,Ke]=ce instanceof a.aU||xe?[{},b]:_.stencilConfigForOverlap(b),Ue=Ke[Ke.length-1].overscaledZ;V&&le.defines.push("PROJECTION_GLOBE_VIEW"),z&&le.defines.push("RENDER_CUTOFF");const mt=(ct,ht,ot)=>{for(const st of ct){const _t=st.toUnwrapped(),It=d.getTile(st);if(xe&&(!It||!It.hasData()))continue;Y.activeTexture.set(Q.TEXTURE0);const Tt=gp(It,ce,p,le);if(!Tt||!Tt.texture)continue;const{texture:Vt,mix:Ht,offset:nr,tileSize:br,buffer:zt}=Tt;let Nt,Zt;xe?(Nt=cn.disabled,Zt=st.projMatrix):z?(Nt=new cn(Q.LEQUAL,cn.ReadWrite,_.depthRangeFor3D),Zt=O?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(_t,Pe)):(Nt=_.depthModeForSublayer(st.overscaledZ-Ue,p.paint.get("raster-opacity")===1?cn.ReadWrite:cn.ReadOnly,Q.LESS),Zt=_.transform.calculateProjMatrix(_t,Pe));const qt=_.terrain&&xe?_.terrain.stencilModeForRTTOverlap(st):$e[st.overscaledZ],ur=L?0:p.paint.get("raster-fade-duration");It.registerFadeDuration(ur);const Ar=d.findLoadedParent(st,0),qr=pv(It,Ar,d,_.transform,ur);let Sr,wr;!qr.isFading&&It.refreshedUponExpiration&&(It.refreshedUponExpiration=!1),_.terrain&&_.terrain.prepareDrawTile(),Y.activeTexture.set(Q.TEXTURE0),Vt.bind(Ee,Q.CLAMP_TO_EDGE),Y.activeTexture.set(Q.TEXTURE1),Ar?(Ar.texture&&Ar.texture.bind(Ee,Q.CLAMP_TO_EDGE),Sr=Math.pow(2,Ar.tileID.overscaledZ-It.tileID.overscaledZ),wr=[It.tileID.canonical.x*Sr%1,It.tileID.canonical.y*Sr%1]):Vt.bind(Ee,Q.CLAMP_TO_EDGE),"useMipmap"in Vt&&Y.extTextureFilterAnisotropic&&_.transform.pitch>20&&Q.texParameterf(Q.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const nn=_.transform;let Jr;const Rr=z?pP(nn):[0,0,0,0];let Vr,jn,Kn,Is,ci,on=0;if(V&&ce instanceof a.aU&&ce.coordinates.length>3)Vr=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0)))),jn=Float32Array.from(nn.globeMatrix),Kn=Float32Array.from(a.dF(nn)),Is=[a.aF(nn.center.lng),a.aJ(nn.center.lat)],Jr=ce.elevatedGlobePerspectiveTransform,ci=ce.elevatedGlobeGridMatrix||new Float32Array(9);else if(V){const Ai=a.dG(st.canonical);on=a.dH(Ai.getCenter().lat),Vr=Float32Array.from(a.bk(a.dJ(st.canonical))),jn=Float32Array.from(nn.globeMatrix),Kn=Float32Array.from(a.dF(nn)),Is=[a.aF(nn.center.lng),a.aJ(nn.center.lat)],Jr=[0,0],ci=Float32Array.from(a.dI(st.canonical,Ai,on,nn.worldSize/nn._pixelsPerMercatorPixel))}else Jr=ce instanceof a.aU?ce.perspectiveTransform:[0,0],Vr=new Float32Array(16),jn=new Float32Array(9),Kn=new Float32Array(16),Is=[0,0],ci=new Float32Array(9);const ri=oP(Zt,Vr,jn,Kn,ci,wr||[0,0],a.aj(_.transform.zoom),Is,Rr,Sr||1,qr,p,Jr,z?p.paint.get("raster-elevation"):0,2,Ht,nr,le.range,br,zt,de),Hn=_.isTileAffectedByFog(st),pi=_.getOrCreateProgram("raster",{defines:le.defines,overrideFog:Hn});if(_.uploadCommonUniforms(Y,pi,_t),ce instanceof a.aU){const Ai=ce.elevatedGlobeVertexBuffer,_i=ce.elevatedGlobeIndexBuffer;if(xe||!O)ce.boundsBuffer&&ce.boundsSegments&&pi.draw(_,Q.TRIANGLES,Nt,zn.disabled,be,Fn.disabled,ri,p.id,ce.boundsBuffer,_.quadTriangleIndexBuffer,ce.boundsSegments);else if(Ai&&_i){const ei=nn.zoom<=a.c_?ce.elevatedGlobeSegments:ce.getSegmentsForLongitude(nn.center.lng);ei&&pi.draw(_,Q.TRIANGLES,Nt,zn.disabled,be,ht,ri,p.id,Ai,_i,ei)}}else if(V){Nt=new cn(Q.LEQUAL,cn.ReadOnly,_.depthRangeFor3D);const Ai=_.globeSharedBuffers;if(Ai){const[_i,ei,ss]=Ai.getGridBuffers(on,!1);pi.draw(_,Q.TRIANGLES,Nt,ot||qt,_.colorModeForRenderPass(),ht,ri,p.id,_i,ei,ss)}}else{const{tileBoundsBuffer:Ai,tileBoundsIndexBuffer:_i,tileBoundsSegments:ei}=_.getTileBoundsBuffers(It);pi.draw(_,Q.TRIANGLES,Nt,qt,be,Fn.disabled,ri,p.id,Ai,_i,ei)}}if(!(ce instanceof a.aU)&&V)for(const st of ct){const _t=st.canonical.y===(1<>>16,2654435769),((st=Math.imul(st^st>>>16,2654435769))>>>0)/4294967296},ot=1/1.1;for(let st=0;sta.e9[qt](Vt));zt.push(Vt);const Nt=Vt.canonical.x,Zt=Vt.canonical.y;for(const qt of zt){const ur=Ue.getTile(_t?qt.wrapped():qt);if(!ur)continue;const Ar=ur.rasterParticleState;if(!Ar)continue;const qr=qt.canonical.x+(1<ht.tileID)),de&&(Y.activeTexture.set(Q.TEXTURE0),_.imageManager.bind(_.context,p.scope));const ct=[];if(_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ct.push("USE_MRT1"),V){const ht=_.getOrCreateProgram(Ke,{overrideFog:!1,overrideRtt:!0,defines:ct}),ot=new Float32Array(a.bA([])),st=new a.aQ(0,0,0,0,0),_t=de?Pm(ot,z,O,_,0,p.scope,be,V,{tileID:st,tileSize:le}):gv(ot,z,O,M.toPremultipliedRenderColor(L?null:p.lut));ht.draw(_,Q.TRIANGLES,Ee,Pe,$e,Fn.disabled,_t,p.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments)}else for(const ht of mt){const ot=_.isTileAffectedByFog(ht),st=_.getOrCreateProgram(Ke,{overrideFog:ot,defines:ct}),_t=ht.toUnwrapped(),It=b?ht.projMatrix:_.transform.calculateProjMatrix(_t);_.prepareDrawTile();const Tt=d?d.getTile(ht):Ue?Ue[ht.key]:new ap(ht,le,ce.zoom,_),Vt=de?Pm(It,z,O,_,0,p.scope,be,V,{tileID:ht,tileSize:le}):gv(It,z,O,M.toPremultipliedRenderColor(L?null:p.lut));_.uploadCommonUniforms(Y,st,_t);const{tileBoundsBuffer:Ht,tileBoundsIndexBuffer:nr,tileBoundsSegments:br}=_.getTileBoundsBuffers(Tt);st.draw(_,Q.TRIANGLES,Ee,Pe,$e,Fn.disabled,Vt,p.id,Ht,nr,br)}},sky:function(_,d,p){const b=_._atmosphere?a.aj(_.transform.zoom):1,M=p.paint.get("sky-opacity")*b;if(M===0)return;const L=_.context,O=p.paint.get("sky-type"),z=new cn(L.gl.LEQUAL,cn.ReadOnly,[0,1]),V=_.frameCounter/1e3%1;O==="atmosphere"?_.renderPass==="offscreen"?p.needsSkyboxCapture(_)&&(function(Y,Q,ce,le){const de=Y.context,be=de.gl;let xe=Q.skyboxFbo;if(!xe){xe=Q.skyboxFbo=de.createFramebuffer(32,32,1,null),Q.skyboxGeometry=new Wk(de),Q.skyboxTexture=de.gl.createTexture(),be.bindTexture(be.TEXTURE_CUBE_MAP,Q.skyboxTexture),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_WRAP_S,be.CLAMP_TO_EDGE),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_WRAP_T,be.CLAMP_TO_EDGE),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_MIN_FILTER,be.LINEAR),be.texParameteri(be.TEXTURE_CUBE_MAP,be.TEXTURE_MAG_FILTER,be.LINEAR);for(let Ke=0;Ke<6;++Ke)be.texImage2D(be.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,0,be.RGBA,32,32,0,be.RGBA,be.UNSIGNED_BYTE,null)}de.bindFramebuffer.set(xe.framebuffer),de.viewport.set([0,0,32,32]);const Pe=Q.getCenter(Y,!0),Ee=Y.getOrCreateProgram("skyboxCapture"),$e=new Float64Array(16);a.bA($e),a.en($e,$e,.5*-Math.PI),Kg(Y,Q,Ee,$e,Pe,0),a.bA($e),a.en($e,$e,.5*Math.PI),Kg(Y,Q,Ee,$e,Pe,1),a.bA($e),a.cU($e,$e,.5*-Math.PI),Kg(Y,Q,Ee,$e,Pe,2),a.bA($e),a.cU($e,$e,.5*Math.PI),Kg(Y,Q,Ee,$e,Pe,3),a.bA($e),Kg(Y,Q,Ee,$e,Pe,4),a.bA($e),a.en($e,$e,Math.PI),Kg(Y,Q,Ee,$e,Pe,5),de.viewport.set([0,0,Y.width,Y.height])}(_,p),p.markSkyboxValid(_)):_.renderPass==="sky"&&function(Y,Q,ce,le,de){const be=Y.context,xe=be.gl,Pe=Y.transform,Ee=Y.getOrCreateProgram("skybox");be.activeTexture.set(xe.TEXTURE0),xe.bindTexture(xe.TEXTURE_CUBE_MAP,Q.skyboxTexture);const $e=((Ke,Ue,mt,ct,ht)=>({u_matrix:Ke,u_sun_direction:Ue,u_cubemap:0,u_opacity:ct,u_temporal_offset:ht}))(Pe.skyboxMatrix,Q.getCenter(Y,!1),0,le,de);Y.uploadCommonUniforms(be,Ee),Ee.draw(Y,xe.TRIANGLES,ce,zn.disabled,Y.colorModeForRenderPass(),Fn.backCW,$e,"skybox",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,p,z,M,V):O==="gradient"&&_.renderPass==="sky"&&function(Y,Q,ce,le,de){const be=Y.context,xe=be.gl,Pe=Y.transform,Ee=Y.getOrCreateProgram("skyboxGradient");Q.skyboxGeometry||(Q.skyboxGeometry=new Wk(be)),be.activeTexture.set(xe.TEXTURE0);let $e=Q.colorRampTexture;$e||($e=Q.colorRampTexture=new a.T(be,Q.colorRamp,xe.RGBA8)),$e.bind(xe.LINEAR,xe.CLAMP_TO_EDGE);const Ke=((Ue,mt,ct,ht,ot)=>({u_matrix:Ue,u_color_ramp:0,u_center_direction:mt,u_radius:a.an(ct),u_opacity:ht,u_temporal_offset:ot}))(Pe.skyboxMatrix,Q.getCenter(Y,!1),Q.paint.get("sky-gradient-radius"),le,de);Y.uploadCommonUniforms(be,Ee),Ee.draw(Y,xe.TRIANGLES,ce,zn.disabled,Y.colorModeForRenderPass(),Fn.backCW,Ke,"skyboxGradient",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,p,z,M,V)},custom:function(_,d,p,b){const M=_.context,L=p.implementation;if(!_.transform.projection.unsupportedLayers||!_.transform.projection.unsupportedLayers.includes("custom")||_.terrain&&(_.terrain.renderingToTexture||_.renderPass==="offscreen")&&p.isDraped(d)){if(_.renderPass==="offscreen"){const O=L.prerender;if(O){if(_.setCustomLayerDefaults(),M.setColorMode(_.colorModeForRenderPass()),_.transform.projection.name==="globe"){const z=_.transform.pointMerc;O.call(L,M.gl,_.transform.customLayerMatrix(),_.transform.getProjection(),_.transform.globeToMercatorMatrix(),a.aj(_.transform.zoom),[z.x,z.y],_.transform.pixelsPerMeterRatio)}else O.call(L,M.gl,_.transform.customLayerMatrix());M.setDirty(),_.setBaseState()}}else if(_.renderPass==="translucent"){if(_.terrain&&_.terrain.renderingToTexture){const z=L.renderToTile;if(z){const V=b[0].canonical,Y={x:V.x+b[0].wrap*(L.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,Q||(Y.enabled=!0))},le=d.getSource();if(_.renderPass==="light-beam"&&le.type!=="batched-model")return;if(le.type==="vector"||le.type==="geojson")return function(Ue,mt,ct,ht,ot){const st=Ue.transform,_t=st.projection.name==="globe",It=st.getFreeCameraOptions().position;if(!Ue.modelManager)return;const Tt=Ue.modelManager;ct.modelManager=Tt;const Vt=Ue.shadowRenderer;if(!ct._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Ht=ct._unevaluatedLayout._values["model-id"],nr=Object.assign({},ct.layout.get("model-id").parameters),br=Ue.style.order.indexOf(ct.fqid),zt=ct.paint.get("model-opacity").constantOr(1);for(const Nt of ht){const Zt=mt.getTile(Nt).getBucket(ct);if(!Zt||Zt.projection.name!==st.projection.name)continue;const qt=Zt.getModelUris();if(qt&&!Zt.modelsRequested&&(Tt.addModelsFromBucket(qt,ot),Zt.modelsRequested=!0),_t)nr.zoom=Nt.overscaledZ;else{const Rr=Zc(Nt,st);nr.zoom=Rr}const ur=Ht.possiblyEvaluate(nr);if(NP(Ue,Zt,Nt),ff.shadowUniformsInitialized=!1,ff.useSingleShadowCascade=!!Vt&&Vt.getMaxCascadeForTile(Nt.toUnwrapped())===0,Ue.renderPass==="shadow"&&Vt){if(Ue.currentShadowCascade===1&&Zt.isInsideFirstShadowMapFrustum)continue;const Rr=st.calculatePosMatrix(Nt.toUnwrapped(),st.worldSize);if(ff.tileMatrix.set(Rr),ff.shadowTileMatrix=Float32Array.from(Vt.calculateShadowPassMatrixFromMatrix(Rr)),ff.aabb.min=[0,0,0],ff.aabb.max[0]=ff.aabb.max[1]=a.al,ff.aabb.max[2]=0,rae(Zt,ff,Ue,ct.scope))continue}const Ar=1<0&&Ue.style.isLayerClipped(ct,mt.getSource())&&Zt.updateReplacement(Nt,Ue.replacementSource,br,ct.scope)&&(Zt.uploaded=!1,Zt.upload(Ue.context));let Sr=0;const wr=new Array,nn=new Array,Jr=new Array;for(let Rr in Zt.instancesPerModel){const Vr=Zt.instancesPerModel[Rr];Vr.features.length>0&&!_t&&(Rr=ur.evaluate(Vr.features[0].feature,{}));const jn=Tt.getModel(Rr,ot);if(jn||Tt.hasURLBeenRequested(Rr)||Zt.modelUris.includes(Rr)||(Zt.modelUris.push(Rr),Zt.modelsRequested=!1),jn&&jn.uploaded)if(_t){const Kn=a.c5([],[It.x,It.y,It.z],Ue.transform.worldSize);a.ew(Kn,Kn);for(let Is=0;Is0&&ri.elevationUpdate(Rr.terrain,Is,on,jn.source),ri.needsReEvaluation(Rr,ci,jn)&&ri.evaluate(jn))}})(Ue,mt,ct,ht),function(){let Rr,Vr,jn;wr?(Rr=ht.length-1,Vr=-1,jn=-1):(Rr=0,Vr=ht.length,jn=1);const Kn=new Float64Array(16),Is=a.cA(),ci=new a.P(0,0);for(let on=Rr;on!==Vr;on+=jn){const ri=ht[on],Hn=mt.getTile(ri).getBucket(ct);if(!Hn||!Hn.uploaded)continue;let pi=!1;It&&(pi=It.getMaxCascadeForTile(ri.toUnwrapped())===0);const Ai=st.calculatePosMatrix(ri.toUnwrapped(),st.worldSize),_i=Hn.modelTraits;!Ar&&wr&&(a.bl(Kn,Ai),a.af(Is,Vt,Kn),ci.x=Is[0],ci.y=Is[1]);const ei=[];Hn.setFilter(ct.filter);for(const ss of Hn.getNodesInfo()){if(ss.hiddenByReplacement||!ss.node.meshes)continue;const hi=ss.node;let Ia=0;Ue.terrain&&hi.elevation&&(Ia=hi.elevation*Ue.terrain.exaggeration());const pa=(()=>{const uc=ss.aabb;return ur.min=[...uc.min],ur.max=[...uc.max],ur.min[2]+=Ia,ur.max[2]+=Ia,a.af(ur.min,ur.min,Ai),a.af(ur.max,ur.max,Ai),ur})(),mi=ss.evaluatedScale;if(mi[0]<=1&&mi[1]<=1&&mi[2]<=1&&pa.intersects(qr)===0)continue;if(!Ar&&wr){const uc=.16666666666666666;ss.cameraCollisionOpacity=Vt[0]>pa.min[0]&&Vt[0]pa.min[1]&&Vt[1]!wr||ss.opacity===1&&hi.opacity===1?ss.depthhi.depth?-1:1);for(const ss of ei){const hi=ss.nodeInfo,Ia=hi.node;let pa=a.aB([],zt,ss.tileModelMatrix);a.aB(pa,nr,pa);const mi=a.bl([],pa);a.eg(mi,mi),a.cS(mi,mi,wv),pa=a.aB(pa,pa,Ia.globalMatrix);const Zs=Ue.renderPass==="light-beam",is=ct.paint.get("model-color-use-theme").constantOr("default")==="none",sa=_i&a.eI.HasMapboxMeshFeatures,Ya=sa?0:hi.evaluatedRMEA[0][2];for(let Na=0;Na=ar||Sa>=ar}}const Ll=$i.material;let lu;Ll.occlusionTexture&&Ll.occlusionTexture.offsetScale&&(lu=Ll.occlusionTexture.offsetScale,zo.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Yu=Ue.getOrCreateProgram("model",zo);!Ar&&It&&It.setupShadowsFromMatrix(ss.tileModelMatrix,Yu,It.useNormalOffset),Ue.uploadCommonUniforms(ot,Yu,null,hc);const vd=Ll.pbrMetallicRoughness;vd.metallicFactor=.9,vd.roughnessFactor=.5;const za=qg(new Float32Array(Xl),new Float32Array(pa),new Float32Array(mi),new Float32Array(Ia.globalMatrix),Ue,ss.opacity,vd.baseColorFactor,Ll.emissiveFactor,vd.metallicFactor,vd.roughnessFactor,Ll,Ya,ct,[0,0,0],lu);!Yc&&(hi.hasTranslucentParts||ss.opacity<1)&&Yu.draw(Ue,ot.gl.TRIANGLES,Zt,zn.disabled,ns.disabled,Fn.backCCW,za,ct.id,$i.vertexBuffer,$i.indexBuffer,$i.segments,ct.paint,Ue.transform.zoom,void 0,uc),Yu.draw(Ue,ot.gl.TRIANGLES,Yc?qt:Zt,zn.disabled,Yc||ss.opacity<1||hi.hasTranslucentParts?ns.alphaBlended:ns.unblended,Fn.backCCW,za,ct.id,$i.vertexBuffer,$i.indexBuffer,$i.segments,ct.paint,Ue.transform.zoom,void 0,uc)}}}}()}(_,d,p,b),void ce();if(le.type!=="model")return;const de=le.getModels(),be=[],xe=_.transform.getFreeCameraOptions().position,Pe=a.c5([],[xe.x,xe.y,xe.z],_.transform.worldSize);a.ew(Pe,Pe);const Ee=[],$e=[];let Ke=0;for(const Ue of de){const mt=d.getFeatureState("",Ue.id),ct={type:"Unknown",id:Ue.id,properties:Ue.featureProperties},ht=p.paint.get("model-rotation").evaluate(ct,mt),ot=p.paint.get("model-scale").evaluate(ct,mt),st=p.paint.get("model-translation").evaluate(ct,mt),_t=p.paint.get("model-opacity").evaluate(ct,mt);wP(p,Ue.id,mt,Ue.featureProperties,Ue.nodeOverrideNames,Ue.nodeOverrides),jP(p,Ue.id,mt,Ue.featureProperties,Ue.materialOverrideNames,Ue.materialOverrides),Ue.nodeOverrides.size>0&&Ue.computeBoundsAndApplyParent(),Ue.computeModelMatrix(_,ht,ot,st,z,O,!1);const It=a.bA([]),Tt=a.ef(Ue.position.lat,_.transform.zoom),Vt=a.bq([],[1,1,1/Tt]);a.br(It,It,Pe),be.push({zScaleMatrix:Vt,negCameraPosMatrix:It});for(const Ht of Ue.nodes)Zg(_,Ht,Ue.matrix,_.transform.expandedFarZProjMatrix,Ke,Ee,$e,Ue.materialOverrides,_t);Ke++}if(Ee.sort((Ue,mt)=>mt.depth-Ue.depth),_.renderPass!=="shadow")kP(_,p,Ee,$e,be),ce();else{for(const Ue of $e)jh(Ue.mesh,Ue.nodeModelMatrix,_,p);for(const Ue of Ee)jh(Ue.mesh,Ue.nodeModelMatrix,_,p);ce()}}},Jk={line:function(_,d,p){if(_.hasElevatedBuckets=!1,_.hasNonElevatedBuckets=!1,_._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||_._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const b=d.getVisibleCoordinates();for(const M of b){const L=d.getTile(M).getBucket(_);if(L&&(L.elevationType!=="none"?_.hasElevatedBuckets=!0:_.hasNonElevatedBuckets=!0,_.hasElevatedBuckets&&_.hasNonElevatedBuckets))break}}}else _.hasNonElevatedBuckets=!0},model:function(_,d,p){const b=d.getSource();if(!b.loaded())return;if(b.type==="vector"||b.type==="geojson")return void(p.modelManager&&p.modelManager.upload(p,bv(p,_)));if(b.type==="batched-model"||b.type!=="model")return;const M=b.getModels();for(const L of M)L.upload(p.context)},raster:function(_,d,p){const b=d.getSource();if(!(b instanceof Jo&&b.loaded()))return;const M=_.sourceLayer||b.rasterLayerIds&&b.rasterLayerIds[0];if(!M)return;const L=_.paint.get("raster-array-band")||b.getInitialBand(M);if(L==null)return;const O=d.getIds().map(z=>d.getTileByID(z));for(const z of O)z.updateNeeded(_.id,L)&&b.prepareTile(z,M,_.id,L)},"raster-particle":function(_,d,p){const b=d.getSource();if(!(b instanceof Jo&&b.loaded()))return;const M=_.sourceLayer||b.rasterLayerIds&&b.rasterLayerIds[0];if(!M)return;const L=_.paint.get("raster-particle-array-band")||b.getInitialBand(M);if(L==null)return;const O=d.getIds().map(z=>d.getTileByID(z));for(const z of O)z.updateNeeded(_.id,L)&&b.prepareTile(z,M,_.id,L)}},ou={fill:zk},eN={fill:function(_,d,p,b){if(!p.layout||p.layout.get("fill-elevation-reference")==="none"||p.paint.get("fill-opacity").constantOr(1)===0)return;const M=_.context.gl,L=new cn(M.LEQUAL,cn.ReadOnly,_.depthRangeFor3D),O=new zn({func:M.ALWAYS,mask:255},255,255,M.KEEP,M.KEEP,M.REPLACE),z=_.transform.getFreeCameraOptions().position,V=_.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of b){const Q=d.getTile(Y),ce=Q.getBucket(p);if(!ce)continue;const le=ce.elevatedStructures;if(!le||le.depthSegments.segments[0].primitiveLength===0)continue;const de=fP(Y.toUnwrapped(),z),be=_.translatePosMatrix(Y.projMatrix,Q,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor")),xe=Ug(be,de,0,1,0);V.draw(_,M.TRIANGLES,L,O,ns.disabled,Fn.disabled,xe,p.id,le.vertexBuffer,le.indexBuffer,le.depthSegments,p.paint,_.transform.zoom)}}};class tN{constructor(d,p,b,M,L){this.context=new Cy(d,p),this.transform=b,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=a.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const O=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const V of O)this._debugParams.enabledLayers[V]=!0;for(const V of O);this.occlusionParams=new Ty,this.setup(),this.numSublayers=Vc.maxUnderzooming+Vc.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new my(this),this._wireframeDebugCache=new Om,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const z=new a.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new a.T(this.context,z,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=M,this.worldview=L,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,p){const b=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(b||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Y5(this,d));const M=this._terrain;this.transform.elevation=b?M:null,M.update(d,this.transform,p),this.transform.elevation&&!M.enabled&&(this.transform.elevation=null)}_updateFog(d){const p=d.fog;if(!p||this.transform.projection.name==="globe"||p.getOpacity(this.transform.pitch)<1||p.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[b,M]=p.getFovAdjustedRange(this.transform._fov);if(b>M)return void(this.transform.fogCullDistSq=null);const L=b+.78*(M-b);this.transform.fogCullDistSq=L*L}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(d){d&&!this._terrain&&(this._terrain=new Y5(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,p){if(this.width=d*a.o.devicePixelRatio,this.height=p*a.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const b of this.style.order)this.style._mergedLayers[b].resize()}setup(){const d=this.context,p=new a.bd;p.emplaceBack(0,0),p.emplaceBack(a.al,0),p.emplaceBack(0,a.al),p.emplaceBack(a.al,a.al),this.tileExtentBuffer=d.createVertexBuffer(p,a.bf.members),this.tileExtentSegments=a.bg.simpleSegment(0,0,4,2);const b=new a.bd;b.emplaceBack(0,0),b.emplaceBack(a.al,0),b.emplaceBack(0,a.al),b.emplaceBack(a.al,a.al),this.debugBuffer=d.createVertexBuffer(b,a.bf.members),this.debugSegments=a.bg.simpleSegment(0,0,4,5);const M=new a.bd;M.emplaceBack(-1,-1),M.emplaceBack(1,-1),M.emplaceBack(-1,1),M.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(M,a.bf.members),this.viewportSegments=a.bg.simpleSegment(0,0,4,2);const L=new a.b1;L.emplaceBack(0,0,0,0),L.emplaceBack(a.al,0,a.al,0),L.emplaceBack(0,a.al,0,a.al),L.emplaceBack(a.al,a.al,a.al,a.al),this.mercatorBoundsBuffer=d.createVertexBuffer(L,a.bi.members),this.mercatorBoundsSegments=a.bg.simpleSegment(0,0,4,2);const O=new a.b0;O.emplaceBack(0,1,2),O.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(O);const z=new a.be;for(const Y of[0,1,3,2,0])z.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(z),this.emptyTexture=new a.T(d,new a.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=a.bC();const V=this.context.gl;this.stencilClearMode=new zn({func:V.ALWAYS,mask:0},0,255,V.ZERO,V.ZERO,V.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(d){return d._makeTileBoundsBuffers(this.context,this.transform.projection),d._tileBoundsBuffer?{tileBoundsBuffer:d._tileBoundsBuffer,tileBoundsIndexBuffer:d._tileBoundsIndexBuffer,tileBoundsSegments:d._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const d=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,d.TRIANGLES,cn.disabled,this.stencilClearMode,ns.disabled,Fn.disabled,fv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,p,b){if(!p||this.currentStencilSource===p.id||!d.isTileClipped()||!b||b.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let z=!1;for(const V of b)if(this._tileClippingMaskIDs[V.key]===void 0){z=!0;break}if(!z)return}this.currentStencilSource=p.id;const M=this.context,L=M.gl;this.nextStencilID+b.length>256&&this.clearStencil(),M.setColorMode(ns.disabled),M.setDepthMode(cn.disabled);const O=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const z of b){const V=p.getTile(z),Y=this._tileClippingMaskIDs[z.key]=this.nextStencilID++,{tileBoundsBuffer:Q,tileBoundsIndexBuffer:ce,tileBoundsSegments:le}=this.getTileBoundsBuffers(V);O.draw(this,L.TRIANGLES,cn.disabled,new zn({func:L.ALWAYS,mask:0},Y,255,L.KEEP,L.KEEP,L.REPLACE),ns.disabled,Fn.disabled,fv(z.projMatrix),"$clipping",Q,ce,le)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,p=this.context.gl;return new zn({func:p.NOTEQUAL,mask:255},d,255,p.KEEP,p.KEEP,p.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const p=this.context.gl;return new zn({func:p.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,p.KEEP,p.KEEP,p.REPLACE)}stencilConfigForOverlap(d){const p=this.context.gl,b=d.sort((O,z)=>z.overscaledZ-O.overscaledZ),M=b[b.length-1].overscaledZ,L=b[0].overscaledZ-M+1;if(L>1){this.currentStencilSource=void 0,this.nextStencilID+L>256&&this.clearStencil();const O={};for(let z=0;zthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,p)=>d+p/this._fpsHistory.length,0))}render(d,p){const b=a.o.now();this._dt=b-this._timeStamp,this._timeStamp=b,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=p;const M=this.style._mergedLayers,L=!(!this.terrain||!this.terrain.enabled),O=()=>this.style._getOrder(L).filter(zt=>{const Nt=M[zt];return!(Nt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Nt.type]});let z=O(),V=!1,Y=!1,Q=null,ce=0,le=!1;for(const zt of z){const Nt=M[zt];Nt.visibility!=="none"&&(Nt.type==="circle"?V=!0:Nt.type==="building"?(Q=Nt,++ce):Nt.type==="symbol"&&(Nt.hasOcclusionOpacityProperties?Y=!0:V=!0))}this.updateEmissiveMode();let de=z.map(zt=>M[zt]);const be=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(a.o.now()),this.imageManager.beginFrame();for(const zt in be){const Nt=be[zt];Nt.used&&(Nt.prepare(this.context),Nt.getSource().usedInConflation&&++ce)}let xe=!1;for(const zt of de)zt.isHidden(this.transform.zoom)||(zt.type==="clip"&&(xe=!0),this.prepareLayer(zt));const Pe={},Ee={},$e={},Ke={},Ue={};for(const zt in be){const Nt=be[zt];Pe[zt]=Nt.getVisibleCoordinates(),Ee[zt]=Pe[zt].slice().reverse(),$e[zt]=Nt.getVisibleCoordinates(!0).reverse(),Ke[zt]=Nt.getShadowCasterCoordinates(),Ue[zt]=Nt.sortCoordinatesByDistance(Pe[zt])}const mt=zt=>{const Nt=this.style.getLayerSourceCache(zt);return Nt&&Nt.used?Nt.getSource():null};if(ce||xe||this._clippingActiveLastFrame){const zt=[],Nt=[];let Zt=0;for(const qt of de)this.isSourceForClippingOrConflation(qt,mt(qt))&&(zt.push(qt),Nt.push(Zt)),Zt++;if(zt&&(xe||zt.length>1)||this._clippingActiveLastFrame){xe=!1;const qt=[];for(let ur=0;ur0){const qt=mt(Nt);qt&&(this.minCutoffZoom=Math.max(qt.minzoom,this.minCutoffZoom)),Nt.minzoom&&(this.minCutoffZoom=Math.max(Nt.minzoom,this.minCutoffZoom))}Nt.is3D(L)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=zt),this._lastOcclusionLayer=zt)}const ct=this.style&&this.style.fog;ct?(this._fogVisible=ct.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ct.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding($e),this.opaquePassCutoff=0,z=O(),de=z.map(zt=>M[zt]));const ht=this._shadowRenderer;if(ht){ht.updateShadowParameters(this.transform,this.style.directionalLight);for(const zt in be)for(const Nt of Pe[zt]){let Zt={min:0,max:0};this.terrain&&(Zt=this.terrain.getMinMaxForTile(Nt)||Zt),ht.addShadowReceiver(Nt.toUnwrapped(),Zt.min,Zt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new bP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ot=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),st=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ot&&!this._snow&&(this._snow=new h3(this)),!ot&&this._snow&&(this._snow.destroy(),delete this._snow),st&&!this._rain&&(this._rain=new Qk(this)),!st&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),Q){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Gk);const zt=this.style.getLayerSourceCache(Q);this.buildingTileBorderManager.updateBorders(zt,Q)}if(!nt.has(this.context.gl))return;this.renderPass="offscreen";for(const zt of de){const Nt=d.getLayerSourceCache(zt);if(!zt.hasOffscreenPass()||zt.isHidden(this.transform.zoom))continue;const Zt=Nt?Ee[Nt.id]:void 0;(zt.type==="custom"||zt.type==="raster"||zt.type==="raster-particle"||zt.isSky()||Zt&&Zt.length)&&this.renderLayer(this,Nt,zt,Zt)}this.depthRangeFor3D=[0,1-(de.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Ke)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const _t=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),It=(()=>{if(p.showOverdrawInspector)return a.ao.black;const zt=this.style.fog;if(zt&&this.transform.projection.supportsFog){const Nt=this.style.getLut(zt.scope);if(!_t){const Zt=zt.properties.get("color-use-theme")==="none",qt=zt.properties.get("color").toNonPremultipliedRenderColor(Zt?null:Nt).toArray01();return new a.ao(...qt)}if(_t){const Zt=zt.properties.get("space-color-use-theme")==="none",qt=zt.properties.get("space-color").toNonPremultipliedRenderColor(Zt?null:Nt).toArray01();return new a.ao(...qt)}}return a.ao.transparent})();if(this.context.clear({color:It,depth:1}),this.clearStencil(),this._showOverdrawInspector=p.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&_t&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=z.length-1;this.currentLayer>=0;this.currentLayer--){const zt=de[this.currentLayer],Nt=d.getLayerSourceCache(zt);if(zt.isSky())continue;const Zt=Nt?(zt.is3D(L)?Ue:Ee)[Nt.id]:void 0;this._renderTileClippingMasks(zt,Nt,Zt),this.renderLayer(this,Nt,zt,Zt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&_t&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.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&&zt.hasShadowPass()&&--Vt==0){{this.clearStencil(),this.resetStencilClippingMasks();const Zt=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Zt=this.currentLayer;this.depthOcclusion=!0;for(const qt of this.layersWithOcclusionOpacity){this.currentLayer=qt;const ur=de[this.currentLayer],Ar=d.getLayerSourceCache(ur),qr=Ar?Ee[Ar.id]:void 0;this.terrain||this._renderTileClippingMasks(ur,Ar,Ar?Pe[Ar.id]:void 0),this.renderLayer(this,Ar,ur,qr)}this.depthOcclusion=!1,this.currentLayer=Zt,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 zt=null;de.forEach(Nt=>{const Zt=d.getLayerSourceCache(Nt);Zt&&!Nt.isHidden(this.transform.zoom)&&Zt.getVisibleCoordinates().length&&(!zt||zt.getSource().maxzoom0?p.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,p,b){const M=b===void 0?this.terrain&&this.terrain.renderingToTexture:b,L=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(L.push("LIGHTING_3D_MODE"),L.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):M||L.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||L.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(L.push("TERRAIN"),this.linearFloatFilteringSupported()&&L.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&L.push("GLOBE"),!this._fogVisible||M||p!==void 0&&!p||L.push("FOG","FOG_DITHERING"),M&&L.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&L.push("OVERDRAW_INSPECTOR"),L}getOrCreateProgram(d,p){this.cache=this.cache||{};const b=p&&p.defines||[],M=p&&p.config,L=this.currentGlobalDefines(d,p&&p.overrideFog,p&&p.overrideRtt).concat(b),O=eP.cacheKey(R5[d],d,L,M);return this.cache[O]||(this.cache[O]=new eP(this.context,d,R5[d],M,Fk[d],L)),this.cache[O]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(d,p){if(this.style.enable3dLights()){const b=this.style.directionalLight,M=this.style.ambientLight;if(b&&M){const L=((O,z,V)=>{const Y=O.properties.get("direction"),Q=O.properties.get("color-use-theme")==="none",ce=O.properties.get("color").toNonPremultipliedRenderColor(Q?null:V.getLut(O.scope)).toArray01(),le=O.properties.get("intensity"),de=z.properties.get("color-use-theme")==="none",be=z.properties.get("color").toNonPremultipliedRenderColor(de?null:V.getLut(z.scope)).toArray01(),xe=z.properties.get("intensity"),Pe=[Y.x,Y.y,Y.z],Ee=a.dN(be,xe),$e=a.dN(ce,le);return{u_lighting_ambient_color:Ee,u_lighting_directional_dir:Pe,u_lighting_directional_color:$e,u_ground_radiance:ky(Pe,$e,Ee)}})(b,M,this.style);p.setLightsUniformValues(d,L)}}}uploadCommonUniforms(d,p,b,M,L){if(this.uploadCommonLightUniforms(d,p),this.terrain&&this.terrain.renderingToTexture)return;const O=this.style.fog;if(O){const z=O.getOpacity(this.transform.pitch),V=((Y,Q,ce,le,de,be,xe,Pe,Ee,$e,Ke,Ue)=>{const mt=Y.transform,ct=Q.properties.get("color-use-theme")==="none",ht=Q.properties.get("color").toNonPremultipliedRenderColor(ct?null:Y.style.getLut(Q.scope)).toArray01();ht[3]=le;const ot=Y.frameCounter/1e3%1,[st,_t]=Q.properties.get("vertical-range");return{u_fog_matrix:ce?mt.calculateFogTileMatrix(ce):Ue||Y.identityMat,u_fog_range:Q.getFovAdjustedRange(mt._fov),u_fog_color:ht,u_fog_horizon_blend:Q.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(st,_t),_t],u_fog_temporal_offset:ot,u_frustum_tl:de,u_frustum_tr:be,u_frustum_br:xe,u_frustum_bl:Pe,u_globe_pos:Ee,u_globe_radius:$e,u_viewport:Ke,u_globe_transition:a.aj(mt.zoom),u_is_globe:+(mt.projection.name==="globe")}})(this,O,b,z,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*a.o.devicePixelRatio,this.transform.height*a.o.devicePixelRatio],M);p.setFogUniformValues(d,V)}L&&p.setCutoffUniformValues(d,L.uniformValues)}setTileLoadedFlag(d){this.tileLoaded=d}saveCanvasCopy(){const d=this.canvasCopy();d&&(this.frameCopies.push(d),this.tileLoaded=!1)}canvasCopy(){const d=this.context.gl,p=d.createTexture();return d.bindTexture(d.TEXTURE_2D,p),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),p}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const d=this.style&&this.style.fog;return!!d&&d.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const d=this._backgroundTiles,p=this._backgroundTiles={},b=this.transform.coveringTiles({tileSize:512});for(const M of b)p[M.key]=d[M.key]||new ap(M,512,this.transform.tileZoom,this,void 0,this.worldview);return p}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,p){return!(!d.is3D(!(!this.terrain||!this.terrain.enabled))||d.type!=="clip"&&d.type!=="building"&&(d.minzoom&&d.minzoom>this.transform.zoom||(this.style._clipLayerPresent||d.sourceLayer!=="building"&&d.sourceLayer!=="procedural_buildings")&&(!p||p.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let p=this._cachedTileFogOpacities[d.key];return p||(this._cachedTileFogOpacities[d.key]=p=this.style.fog.getOpacityForTile(d)),p[0]>=ar||p[1]>=ar}setupDepthForOcclusion(d,p,b){const M=this.context,L=M.gl,O=!!b;var z;b||(b={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),M.activeTexture.set(L.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE),b.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],b.u_depth_range_unpack=[2/((z=this.depthRangeFor3D)[1]-z[0]),-1-2*z[0]/(z[1]-z[0])],b.u_occluder_half_size=.5*this.occlusionParams.occluderSize,b.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE),M.activeTexture.set(L.TEXTURE0),O||p.setTerrainUniformValues(M,b)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function rN(_,d){let p=!1,b=null;const M=()=>{b=null,p&&(_(),b=setTimeout(M,d),p=!1)};return()=>(p=!0,b||M(),b)}class f3{constructor(d){this._hashName=d&&encodeURIComponent(d),a.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=rN(this._updateHashUnthrottled.bind(this),300)}addTo(d){return this._map=d,window.addEventListener("hashchange",this._onHashChange,!1),d.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const d=this._map;if(!d)return"";const p=Ro(d);if(this._hashName){const b=this._hashName;let M=!1;const L=location.hash.slice(1).split("&").map(O=>{const z=O.split("=")[0];return z===b?(M=!0,`${z}=${p}`):O}).filter(O=>O);return M||L.push(`${b}=${p}`),`#${L.join("&")}`}return`#${p}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let p;return d.split("&").map(b=>b.split("=")).forEach(b=>{b[0]===this._hashName&&(p=b)}),(p&&p[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const p=this._getCurrentHash();if(p.length>=3&&!p.some(b=>isNaN(Number(b)))){const b=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(p[3]||0):d.getBearing();return d.jumpTo({center:[+p[2],+p[1]],zoom:+p[0],bearing:b,pitch:+(p[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Ro(_,d){const p=_.getCenter(),b=Math.round(100*_.getZoom())/100,M=Math.ceil((b*Math.LN2+Math.log(512/360/.5))/Math.LN10),L=Math.pow(10,M),O=Math.round(p.lng*L)/L,z=Math.round(p.lat*L)/L,V=_.getBearing(),Y=_.getPitch();let Q=d?`/${O}/${z}/${b}`:`${b}/${z}/${O}`;return(V||Y)&&(Q+="/"+Math.round(10*V)/10),Y&&(Q+=`/${Math.round(Y)}`),Q}const Ey={linearity:.3,easing:a.eT(0,0,.3,1)},p3=Object.assign({deceleration:2500,maxSpeed:1400},Ey),m3=Object.assign({deceleration:20,maxSpeed:1400},Ey),Xg=Object.assign({deceleration:1e3,maxSpeed:360},Ey),g3=Object.assign({deceleration:1e3,maxSpeed:90},Ey);class x3{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,p=a.o.now();for(;d.length>0&&p-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const p={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:L}of this._inertiaBuffer)p.zoom+=L.zoomDelta||0,p.bearing+=L.bearingDelta||0,p.pitch+=L.pitchDelta||0,L.panDelta&&p.pan._add(L.panDelta),L.around&&(p.around=L.around),L.pinchAround&&(p.pinchAround=L.pinchAround);const b=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,M={};if(p.pan.mag()){const L=pf(p.pan.mag(),b,Object.assign({},p3,d||{}));M.offset=p.pan.mult(L.amount/p.pan.mag()),M.center=this._map.transform.center,Iy(M,L)}if(p.zoom){const L=pf(p.zoom,b,m3);M.zoom=this._map.transform.zoom+L.amount,Iy(M,L)}if(p.bearing){const L=pf(p.bearing,b,Xg);M.bearing=this._map.transform.bearing+a.aA(L.amount,-179,179),Iy(M,L)}if(p.pitch){const L=pf(p.pitch,b,g3);M.pitch=this._map.transform.pitch+L.amount,Iy(M,L)}if(M.zoom||M.bearing){const L=p.pinchAround===void 0?p.around:p.pinchAround;M.around=L?this._map.unproject(L):this._map.getCenter()}return this.clear(),M.noMoveStart=!0,M}}function Iy(_,d){(!_.duration||_.durationp.unproject(V)),z=L.reduce((V,Y,Q,ce)=>V.add(Y.div(ce.length)),new a.P(0,0));super(d,{points:L,point:z,lngLats:O,lngLat:p.unproject(z),originalEvent:b}),this._defaultPrevented=!1}}class y3 extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,p){super("wheel",{originalEvent:p}),this._defaultPrevented=!1}}class nN{constructor(d,p){this._map=d,this._clickTolerance=p.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new y3(this._map,d))}mousedown(d,p){return this._mousedownPos=p,this._firePreventable(new yd(d.type,this._map,d))}mouseup(d){this._map.fire(new yd(d.type,this._map,d))}preclick(d){const p=new MouseEvent("preclick",d);this._map.fire(new yd(p.type,this._map,p))}click(d,p){this._mousedownPos&&this._mousedownPos.dist(p)>=this._clickTolerance||(this.preclick(d),this._map.fire(new yd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new yd(d.type,this._map,d))}mouseover(d){this._map.fire(new yd(d.type,this._map,d))}mouseout(d){this._map.fire(new yd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new Rm(d.type,this._map,d))}touchmove(d){this._map.fire(new Rm(d.type,this._map,d))}touchend(d){this._map.fire(new Rm(d.type,this._map,d))}touchcancel(d){this._map.fire(new Rm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class v3{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new yd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new yd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new yd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class sN{constructor(d,p){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=p.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,p){this.isEnabled()&&d.shiftKey&&d.button===0&&($(),this._startPos=this._lastPos=p,this._active=!0)}mousemoveWindow(d,p){if(!this._active)return;const b=p,M=this._startPos,L=this._lastPos;if(!M||!L||L.equals(b)||!this._box&&b.dist(M){this._box&&(this._box.style.transform=`translate(${O}px,${V}px)`,this._box.style.width=z-O+"px",this._box.style.height=Y-V+"px")})}mouseupWindow(d,p){if(!this._active)return;const b=this._startPos,M=p;if(b&&d.button===0){if(this.reset(),W(),b.x!==M.x||b.y!==M.y)return this._map.fire(new a.z("boxzoomend",{originalEvent:d})),{cameraAnimation:L=>L.fitScreenCoordinates(b,M,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",d)}}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),F(),delete this._startPos,delete this._lastPos}_fireEvent(d,p){return this._map.fire(new a.z(d,{originalEvent:p}))}}function iN(_,d){const p={};for(let b=0;b<_.length;b++)p[_[b].identifier]=d[b];return p}class MP{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(d,p,b){(this.centroid||b.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),b.length===this.numTouches&&(this.centroid=function(M){const L=new a.P(0,0);for(const O of M)L._add(O);return L.div(M.length)}(p),this.touches=iN(b,p)))}touchmove(d,p,b){if(this.aborted||!this.centroid)return;const M=iN(b,p);for(const L in this.touches){const O=M[L];(!O||O.dist(this.touches[L])>30)&&(this.aborted=!0)}}touchend(d,p,b){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),b.length===0){const M=!this.aborted&&this.centroid;if(this.reset(),M)return M}}}class aN{constructor(d){this.singleTap=new MP(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,p,b){this.singleTap.touchstart(d,p,b)}touchmove(d,p,b){this.singleTap.touchmove(d,p,b)}touchend(d,p,b){const M=this.singleTap.touchend(d,p,b);if(M){const L=d.timeStamp-this.lastTime<500,O=!this.lastTap||this.lastTap.dist(M)<30;if(L&&O||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=M,this.count===this.numTaps)return this.reset(),M}}}class TP{constructor(){this._zoomIn=new aN({numTouches:1,numTaps:2}),this._zoomOut=new aN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,p,b){this._zoomIn.touchstart(d,p,b),this._zoomOut.touchstart(d,p,b)}touchmove(d,p,b){this._zoomIn.touchmove(d,p,b),this._zoomOut.touchmove(d,p,b)}touchend(d,p,b){const M=this._zoomIn.touchend(d,p,b),L=this._zoomOut.touchend(d,p,b);return M?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:O=>O.easeTo({duration:300,zoom:O.getZoom()+1,around:O.unproject(M)},{originalEvent:d})}):L?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:O=>O.easeTo({duration:300,zoom:O.getZoom()-1,around:O.unproject(L)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const AP={0:1,2:2},_3={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class oN{constructor(d){this.reset(),this._clickTolerance=d.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(d,p){return!1}_move(d,p){return{}}mousedown(d,p){if(this._lastPoint)return;const b=re(d);this._correctButton(d,b)&&(this._lastPoint=p,this._eventButton=b)}mousemoveWindow(d,p){const b=this._lastPoint;if(b){if(d.preventDefault(),this._eventButton!=null&&function(M,L){const O=AP[L];return M.buttons===void 0||(M.buttons&O)!==O}(d,this._eventButton))this.reset();else if(this._moved||!(p.dist(b)0&&(this._active=!0);const M=iN(b,p),L=new a.P(0,0),O=new a.P(0,0);let z=0;for(const Y in M){const Q=M[Y],ce=this._touches[Y];ce&&(L._add(Q),O._add(Q.sub(ce)),z++,M[Y]=Q)}if(this._touches=M,z{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class lN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,p,b){return{}}touchstart(d,p,b){this._firstTwoTouches||b.length<2||(this._firstTwoTouches=[b[0].identifier,b[1].identifier],this._start([p[0],p[1]]))}touchmove(d,p,b){const M=this._firstTwoTouches;if(!M)return;d.preventDefault();const[L,O]=M,z=jv(b,p,L),V=jv(b,p,O);if(!z||!V)return;const Y=this._aroundCenter?null:z.add(V).div(2);return this._move([z,V],Y,d)}touchend(d,p,b){if(!this._firstTwoTouches)return;const[M,L]=this._firstTwoTouches,O=jv(b,p,M),z=jv(b,p,L);O&&z||(this._active&&W(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function jv(_,d,p){for(let b=0;b<_.length;b++)if(_[b].identifier===p)return d[b]}function PP(_,d){return Math.log2(_/d)}class nae extends lN{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,p){const b=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(PP(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:PP(this._distance,b),pinchAround:p}}}function LP(_,d){return 180*_.angleWith(d)/Math.PI}class ka extends lN{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,p){const b=this._vector;if(this._vector=d[0].sub(d[1]),b&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:LP(this._vector,b),pinchAround:p}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const p=25/(Math.PI*this._minDiameter)*360,b=this._startVector;if(!b)return!1;const M=LP(d,b);return Math.abs(M)Math.abs(_.x)}class sae extends lN{constructor(d){super(),this._map=d}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(d){this._lastPoints=d,cN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,p,b){const M=this._lastPoints;if(!M)return;const L=d[0].sub(M[0]),O=d[1].sub(M[1]);return this._map._cooperativeGestures&&!a.eU()&&b.touches.length<3||(this._valid=this.gestureBeginsVertically(L,O,b.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(L.y+O.y)/2*-.5})}gestureBeginsVertically(d,p,b){if(this._valid!==void 0)return this._valid;const M=d.mag()>=2,L=p.mag()>=2;if(!M&&!L)return;if(!M||!L)return this._firstMove==null&&(this._firstMove=b),b-this._firstMove<100&&void 0;const O=d.y>0==p.y>0;return cN(d)&&cN(p)&&O}}const iae={panStep:100,bearingStep:15,pitchStep:10};class aae{constructor(){const d=iae;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let p=0,b=0,M=0,L=0,O=0;switch(d.keyCode){case 61:case 107:case 171:case 187:p=1;break;case 189:case 109:case 173:p=-1;break;case 37:d.shiftKey?b=-1:(d.preventDefault(),L=-1);break;case 39:d.shiftKey?b=1:(d.preventDefault(),L=1);break;case 38:d.shiftKey?M=1:(d.preventDefault(),O=-1);break;case 40:d.shiftKey?M=-1:(d.preventDefault(),O=1);break;default:return}return this._rotationDisabled&&(b=0,M=0),{cameraAnimation:z=>{const V=z.getZoom();z.easeTo({duration:300,easeId:"keyboardHandler",easing:kv,zoom:p?Math.round(V)+p*(d.shiftKey?2:1):V,bearing:z.getBearing()+b*this._bearingStep,pitch:z.getPitch()+M*this._pitchStep,offset:[-L*this._panStep,-O*this._panStep],center:z.getCenter()},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function kv(_){return _*(2-_)}const j3=4.000244140625,k3=1/450;class dN{constructor(d,p){this._map=d,this._el=d.getCanvasContainer(),this._handler=p,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=k3,a.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(d){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(d.ctrlKey||d.metaKey||this.isZooming()||a.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let p=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const b=a.o.now(),M=b-(this._lastWheelEventTime||0);this._lastWheelEventTime=b,p!==0&&p%j3==0?this._type="wheel":p!==0&&Math.abs(p)<4?this._type="trackpad":M>400?(this._type=null,this._lastValue=p,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(M*p)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,p+=this._lastValue)),d.shiftKey&&p&&(p/=4),this._type&&(this._lastWheelEvent=d,this._delta-=p,this._active||this._start(d)),d.preventDefault()}_onTimeout(d){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)}_start(d){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const p=K(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:p,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const d=this._map.transform;this._type==="wheel"&&d.projection.wrap&&(d._center.lng>=180||d._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const p=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const Y=this._type==="wheel"&&Math.abs(this._delta)>j3?this._wheelZoomRate:this._defaultZoomRate;let Q=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&Q!==0&&(Q=1/Q);const ce=p(),le=Math.pow(2,ce),de=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):le;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(de*Q))),this._type==="wheel"&&(this._startZoom=ce,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const b=typeof this._targetZoom=="number"?this._targetZoom:p(),M=this._startZoom,L=this._easing;let O,z=!1;if(this._type==="wheel"&&M&&L){const Y=Math.min((a.o.now()-this._lastWheelEventTime)/200,1),Q=L(Y);O=a.ak(M,b,Q),Y<1?this._frameId||(this._frameId=!0):z=!0}else O=b,z=!0;this._active=!0,z&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let V=O-p();return V*this._lastDelta<0&&(V=0),{noInertia:!0,needsRenderFrame:!z,zoomDelta:V,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let p=a.eV;if(this._prevEase){const b=this._prevEase,M=(a.o.now()-b.start)/b.duration,L=b.easing(M+.01)-b.easing(M),O=.27/Math.sqrt(L*L+1e-4)*.01,z=Math.sqrt(.0729-O*O);p=a.eT(O,z,.25,1)}return this._prevEase={start:a.o.now(),duration:d,easing:p},p}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=S("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 yp{constructor(d,p){this._clickZoom=d,this._tapZoom=p}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 uN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,p){return d.preventDefault(),{cameraAnimation:b=>{b.easeTo({duration:300,zoom:b.getZoom()+(d.shiftKey?-1:1),around:b.unproject(p)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fo{constructor(){this._tap=new aN({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(d,p,b){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?b.length>0&&(this._swipePoint=p[0],this._swipeTouch=b[0].identifier):this._tap.touchstart(d,p,b))}touchmove(d,p,b){if(this._tapTime){if(this._swipePoint){if(b[0].identifier!==this._swipeTouch)return;const M=p[0],L=M.y-this._swipePoint.y;return this._swipePoint=M,d.preventDefault(),this._active=!0,{zoomDelta:L/128}}}else this._tap.touchmove(d,p,b)}touchend(d,p,b){this._tapTime?this._swipePoint&&b.length===0&&this.reset():this._tap.touchend(d,p,b)&&(this._tapTime=d.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mf{constructor(d,p,b){this._el=d,this._mousePan=p,this._touchPan=b}enable(d){this._inertiaOptions=d||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Nv{constructor(d,p,b){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=p,this._mousePitch=b}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 hN{constructor(d,p,b,M){this._el=d,this._touchZoom=p,this._touchRotate=b,this._tapDragZoom=M,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Sv=_=>_.zoom||_.drag||_.pitch||_.rotate;class oae extends a.z{}class Cv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,p){const b=a.av([],p,d);this.radius=a.ag(b[2]<0?a.eX([],b,this.constants):[b[0],b[1],0])}projectRay(d){a.eX(d,d,this.constants),a.aw(d,d),a.eY(d,d,this.constants);const p=a.c5([],d,this.radius);if(p[2]>0){const b=a.c5([],[0,0,1],a.bJ(p,[0,0,1])),M=a.c5([],a.aw([],[p[0],p[1],0]),this.radius),L=a.d8([],p,a.c5([],a.av([],a.d8([],M,b),p),2));p[0]=L[0],p[1]=L[1]}return p}}function fN(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class lae{constructor(d,p){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new x3(d),this._bearingSnap=p.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Cv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(p),a.aY(["handleEvent","handleWindowEvent"],this);const b=this._el;this._listeners=[[b,"touchstart",{passive:!0}],[b,"touchmove",{passive:!1}],[b,"touchend",void 0],[b,"touchcancel",void 0],[b,"mousedown",void 0],[b,"mousemove",void 0],[b,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[b,"mouseover",void 0],[b,"mouseout",void 0],[b,"dblclick",void 0],[b,"click",void 0],[b,"keydown",{capture:!1}],[b,"keyup",void 0],[b,"wheel",{passive:!1}],[b,"contextmenu",void 0],[window,"blur",void 0]];for(const[M,L,O]of this._listeners){const z=M===document?this.handleWindowEvent:this.handleEvent;M.addEventListener(L,z,O)}}destroy(){for(const[d,p,b]of this._listeners){const M=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(p,M,b)}}_addDefaultHandlers(d){const p=this._map,b=p.getCanvasContainer();this._add("mapEvent",new nN(p,d));const M=p.boxZoom=new sN(p,d);this._add("boxZoom",M);const L=new TP,O=new uN;p.doubleClickZoom=new yp(O,L),this._add("tapZoom",L),this._add("clickZoom",O);const z=new Fo;this._add("tapDragZoom",z);const V=p.touchPitch=new sae(p);this._add("touchPitch",V);const Y=new b3(d),Q=new w3(d);p.dragRotate=new Nv(d,Y,Q),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",Q,["mouseRotate"]);const ce=new EP(d),le=new IP(p,d);p.dragPan=new mf(b,ce,le),this._add("mousePan",ce),this._add("touchPan",le,["touchZoom","touchRotate"]);const de=new ka,be=new nae;p.touchZoomRotate=new hN(b,be,de,z),this._add("touchRotate",de,["touchPan","touchZoom"]),this._add("touchZoom",be,["touchPan","touchRotate"]),this._add("blockableMapEvent",new v3(p));const xe=p.scrollZoom=new dN(p,this);this._add("scrollZoom",xe,["mousePan"]);const Pe=p.keyboard=new aae;this._add("keyboard",Pe);for(const Ee of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Ee]&&p[Ee].enable(d[Ee])}_add(d,p,b){this._handlers.push({handlerName:d,handler:p,allowed:b}),this._handlersById[d]=p}stop(d){if(!this._updatingCamera){for(const{handler:p}of this._handlers)p.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Sv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,p,b){for(const M in d)if(M!==b&&(!p||p.indexOf(M)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const p=[];for(const b of d)this._el.contains(b.target)&&p.push(b);return p}handleEvent(d,p){this._updatingCamera=!0;const b=d.type==="renderFrame",M=b?void 0:d,L={needsRenderFrame:!1},O={},z={},V=d.touches?this._getMapTouches(d.touches):void 0,Y=V?Z(this._el,V):b?void 0:K(this._el,d);for(const{handlerName:le,handler:de,allowed:be}of this._handlers){if(!de.isEnabled())continue;let xe;this._blockedByActive(z,be,le)?de.reset():de[p||d.type]&&(xe=de[p||d.type](d,Y,V),this.mergeHandlerResult(L,O,xe,le,M),xe&&xe.needsRenderFrame&&this._triggerRenderFrame()),(xe||de.isActive())&&(z[le]=de)}const Q={};for(const le in this._previousActiveHandlers)z[le]||(Q[le]=M);this._previousActiveHandlers=z,(Object.keys(Q).length||fN(L))&&(this._changes.push([L,O,Q]),this._triggerRenderFrame()),(Object.keys(z).length||fN(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=L;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))}mergeHandlerResult(d,p,b,M,L){if(!b)return;Object.assign(d,b);const O={handlerName:M,originalEvent:b.originalEvent||L};b.zoomDelta!==void 0&&(p.zoom=O),b.panDelta!==void 0&&(p.drag=O),b.pitchDelta!==void 0&&(p.pitch=O),b.bearingDelta!==void 0&&(p.rotate=O)}_applyChanges(){const d={},p={},b={};for(const[M,L,O]of this._changes)M.panDelta&&(d.panDelta=(d.panDelta||new a.P(0,0))._add(M.panDelta)),M.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+M.zoomDelta),M.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+M.bearingDelta),M.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+M.pitchDelta),M.around!==void 0&&(d.around=M.around),M.aroundCoord!==void 0&&(d.aroundCoord=M.aroundCoord),M.pinchAround!==void 0&&(d.pinchAround=M.pinchAround),M.noInertia&&(d.noInertia=M.noInertia),Object.assign(p,L),Object.assign(b,O);this._updateMapTransform(d,p,b),this._changes=[]}_updateMapTransform(d,p,b){const M=this._map,L=M.transform,O=$e=>[$e.x,$e.y,$e.z];if(($e=>{const Ke=this._eventsInProgress.drag;return Ke&&!this._handlersById[Ke.handlerName].isActive()})()&&!fN(d)){const $e=L.zoom;L.cameraElevationReference="sea",this._originalZoom!=null&&L._orthographicProjectionAtLowPitch&&L.projection.name!=="globe"&&L.pitch===0?(L.cameraElevationReference="ground",L.zoom=this._originalZoom):(L.recenterOnTerrain(),L.cameraElevationReference="ground"),$e!==L.zoom&&this._map._update(!0)}if(L._isCameraConstrained&&M._stop(!0),!fN(d))return void this._fireEvents(p,b,!0);let{panDelta:z,zoomDelta:V,bearingDelta:Y,pitchDelta:Q,around:ce,aroundCoord:le,pinchAround:de}=d;L._isCameraConstrained&&(V>0&&(V=0),L._isCameraConstrained=!1),de!==void 0&&(ce=de),(V||($e=>p[$e]&&!this._eventsInProgress[$e])("drag"))&&ce&&(this._dragOrigin=O(L.pointCoordinate3D(ce)),this._originalZoom=L.zoom,this._trackingEllipsoid.setup(L._camera.position,this._dragOrigin)),L.cameraElevationReference="sea",M._stop(!0),ce=ce||M.transform.centerPoint,Y&&(L.bearing+=Y),Q&&(L.pitch+=Q),L._updateCameraState();const be=[0,0,0];if(z)if(L.projection.name==="mercator"){const $e=this._trackingEllipsoid.projectRay(L.screenPointToMercatorRay(ce).dir),Ke=this._trackingEllipsoid.projectRay(L.screenPointToMercatorRay(ce.sub(z)).dir);be[0]=Ke[0]-$e[0],be[1]=Ke[1]-$e[1]}else{const $e=L.pointCoordinate(ce);if(L.projection.name==="globe"){z=z.rotate(-L.angle);const Ke=L._pixelsPerMercatorPixel/L.worldSize;be[0]=-z.x*a.eW(a.a$($e.y))*Ke,be[1]=-z.y*a.eW(L.center.lat)*Ke}else{const Ke=L.pointCoordinate(ce.sub(z));$e&&Ke&&(be[0]=Ke.x-$e.x,be[1]=Ke.y-$e.y)}}const xe=L.zoom,Pe=[0,0,0];if(V){const $e=O(le||L.pointCoordinate3D(ce)),Ke={dir:a.aw([],a.av([],$e,L._camera.position))};if(Ke.dir[2]<0){const Ue=L.zoomDeltaToMovement($e,V);a.c5(Pe,Ke.dir,Ue)}}const Ee=a.d8(be,be,Pe);L._translateCameraConstrained(Ee),V&&Math.abs(L.zoom-xe)>1e-4&&L.recenterOnTerrain(),L.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(p,b,!0)}_fireEvents(d,p,b){const M=Sv(this._eventsInProgress),L=Sv(d),O={};for(const Q in d){const{originalEvent:ce}=d[Q];this._eventsInProgress[Q]||(O[`${Q}start`]=ce),this._eventsInProgress[Q]=d[Q]}!M&&L&&this._fireEvent("movestart",L.originalEvent);for(const Q in O)this._fireEvent(Q,O[Q]);L&&this._fireEvent("move",L.originalEvent);for(const Q in d){const{originalEvent:ce}=d[Q];this._fireEvent(Q,ce)}const z={};let V;for(const Q in this._eventsInProgress){const{handlerName:ce,originalEvent:le}=this._eventsInProgress[Q];this._handlersById[ce].isActive()||(delete this._eventsInProgress[Q],V=p[ce]||le,z[`${Q}end`]=V)}for(const Q in z)this._fireEvent(Q,z[Q]);const Y=Sv(this._eventsInProgress);if(b&&(M||L)&&!Y){this._updatingCamera=!0;const Q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ce=le=>le!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new oae("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const pN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class N3 extends a.E{constructor(d,p){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=p.bearingSnap,this._respectPrefersReducedMotion=p.respectPrefersReducedMotion!==!1,a.aY(["_renderFrameCallback"],this)}getCenter(){return new a.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,p){return this.jumpTo({center:d},p)}panBy(d,p,b){return d=a.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},p),b)}panTo(d,p,b){return this.easeTo(Object.assign({center:d},p),b)}getZoom(){return this.transform.zoom}setZoom(d,p){return this.jumpTo({zoom:d},p),this}zoomTo(d,p,b){return this.easeTo(Object.assign({zoom:d},p),b)}zoomIn(d,p){return this.zoomTo(this.getZoom()+1,d,p),this}zoomOut(d,p){return this.zoomTo(this.getZoom()-1,d,p),this}getBearing(){return this.transform.bearing}setBearing(d,p){return this.jumpTo({bearing:d},p),this}getPadding(){return this.transform.padding}setPadding(d,p){return this.jumpTo({padding:d},p),this}rotateTo(d,p,b){return this.easeTo(Object.assign({bearing:d},p),b)}resetNorth(d,p){return this.rotateTo(0,Object.assign({duration:1e3},d),p),this}resetNorthPitch(d,p){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),p),this}snapToNorth(d,p){return Math.abs(this.getBearing())d.aspect?b/(2*Math.tan(.5*d.fovX)*d.aspect):M/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,p,b,M,L,O){const z=d.clone(),V=this._extendCameraOptions(O);z.bearing=M,z.pitch=L;const Y=a.aT.convert(p),Q=a.aT.convert(b),ce=.5*(Y.lat+Q.lat),le=.5*(Y.lng+Q.lng),de=a.eZ(ce,le),be=a.aw([],de),xe=a.aw([],a.bI([],be,[0,1,0])),Pe=a.bI([],xe,be),Ee=[xe[0],xe[1],xe[2],0,Pe[0],Pe[1],Pe[2],0,be[0],be[1],be[2],0,0,0,0,1],$e=[de,a.eZ(Y.lat,Y.lng),a.eZ(Q.lat,Y.lng),a.eZ(Q.lat,Q.lng),a.eZ(Y.lat,Q.lng),a.eZ(ce,Y.lng),a.eZ(ce,Q.lng),a.eZ(Y.lat,le),a.eZ(Q.lat,le)];let Ke=a.d9.fromPoints($e.map(qt=>[a.bJ(xe,qt),a.bJ(Pe,qt),a.bJ(be,qt)]));const Ue=a.af([],Ke.center,Ee);a.e_(Ue)===0&&a.e$(Ue,0,0,1),a.aw(Ue,Ue),a.c5(Ue,Ue,a.aD),z.center=a.f0(Ue);const mt=z.getWorldToCameraMatrix(),ct=a.bl(new Float64Array(16),mt);Ke=a.d9.applyTransform(Ke,a.aB([],mt,Ee));const ht=this._extendAABB(Ke,z,V,M);if(!ht)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ke=ht,a.af(Ue,Ue,mt);const ot=.5*(Ke.max[2]-Ke.min[2]),st=this._minimumAABBFrustumDistance(z,Ke),_t=a.c5([],[0,0,1],ot),It=a.d8(_t,Ue,_t),Tt=st+(z.pitch===0?0:a.bG(Ue,It)),Vt=z.globeCenterInViewSpace,Ht=a.av([],Ue,[Vt[0],Vt[1],Vt[2]]);a.aw(Ht,Ht),a.c5(Ht,Ht,Tt);const nr=a.d8([],Ue,Ht);a.af(nr,nr,ct);const br=a.eM/a.aD,zt=a.ag(nr),Nt=a.cf(Math.max(zt*br-a.eM,Number.EPSILON),0),Zt=Math.min(z.zoomFromMercatorZAdjusted(Nt),V.maxZoom);return Zt>.5*(a.c_+a.cL)?(z.setProjection({name:"mercator"}),z.zoom=Zt,this._cameraForBounds(z,p,b,M,L,O)):{center:z.center,zoom:Zt,bearing:M,pitch:L}}_extendAABB(d,p,b,M){const L=.5*((b.padding.left||0)+(b.padding.right||0)),O=.5*((b.padding.top||0)+(b.padding.bottom||0)),z=O,V=L,Y=L,Q=O,ce=p.width-(V+Y),le=p.height-(z+Q),de=a.av([],d.max,d.min),be=Math.min(ce/de[0],le/de[1]),xe=Math.min(p.scaleZoom(p.scale*be),b.maxZoom);if(isNaN(xe))return null;const Pe=p.scale/p.zoomScale(xe),Ee=new a.d9([d.min[0]-V*Pe,d.min[1]-Q*Pe,d.min[2]],[d.max[0]+Y*Pe,d.max[1]+z*Pe,d.max[2]]),$e=(typeof b.offset.x=="number"&&typeof b.offset.y=="number"?new a.P(b.offset.x,b.offset.y):a.P.convert(b.offset)).rotate(-a.an(M));return Ee.center[0]-=$e.x*Pe,Ee.center[1]+=$e.y*Pe,Ee}queryTerrainElevation(d,p){const b=this.transform.elevation;return b?(p=Object.assign({},{exaggerated:!0},p),b.getAtPoint(a.ae.fromLngLat(d),null,p.exaggerated)):null}_cameraForBounds(d,p,b,M,L,O){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,p,b,M,L,O);const z=d.clone(),V=this._extendCameraOptions(O);z.bearing=M,z.pitch=L;const Y=a.aT.convert(p),Q=a.aT.convert(b),ce=new a.aT(Y.lng,Q.lat),le=new a.aT(Q.lng,Y.lat),de=z.project(Y),be=z.project(Q),xe=this.queryTerrainElevation(Y),Pe=this.queryTerrainElevation(Q),Ee=this.queryTerrainElevation(ce),$e=this.queryTerrainElevation(le),Ke=[[de.x,de.y,Math.min(xe||0,Pe||0,Ee||0,$e||0)],[be.x,be.y,Math.max(xe||0,Pe||0,Ee||0,$e||0)]];let Ue=a.d9.fromPoints(Ke);const mt=z.getWorldToCameraMatrix(),ct=a.bl(new Float64Array(16),mt);Ue=a.d9.applyTransform(Ue,mt);const ht=this._extendAABB(Ue,z,V,M);if(!ht)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ue=ht;const ot=.5*a.av([],Ue.max,Ue.min)[2],st=this._minimumAABBFrustumDistance(z,Ue),_t=[0,0,1,0];a.aC(_t,_t,mt),a.f1(_t,_t);const It=a.c5([],_t,st+ot),Tt=a.d8([],Ue.center,It);a.af(Ue.center,Ue.center,ct),a.af(Tt,Tt,ct);const Vt=z.unproject(new a.P(Ue.center[0],Ue.center[1])),Ht=a.f2(z.projection,Vt),nr=Math.pow(2,Ht),br=Math.min(z._zoomFromMercatorZ(Tt[2]*z.pixelsPerMeter*nr/z.worldSize),V.maxZoom);return z.mercatorFromTransition&&br<.5*(a.c_+a.cL)?(z.setProjection({name:"globe"}),z.zoom=br,this._cameraForBounds(z,p,b,M,L,O)):{center:Vt,zoom:br,bearing:M,pitch:L}}fitBounds(d,p,b){const M=this.cameraForBounds(d,p);return this._fitInternal(M,p,b)}fitScreenCoordinates(d,p,b,M,L){const O=a.P.convert(d),z=a.P.convert(p),V=new a.P(Math.min(O.x,z.x),Math.min(O.y,z.y)),Y=new a.P(Math.max(O.x,z.x),Math.max(O.y,z.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(O,z))return this;const Q=this.transform.pointLocation3D(V),ce=this.transform.pointLocation3D(Y),le=this.transform.pointLocation3D(new a.P(V.x,Y.y)),de=this.transform.pointLocation3D(new a.P(Y.x,V.y)),be=[Math.min(Q.lng,ce.lng,le.lng,de.lng),Math.min(Q.lat,ce.lat,le.lat,de.lat)],xe=[Math.max(Q.lng,ce.lng,le.lng,de.lng),Math.max(Q.lat,ce.lat,le.lat,de.lat)],Pe=M&&M.pitch?M.pitch:this.getPitch(),Ee=this._cameraForBounds(this.transform,be,xe,b,Pe,M);return this._fitInternal(Ee,M,L)}_fitInternal(d,p,b){return d?(p=Object.assign(d,p)).linear?this.easeTo(p,b):this.flyTo(p,b):this}jumpTo(d,p){this.stop();const b=d.preloadOnly?this.transform.clone():this.transform;let M=!1,L=!1,O=!1;"zoom"in d&&b.zoom!==+d.zoom&&(M=!0,b.zoom=+d.zoom),d.center!==void 0&&(b.center=a.aT.convert(d.center)),"bearing"in d&&b.bearing!==+d.bearing&&(L=!0,b.bearing=+d.bearing),"pitch"in d&&b.pitch!==+d.pitch&&(O=!0,b.pitch=+d.pitch);const z=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!b.isPaddingEqual(z))if(d.retainPadding===!1){const V=b.clone();V.padding=z,b.setLocationAtPoint(b.center,V.centerPoint)}else b.padding=z;return d.preloadOnly?(this._preloadTiles(b),this):(this.fire(new a.z("movestart",p)).fire(new a.z("move",p)),M&&this.fire(new a.z("zoomstart",p)).fire(new a.z("zoom",p)).fire(new a.z("zoomend",p)),L&&this.fire(new a.z("rotatestart",p)).fire(new a.z("rotate",p)).fire(new a.z("rotateend",p)),O&&this.fire(new a.z("pitchstart",p)).fire(new a.z("pitch",p)).fire(new a.z("pitchend",p)),this.fire(new a.z("moveend",p)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(pN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,p){const b=this.transform;if(!b.projection.supportsFreeCamera)return a.w(pN),this;this.stop();const M=b.zoom,L=b.pitch,O=b.bearing;b.setFreeCameraOptions(d);const z=M!==b.zoom,V=L!==b.pitch,Y=O!==b.bearing;return this.fire(new a.z("movestart",p)).fire(new a.z("move",p)),z&&this.fire(new a.z("zoomstart",p)).fire(new a.z("zoom",p)).fire(new a.z("zoomend",p)),Y&&this.fire(new a.z("rotatestart",p)).fire(new a.z("rotate",p)).fire(new a.z("rotateend",p)),V&&this.fire(new a.z("pitchstart",p)).fire(new a.z("pitch",p)).fire(new a.z("pitchend",p)),this.fire(new a.z("moveend",p)),this}easeTo(d,p){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:a.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const b=this.transform,M=this.getZoom(),L=this.getBearing(),O=this.getPitch(),z=this.getPadding(),V="zoom"in d?+d.zoom:M,Y="bearing"in d?this._normalizeBearing(d.bearing,L):L,Q="pitch"in d?+d.pitch:O,ce=this._extendPadding(d.padding),le=a.P.convert(d.offset);let de,be,xe;if(b.projection.name==="globe"){const _t=a.ae.fromLngLat(b.center),It=le.rotate(-b.angle);_t.x+=It.x/b.worldSize,_t.y+=It.y/b.worldSize;const Tt=_t.toLngLat(),Vt=a.aT.convert(d.center||Tt);this._normalizeCenter(Vt),de=b.centerPoint.add(It),be=new a.P(_t.x,_t.y).mult(b.worldSize),xe=new a.P(a.aF(Vt.lng),a.aJ(Vt.lat)).mult(b.worldSize).sub(be)}else{de=b.centerPoint.add(le);const _t=b.pointLocation(de),It=a.aT.convert(d.center||_t);this._normalizeCenter(It),be=b.project(_t),xe=b.project(It).sub(be)}const Pe=b.zoomScale(V-M);let Ee,$e;d.around&&(Ee=a.aT.convert(d.around),$e=b.locationPoint(Ee));const Ke=this._zooming||V!==M,Ue=this._rotating||L!==Y,mt=this._pitching||Q!==O,ct=!b.isPaddingEqual(ce),ht=d.retainPadding===!1?b.clone():b,ot=_t=>It=>{if(Ke&&(_t.zoom=a.ak(M,V,It)),Ue&&(_t.bearing=a.ak(L,Y,It)),mt&&(_t.pitch=a.ak(O,Q,It)),ct&&(ht.interpolatePadding(z,ce,It),de=ht.centerPoint.add(le)),Ee)_t.setLocationAtPoint(Ee,$e);else{const Tt=_t.zoomScale(_t.zoom-M),Vt=V>M?Math.min(2,Pe):Math.max(.5,Pe),Ht=Math.pow(Vt,1-It),nr=_t.unproject(be.add(xe.mult(It*Ht)).mult(Tt));_t.setLocationAtPoint(_t.renderWorldCopies?nr.wrap():nr,de)}return d.preloadOnly||this._fireMoveEvents(p),_t};if(d.preloadOnly){const _t=this._emulate(ot,d.duration,b);return this._preloadTiles(_t),this}const st={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Ke,this._rotating=Ue,this._pitching=mt,this._padding=ct,this._easeId=d.easeId,this._prepareEase(p,d.noMoveStart,st),this._ease(ot(b),_t=>{b.cameraElevationReference==="sea"&&b.recenterOnTerrain(),this._afterEase(p,_t)},d),this}_prepareEase(d,p,b={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),p||b.moving||this.fire(new a.z("movestart",d)),this._zooming&&!b.zooming&&this.fire(new a.z("zoomstart",d)),this._rotating&&!b.rotating&&this.fire(new a.z("rotatestart",d)),this._pitching&&!b.pitching&&this.fire(new a.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new a.z("move",d)),this._zooming&&this.fire(new a.z("zoom",d)),this._rotating&&this.fire(new a.z("rotate",d)),this._pitching&&this.fire(new a.z("pitch",d))}_afterEase(d,p){if(this._easeId&&p&&this._easeId===p)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const b=this._zooming,M=this._rotating,L=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,b&&this.fire(new a.z("zoomend",d)),M&&this.fire(new a.z("rotateend",d)),L&&this.fire(new a.z("pitchend",d)),this.fire(new a.z("moveend",d))}flyTo(d,p){if(this._prefersReducedMotion(d)){const qt=a.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(qt,p)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:a.eV},d);const b=this.transform,M=this.getZoom(),L=this.getBearing(),O=this.getPitch(),z=this.getPadding(),V="zoom"in d?a.aA(+d.zoom,b.minZoom,b.maxZoom):M,Y="bearing"in d?this._normalizeBearing(d.bearing,L):L,Q="pitch"in d?+d.pitch:O,ce=this._extendPadding(d.padding),le=b.zoomScale(V-M),de=a.P.convert(d.offset);let be=b.centerPoint.add(de);const xe=b.pointLocation(be),Pe=a.aT.convert(d.center||xe);this._normalizeCenter(Pe);const Ee=b.project(xe),$e=b.project(Pe).sub(Ee);let Ke=d.curve;const Ue=Math.max(b.width,b.height),mt=Ue/le,ct=$e.mag();if("minZoom"in d){const qt=a.aA(Math.min(d.minZoom,M,V),b.minZoom,b.maxZoom),ur=Ue/b.zoomScale(qt-M);Ke=Math.sqrt(ur/ct*2)}const ht=Ke*Ke;function ot(qt){const ur=(mt*mt-Ue*Ue+(qt?-1:1)*ht*ht*ct*ct)/(2*(qt?mt:Ue)*ht*ct);return Math.log(Math.sqrt(ur*ur+1)-ur)}function st(qt){return(Math.exp(qt)-Math.exp(-qt))/2}function _t(qt){return(Math.exp(qt)+Math.exp(-qt))/2}const It=ot(0);let Tt=function(qt){return _t(It)/_t(It+Ke*qt)},Vt=function(qt){return Ue*((_t(It)*(st(ur=It+Ke*qt)/_t(ur))-st(It))/ht)/ct;var ur},Ht=(ot(1)-It)/Ke;if(Math.abs(ct)<1e-6||!isFinite(Ht)){if(Math.abs(Ue-mt)<1e-6)return this.easeTo(d,p);const qt=mtd.maxDuration&&(d.duration=0);const nr=L!==Y,br=Q!==O,zt=!b.isPaddingEqual(ce),Nt=d.retainPadding===!1?b.clone():b,Zt=qt=>ur=>{const Ar=ur*Ht,qr=1/Tt(Ar);qt.zoom=ur===1?V:M+qt.scaleZoom(qr),nr&&(qt.bearing=a.ak(L,Y,ur)),br&&(qt.pitch=a.ak(O,Q,ur)),zt&&(Nt.interpolatePadding(z,ce,ur),be=Nt.centerPoint.add(de));const Sr=ur===1?Pe:qt.unproject(Ee.add($e.mult(Vt(Ar))).mult(qr));return qt.setLocationAtPoint(qt.renderWorldCopies?Sr.wrap():Sr,be),qt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(p),qt};if(d.preloadOnly){const qt=this._emulate(Zt,d.duration,b);return this._preloadTiles(qt),this}return this._zooming=!0,this._rotating=nr,this._pitching=br,this._padding=zt,this._prepareEase(p,!1),this._ease(Zt(b),()=>this._afterEase(p),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,p){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const b=this._onEaseEnd;this._onEaseEnd=void 0,b.call(this,p)}if(!d){const b=this.handlers;b&&b.stop(!1)}return this}_ease(d,p,b){b.animate===!1||b.duration===0?(d(1),p()):(this._easeStart=a.o.now(),this._easeOptions=b,this._onEaseFrame=d,this._onEaseEnd=p,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((a.o.now()-this._easeStart)/this._easeOptions.duration,1),p=this._onEaseFrame;p&&p(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,p){d=a.bT(d,-180,180);const b=Math.abs(d-p);return Math.abs(d-360-p)180?-360:b<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&a.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,p,b){const M=Math.ceil(15*p/1e3),L=[],O=d(b.clone());for(let z=0;z<=M;z++){const V=O(z/M);L.push(V.clone())}return L}_preloadTiles(d,p){}}class Mv{constructor(d={}){this.options=d,a.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const p=this.options&&this.options.compact,b=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=S("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",b);const M=S("span","mapboxgl-ctrl-icon",this._compactButton);return M.setAttribute("aria-hidden","true"),M.setAttribute("title",b),this._innerContainer=S("div","mapboxgl-ctrl-attrib-inner",this._container),p&&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),p===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));const p=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.e.ACCESS_TOKEN}];if(d){const b=p.reduce((M,L,O)=>(L.value&&(M+=`${L.key}=${L.value}${OM.length-L.length),d=d.filter((M,L)=>{for(let O=L+1;O=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const b=d.map(M=>function(L){const O=new DOMParser().parseFromString(L,"text/html");return Array.from(O.body.querySelectorAll("*")).forEach(z=>{const V=z.textContent||"";if(z.tagName!=="A")return void z.replaceWith(O.createTextNode(V));const Y=z.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void z.replaceWith(O.createTextNode(V));const Q=O.createElement("a");Q.href=Y,Q.textContent=V,Q.rel="noopener nofollow";const ce=z.getAttribute("class");ce&&(Q.className=ce),z.replaceWith(Q)}),O.body.innerHTML}(M)).join(" | ");b!==this._attribHTML&&(this._attribHTML=b,d.length?(this._innerContainer.innerHTML=b,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 Tv{constructor(){a.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=S("div","mapboxgl-ctrl");const p=S("a","mapboxgl-ctrl-logo");return p.target="_blank",p.rel="noopener nofollow",p.href="https://www.mapbox.com/",p.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),p.setAttribute("rel","noopener nofollow"),this._container.appendChild(p),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const d=this._map.style._sourceCaches;if(Object.entries(d).length===0)return!0;for(const p in d){const b=d[p].getSource();if(b.hasOwnProperty("mapbox_logo")&&!b.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const p=d[0];this._map.getCanvasContainer().offsetWidth<250?p.classList.add("mapboxgl-compact"):p.classList.remove("mapboxgl-compact")}}}class Py{constructor(){a.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",p=>this._onIndoorUpdate(p)),this._container}_createButton(d,p){const b=S("button",d,this._container);return b.type="button",b.addEventListener("click",p),b}_createSeparator(){return S("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,p){this._map&&(d.setAttribute("aria-label",p),d.textContent=p)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(d){if(!d||!d.floors)return this._model=d,void(this._container.style.display="none");const p=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",p&&Array.from(this._container.children).forEach(b=>b.remove()),d.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(d.floors,d.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const d=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const p=this._map;this._model&&p&&p._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});S("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&d.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(d),this._createSeparator()}_updateBuildingsButtonState(){const d=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");d&&this._model&&(this._model.activeFloorsVisible?d.classList.remove("mapboxgl-ctrl-level-button-selected"):d.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(d,p){for(let b=0;b{this._map._selectIndoorFloor(M.id)});this._setButtonTitle(L,M.zIndex.toString()),this._model&&M.id===this._model.selectedFloorId&&p&&L.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(L),b=this._endTime)return this._end;const p=a.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-p)+this._end*p}isEasing(d){return d>=this._startTime&&d<=this._endTime}jumpTo(d){this._startTime=-1/0,this._endTime=-1/0,this._start=d,this._end=d}easeTo(d,p,b){this._start=this.getValue(p),this._end=d,this._startTime=p,this._endTime=p+b}}const bp={"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 Fm extends a.z{constructor(d,p,b,M){const{point:L,lngLat:O,originalEvent:z,target:V}=d;super(d.type,{point:L,lngLat:O,originalEvent:z,target:V}),this.preventDefault=()=>{d.preventDefault()},this.id=p,this.interaction=b,this.feature=M}}class kh{constructor(d){this.map=d,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(d,p){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const b=p.filter;let M=p.type;b&&this.filters.set(d,a.b6(b)),M==="mouseover"&&(M="mouseenter"),M==="mouseout"&&(M="mouseleave");const L=this.interactionsByType.get(M)||new Map;M==="mouseenter"||M==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,p)):L.size===0&&this.map.on(M,this.handleType),L.size===0&&this.interactionsByType.set(M,L),L.set(d,p),this.typeById.set(d,M)}get(d){const p=this.typeById.get(d);if(!p)return;const b=this.interactionsByType.get(p);return b?b.get(d):void 0}remove(d){const p=this.typeById.get(d);if(!p)return;this.typeById.delete(d),this.filters.delete(d);const b=this.interactionsByType.get(p);b&&(b.delete(d),p==="mouseenter"||p==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):b.size===0&&this.map.off(p,this.handleType))}queryTargets(d,p){const b=[];for(const[M,L]of p)L.target&&b.push({targetId:M,target:L.target,filter:this.filters.get(M)});return this.map.style.queryRenderedTargets(d,b,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const p=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());p.length&&(d.type="mouseenter",this.handleType(d,p));const b=new Map;for(const[M,{feature:L}]of this.prevHoveredFeatures)this.hoveredFeatures.has(M)||b.set(L.id,L);b.size&&(d.type="mouseleave",this.handleType(d,Array.from(b.values())))}handleOut(d){const p=Array.from(this.hoveredFeatures.values()).map(({feature:b})=>b);p.length&&(d.type="mouseleave",this.handleType(d,p)),this.hoveredFeatures.clear()}handleType(d,p){const b=d.type==="mouseenter";if(b&&!this.interactionsByType.has(d.type))return void a.w("mouseenter interaction required for mouseleave to work.");const M=Array.from(this.interactionsByType.get(d.type)).reverse(),L=!!p;p=p||this.queryTargets(d.point,M);let O=!1;const z=new Set;for(const V of p){for(const[Y,Q]of M){if(!Q.target)continue;const ce=V.variants?V.variants[Y]:null;if(ce){for(const le of ce){if(Fu(le,V,z,Y))continue;const de=new a.dx(V,le),be=sf(le,V,Y);L&&de.id!==void 0&&(de.state=this.map.getFeatureState(de));const xe=b?this.prevHoveredFeatures.get(be):null,Pe=new Fm(d,Y,Q,de),Ee=xe?xe.stop:Q.handler(Pe);if(b&&this.hoveredFeatures.set(be,{feature:V,stop:Ee}),Ee!==!1){O=!0;break}}if(O)break}}if(O)break}if(!O)for(const[V,Y]of M){const{handler:Q,target:ce}=Y;if(!ce&&Q(new Fm(d,V,Y,null))!==!1)break}}}function cae(_,d){if(Array.isArray(_)&&Array.isArray(d)){const p=new Set(_),b=new Set(d);return p.size===b.size&&_.every(M=>b.has(M))}return a.by(_,d)}const dae={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"},uae={showCompass:!0,showZoom:!0,visualizePitch:!1};class hae{constructor(d,p,b=!1){this._clickTolerance=10,this.element=p,this.mouseRotate=new b3({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,b&&(this.mousePitch=new w3({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),a.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),p.addEventListener("mousedown",this.mousedown),p.addEventListener("touchstart",this.touchstart,{passive:!1}),p.addEventListener("touchmove",this.touchmove),p.addEventListener("touchend",this.touchend),p.addEventListener("touchcancel",this.reset)}down(d,p){this.mouseRotate.mousedown(d,p),this.mousePitch&&this.mousePitch.mousedown(d,p),$()}move(d,p){const b=this.map,M=this.mouseRotate.mousemoveWindow(d,p),L=M&&M.bearingDelta;if(L&&b.setBearing(b.getBearing()+L),this.mousePitch){const O=this.mousePitch.mousemoveWindow(d,p),z=O&&O.pitchDelta;z&&b.setPitch(b.getPitch()+z)}}off(){const d=this.element;d.removeEventListener("mousedown",this.mousedown),d.removeEventListener("touchstart",this.touchstart),d.removeEventListener("touchmove",this.touchmove),d.removeEventListener("touchend",this.touchend),d.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){F(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),K(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,K(this.element,d))}mouseup(d){this.mouseRotate.mouseupWindow(d),this.mousePitch&&this.mousePitch.mouseupWindow(d),this.offTemp()}touchstart(d){d.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Z(this.element,d.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>d.preventDefault()},this._startPos))}touchmove(d){d.targetTouches.length!==1?this.reset():(this._lastPos=Z(this.element,d.targetTouches)[0],this.move({preventDefault:()=>d.preventDefault()},this._lastPos))}touchend(d){d.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)p.width||d.y>p.height;p.locationPoint3D(b).distSqr(d)180;){const b=p.locationPoint3D(_);if(b.x>=0&&b.y>=0&&b.x<=p.width&&b.y<=p.height)break;_.lng>p.center.lng?_.lng-=360:_.lng+=360}return _}const dc={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%)"},Gu={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class mN extends a.E{constructor(d,p){super(),(d instanceof HTMLElement||p)&&(d=Object.assign({element:d},p)),a.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:b="center",color:M="#3FB1CE",scale:L=1,draggable:O=!1,clickTolerance:z=0,rotation:V=Gu.rotation,rotationAlignment:Y=Gu.rotationAlignment,pitchAlignment:Q=Gu.pitchAlignment,occludedOpacity:ce=Gu.occludedOpacity,altitude:le=Gu.altitude}=d||{};this._anchor=b,this._color=M,this._scale=L,this._draggable=O,this._clickTolerance=z,this._rotation=V,this._rotationAlignment=Y,this._pitchAlignment=Q,this._occludedOpacity=ce,this._altitude=le,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=a.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=a.P.convert(d&&d.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",xe=>{xe.preventDefault()}),this._element.addEventListener("mousedown",xe=>{xe.preventDefault()});const de=this._element.classList;for(const xe in dc)de.remove(`mapboxgl-marker-anchor-${xe}`);de.add(`mapboxgl-marker-anchor-${this._anchor}`);const be=d&&d.className?d.className.trim().split(/\s+/):[];de.add(...be),this._popup=null}_createDefaultMarker(){const d=S("div"),p=T("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const b=T("radialGradient",{id:"shadowGradient"},T("defs",{},p));T("stop",{offset:"10%","stop-opacity":.4},b),T("stop",{offset:"100%","stop-opacity":.05},b),T("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},p)}return T("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"},p),T("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"},p),T("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},p),d}addTo(d){return d===this._map||(this.remove(),this._map=d,d.getCanvasContainer().appendChild(this._element),d.on("move",this._updateMoving),d.on("moveend",this._update),d.on("remove",this._clearFadeTimer),d._addMarker(this),this.setDraggable(this._draggable),this._update(),d.on("click",this._onMapClick)),this}remove(){const d=this._map;return d&&(d.off("click",this._onMapClick),d.off("move",this._updateMoving),d.off("moveend",this._update),d.off("mousedown",this._addDragHandler),d.off("touchstart",this._addDragHandler),d.off("mouseup",this._onUp),d.off("touchend",this._onUp),d.off("mousemove",this._onMove),d.off("touchmove",this._onMove),d.off("remove",this._clearFadeTimer),d._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=a.aT.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(d){return d===this._altitude||(this._defaultMarker&&(this._altitude===0&&d!==0||this._altitude!==0&&d===0)&&(this._element=this._createDefaultMarker()),this._altitude=d||Gu.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const M=Math.sqrt(Math.pow(13.5,2)/2);d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[M,-1*(38.1-13.5+M)],"bottom-right":[-M,-1*(38.1-13.5+M)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=d,d._marker=this,d._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(d){const p=d.code,b=d.charCode||d.keyCode;p!=="Space"&&p!=="Enter"&&b!==32&&b!==13||this.togglePopup()}_onMapClick(d){const p=d.originalEvent.target,b=this._element;this._popup&&(p===b||b.contains(p))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const d=this._popup;return d?(d.isOpen()?(d.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(d.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const d=this._map,p=this._pos;if(!d||!p)return!1;const b=d.unproject(p,this._altitude),M=d.getFreeCameraOptions();if(!M.position)return!1;const L=M.position.toLngLat();return L.distanceTo(b)<.9*L.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const p=this._pos;if(!p||p.x<0||p.x>d.transform.width||p.y<0||p.y>d.transform.height)return void this._clearFadeTimer();const b=d.unproject(p,this._altitude);let M;d._showingGlobe()&&a.f5(d.transform,this._lngLat)?M=0:(M=1-d._queryFogOpacity(b),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(M*=this._occludedOpacity)),this._element.style.opacity=`${M}`,this._element.style.pointerEvents=M>0?"auto":"none",this._popup&&this._popup._setOpacity(M),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const p=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${dc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${p.x}px,${p.y}px) `}_calculateXYTransform(){const d=this._pos,p=this._map,b=this.getPitchAlignment();if(!p||!d||b!=="map")return"";if(!p._showingGlobe()){const V=p.getPitch();return V?`rotateX(${V}deg)`:""}const M=a.cX(a.f6(p.transform,this._lngLat)),L=d.sub(a.f7(p.transform)),O=Math.abs(L.x)+Math.abs(L.y);if(O===0)return"";const z=M/O;return`rotateX(${-L.y*z}deg) rotateY(${L.x*z}deg)`}_calculateZTransform(){const d=this._pos,p=this._map;if(!p||!d)return"";let b=0;const M=this.getRotationAlignment();if(M==="map")if(p._showingGlobe()){const L=p.project(new a.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),O=p.project(new a.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(L);b=a.cX(Math.atan2(O.y,O.x))-90}else b=-p.getBearing();else if(M==="horizon"){const L=a.ah(4,6,p.getZoom()),O=a.f7(p.transform);O.y+=L*p.transform.height;const z=d.sub(O),V=a.cX(Math.atan2(z.y,z.x));b=(V>90?V-270:V+90)*(1-L)}return b+=this._rotation,b?`rotateZ(${b}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const p=this._map;p&&(p.transform.renderWorldCopies&&(this._lngLat=S3(this._lngLat,this._pos,p.transform)),this._pos=p.project(this._lngLat,this._altitude),d===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),p._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(p._showingGlobe()||p.getTerrain()||p.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=a.P.convert(d),this._update(),this}addClassName(d){return this._element.classList.add(d),this}removeClassName(d){return this._element.classList.remove(d),this}toggleClassName(d){return this._element.classList.toggle(d)}_onMove(d){const p=this._map;if(!p)return;const b=this._pointerdownPos,M=this._positionDelta;if(b&&M){if(!this._isDragging){const L=this._clickTolerance||p._clickTolerance;if(d.point.dist(b)_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(_.antialias&&a.f3(window)&&(_.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new A5(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies,null,null),_),this._repaint=!!_.repaint,this._interactive=_.interactive,this._minTileCacheSize=_.minTileCacheSize,this._maxTileCacheSize=_.maxTileCacheSize,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=_.crossSourceCollisions,this._collectResourceTiming=_.collectResourceTiming,this._language=this._parseLanguage(_.language),this._worldview=_.worldview,this._renderTaskQueue=new vp,this._domRenderTaskQueue=new vp,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.b2(),this._locale=Object.assign({},bp,_.locale),this._clickTolerance=_.clickTolerance,this._cooperativeGestures=_.cooperativeGestures,this._performanceMetricsCollection=_.performanceMetricsCollection,this._tessellationStep=_.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=_.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new _p(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=_.scaleFactor,this._requestManager=new ne(_.transformRequest,_.accessToken,_.testMode),this._silenceAuthErrors=!!_.testMode,this._contextCreateOptions=_.contextCreateOptions?Object.assign({},_.contextCreateOptions):{},typeof _.container=="string"){const p=document.getElementById(_.container);if(!p)throw new Error(`Container '${_.container.toString()}' not found.`);this._container=p}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(this._container.childNodes.length>0&&a.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),_.maxBounds&&this.setMaxBounds(_.maxBounds),this._spriteFormat=_.spriteFormat,a.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 lae(this,_),this._localFontFamily=_.localFontFamily,this._localIdeographFontFamily=_.localIdeographFontFamily,(_.style||!_.testMode)&&this.setStyle(_.style||a.e.DEFAULT_STYLE,{config:_.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),_.projection&&this.setProjection(_.projection),_.hash&&(this._hash=new f3(typeof _.hash=="string"&&_.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch});const p=_.bounds;p&&(this.resize(),this.fitBounds(p,Object.assign({},_.fitBoundsOptions,{duration:0})))}this.resize(),_.attributionControl&&this.addControl(new Mv({customAttribution:_.customAttribution})),this._logoControl=new Tv,this.addControl(this._logoControl,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",p=>{this._update(p.dataType==="style"),this.fire(new a.z(`${p.dataType}data`,p))}),this.on("dataloading",p=>{this.fire(new a.z(`${p.dataType}dataloading`,p))}),this._interactions=new kh(this)}_getMapId(){return this._mapId}addControl(_,d){if(d===void 0&&(d=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new a.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const p=_.onAdd(this);this._controls.push(_);const b=this._controlPositions[d];return d.indexOf("bottom")!==-1?b.insertBefore(p,b.firstChild):b.appendChild(p),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new a.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(_);return d>-1&&this._controls.splice(d,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(_){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const d=!this._moving;return d&&this.fire(new a.z("movestart",_)).fire(new a.z("move",_)),this.fire(new a.z("resize",_)),d&&this.fire(new a.z("moveend",_)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(_){return this.transform.setMaxBounds(a.aI.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(_){return this._scaleFactor=_,this.painter.scaleFactor=_,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(_){return _==="auto"?navigator.language:Array.isArray(_)?_.length===0?void 0:_.map(d=>d==="auto"?navigator.language:d):_}setLanguage(_){const d=this._parseLanguage(_);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const p of this._controls)p._setLanguage&&p._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(_){return this.style&&_!==this._worldview?(this._worldview=_,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(_){return this._lazyInitEmptyStyle(),_?typeof _=="string"&&(_={name:_}):_=null,this._useExplicitProjection=!!_,this._prioritizeAndUpdateProjection(_,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const _=this.transform,d=_.projection.name;let p;d==="globe"&&_.zoom>=a.cL?(_.setMercatorFromTransition(),p=!0):d==="mercator"&&_.zoom=a.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(_),this.style.applyProjectionUpdate();const b=this.transform.getProjection().name==="mercator"&&p!==this.transform.mercatorFromTransition;return(d||b)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(_,d){return this.transform.locationPoint3D(a.aT.convert(_),d)}unproject(_,d){return this.transform.pointLocation3D(a.P.convert(_),d)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(_,d,p){const b=M=>{let L=[];if(Array.isArray(d)){const O=d.filter(z=>this.getLayer(z));L=O.length?this.queryRenderedFeatures(M,{layers:O}):[]}else L=this.queryRenderedFeatures(M,{target:d});return L};if(_==="mouseenter"||_==="mouseover"){let M=!1;return{listener:p,targets:d,delegates:{mousemove:O=>{const z=b(O.point);z.length?M||(M=!0,p.call(this,new yd(_,this,O.originalEvent,{features:z}))):M=!1},mouseout:()=>{M=!1}}}}if(_==="mouseleave"||_==="mouseout"){let M=!1;return{listener:p,targets:d,delegates:{mousemove:z=>{b(z.point).length?M=!0:M&&(M=!1,p.call(this,new yd(_,this,z.originalEvent)))},mouseout:z=>{M&&(M=!1,p.call(this,new yd(_,this,z.originalEvent)))}}}}{const M=L=>{const O=b(L.point);O.length&&(L.features=O,p.call(this,L),delete L.features)};return{listener:p,targets:d,delegates:{[_]:M}}}}on(_,d,p){if(typeof d=="function"||p===void 0)return super.on(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._createDelegatedListener(_,d,p);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(b);for(const M in b.delegates)this.on(M,b.delegates[M]);return this}once(_,d,p){if(typeof d=="function"||p===void 0)return super.once(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._createDelegatedListener(_,d,p);for(const M in b.delegates)this.once(M,b.delegates[M]);return this}off(_,d,p){if(typeof d=="function"||p===void 0)return super.off(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const b=this._delegatedListeners?this._delegatedListeners[_]:void 0;return b&&(M=>{for(let L=0;L{if(p){const M=typeof p=="string"?p:p instanceof Error?p.message:p.error;a.w(`Unable to perform style diff: ${M}. Rebuilding the style from scratch.`),this._updateStyle(_,d)}else b&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(_,d))}_getUIString(_){const d=this._locale[_];if(d==null)throw new Error(`Missing UI string '${_}'`);return d}_updateStyle(_,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),_){const p=Object.assign({},d);d&&d.config&&(p.initialConfig=d.config,delete p.config),this.style=new Wu(this,p).load(_),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Wu(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():(a.w("There is no style added to the map."),!1)}_isValidId(_){return _==null?(this.fire(new a.y(new Error("IDs can't be empty."))),!1):!a.dr(_)||(this.fire(new a.y(new Error(`IDs can't contain special symbols: "${_}".`))),!1)}_isTargetValid(_){return"featuresetId"in _?this._isValidId("importId"in _?_.importId:_.featuresetId):"layerId"in _&&this._isValidId(_.layerId)}_areTargetsValid(_){if(Array.isArray(_)){for(const d of _)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(_)}addSource(_,d){return this._isValidId(_)?(this._lazyInitEmptyStyle(),this.style.addSource(_,d),this._update(!0)):this}isSourceLoaded(_){return!!this._isValidId(_)&&!!this.style&&this.style._isSourceCacheLoaded(_)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(_,d,p){this._lazyInitEmptyStyle(),this.style.addSourceType(_,d,p)}removeSource(_){return this._isValidId(_)?(this.style.removeSource(_),this._updateTerrain(),this._update(!0)):this}getSource(_){return this._isValidId(_)?this.style.getOwnSource(_):null}addImage(_,d,{pixelRatio:p=1,sdf:b=!1,stretchX:M,stretchY:L,content:O}={}){this._lazyInitEmptyStyle();const z=a.I.from(_);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:V,height:Y,data:Q}=a.o.getImageData(d);this.style.addImage(z,{data:new a.q({width:V,height:Y},Q),pixelRatio:p,stretchX:M,stretchY:L,content:O,sdf:b,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new a.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:V,height:Y}=d,Q=d;this.style.addImage(z,{data:new a.q({width:V,height:Y},new Uint8Array(Q.data)),pixelRatio:p,stretchX:M,stretchY:L,content:O,sdf:b,usvg:!1,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,_)}}updateImage(_,d){this._lazyInitEmptyStyle();const p=a.I.from(_),b=this.style.getImage(p);if(!b)return void this.fire(new a.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const M=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?a.o.getImageData(d):d,{width:L,height:O,data:z}=M;if(L===void 0||O===void 0)return void this.fire(new a.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(L!==(b.usvg?b.icon.usvg_tree.width:b.data.width)||O!==(b.usvg?b.icon.usvg_tree.height:b.data.height))return void this.fire(new a.y(new Error(`The width and height of the updated image (${L}, ${O}) must be that same as the previous version of the image (${b.data.width}, ${b.data.height})`)));const V=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;b.usvg?(b.data=new a.q({width:L,height:O},new Uint8Array(z)),b.usvg=!1,b.icon=void 0,Y=!0):b.data.replace(z,V),this.style.updateImage(p,b,Y)}hasImage(_){return _?!!this.style&&!!this.style.getImage(a.I.from(_)):(this.fire(new a.y(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(a.I.from(_))}loadImage(_,d){a.n(this._requestManager.transformRequest(_,a.R.Image),(p,b)=>{d(p,b instanceof HTMLImageElement?a.o.getImageData(b):b)})}listImages(){return this.style.listImages().map(_=>_.name)}addModel(_,d){this._lazyInitEmptyStyle(),this.style.addModel(_,d)}hasModel(_){return _?this.style.hasModel(_):(this.fire(new a.y(new Error("Missing required model id"))),!1)}removeModel(_){this.style.removeModel(_)}listModels(){return this.style.listModels()}addLayer(_,d){return this._isValidId(_.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(_,d),this._update(!0)):this}getSlot(_){const d=this.getLayer(_);return d&&d.slot||null}setSlot(_,d){return this.style.setSlot(_,d),this.style.mergeLayers(),this._update(!0)}addImport(_,d){return this.style.addImport(_,d).catch(p=>this.fire(new a.y(new Error("Failed to add import",p)))),this}updateImport(_,d){return typeof d!="string"&&d.id!==_?(this.removeImport(_),this.addImport(d)):(this.style.updateImport(_,d),this._update(!0))}removeImport(_){return this.style.removeImport(_),this}moveImport(_,d){return this.style.moveImport(_,d),this._update(!0)}moveLayer(_,d){return this._isValidId(_)?(this.style.moveLayer(_,d),this._update(!0)):this}removeLayer(_){return this._isValidId(_)?(this.style.removeLayer(_),this._update(!0)):this}getLayer(_){if(!this._isValidId(_))return null;const d=this.style.getOwnLayer(_);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(_,d,p){return this._isValidId(_)?(this.style.setLayerZoomRange(_,d,p),this._update(!0)):this}setFilter(_,d,p={}){return this._isValidId(_)?(this.style.setFilter(_,d,p),this._update(!0)):this}getFilter(_){return this._isValidId(_)?this.style.getFilter(_):null}setPaintProperty(_,d,p,b={}){return this._isValidId(_)?(this.style.setPaintProperty(_,d,p,b),this._update(!0)):this}getPaintProperty(_,d){return this._isValidId(_)?this.style.getPaintProperty(_,d):null}setLayoutProperty(_,d,p,b={}){return this._isValidId(_)?(this.style.setLayoutProperty(_,d,p,b),this._update(!0)):this}getLayoutProperty(_,d){return this._isValidId(_)?this.style.getLayoutProperty(_,d):null}setLayerProperty(_,d,p,b={}){return this._isValidId(_)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(_,d,p,b),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(_){return this.style.setGlyphsUrl(_),this._update(!0)}getSchema(_){return this.style.getSchema(_)}setSchema(_,d){return this.style.setSchema(_,d),this._update(!0)}getConfig(_){return this.style.getConfig(_)}setConfig(_,d){return this.style.setConfig(_,d),this._update(!0)}getConfigProperty(_,d){return this.style.getConfigProperty(_,d)}setConfigProperty(_,d,p){return this.style.setConfigProperty(_,d,p),this._update(!0)}getFeaturesetDescriptors(_){return this.style.getFeaturesetDescriptors(_)}setLights(_){if(this._lazyInitEmptyStyle(),_&&_.length===1&&_[0].type==="flat"){const d=_[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(_),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const _=this.style.getLights()||[];return _.length===0&&_.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),_}setLight(_,d={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:_}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(_){return this._lazyInitEmptyStyle(),!_&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(_),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(_){return this._lazyInitEmptyStyle(),this.style.setFog(_),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(_){return this._lazyInitEmptyStyle(),this.style.setSnow(_),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(_){return this._lazyInitEmptyStyle(),this.style.setRain(_),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(_){return this._lazyInitEmptyStyle(),this.style.setColorTheme(_),this._update(!0)}setImportColorTheme(_,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(_,d),this._update(!0)}setCamera(_){return this.style.setCamera(_),this._triggerCameraUpdate(_)}_triggerCameraUpdate(_){return this._update(this.transform.setOrthographicProjectionAtLowPitch(_["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(_){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.aT.convert(_),this.transform):0}setFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.setFeatureState(_,d),this._update())}removeFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.removeFeatureState(_,d),this._update())}getFeatureState(_){return _.source&&!this._isValidId(_.source)?null:this.style.getFeatureState(_)}_selectIndoorFloor(_){this.indoor.selectFloor(_)}_setIndoorActiveFloorsVisibility(_){this.indoor.setActiveFloorsVisibility(_)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Py),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const _=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let p,b,M,L=this._container;for(;L&&(!b||!M);){const O=window.getComputedStyle(L).transform;O&&O!=="none"&&(p=O.match(/matrix.*\((.+)\)/)[1].split(", "),p[0]&&p[0]!=="0"&&p[0]!=="1"&&(b=p[0]),p[3]&&p[3]!=="0"&&p[3]!=="1"&&(M=p[3])),L=L.parentElement}this._containerWidth=b?Math.abs(_/b):_,this._containerHeight=M?Math.abs(d/M):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.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 UI(this.style),this.on("load",()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}),this.on("idle",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})}))}_setupContainer(){const _=this._container;_.classList.add("mapboxgl-map"),(this._missingCSSCanary=S("div","mapboxgl-canary",_)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=S("div","mapboxgl-canvas-container",_);this._canvas=S("canvas","mapboxgl-canvas",d),this._interactive&&(d.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const p=this._controlContainer=S("div","mapboxgl-control-container",_),b=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(M=>{b[M]=S("div",`mapboxgl-ctrl-${M}`,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,d){const p=a.o.devicePixelRatio||1;this._canvas.width=p*Math.ceil(_),this._canvas.height=p*Math.ceil(d),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${d}px`}_addMarker(_){this._markers.push(_)}_removeMarker(_){const d=this._markers.indexOf(_);d!==-1&&this._markers.splice(d,1)}_addPopup(_){this._popups.push(_)}_removePopup(_){const d=this._popups.indexOf(_);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const _=Object.assign({},C.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",_);d?(Ve(d,!0),this.painter=new tN(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",p=>{p.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),a.k.testSupport(d)):this.fire(new a.y(new Error("Failed to initialize WebGL")))}_contextLost(_){_.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.z("webglcontextlost",{originalEvent:_}))}_contextRestored(_){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new a.z("webglcontextrestored",{originalEvent:_}))}_onMapScroll(_){if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(_){return this.style?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_requestDomTask(_){!this.loaded()||this.loaded()&&!this.isMoving()?_():this._domRenderTaskQueue.add(_)}_render(_){let d;this.fire(new a.z("renderstart")),++this._frameId;const p=this.painter.context.extTimerQuery,b=a.o.now(),M=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=M.createQuery(),M.beginQuery(p.TIME_ELAPSED_EXT,d)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(_),this._domRenderTaskQueue.run(_),this._removed)return;this._updateProjectionTransition();const L=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Y=this.transform.zoom,Q=this.transform.pitch,ce=a.o.now(),le=new a.ac(Y,{now:ce,fadeDuration:L,pitch:Q,transition:this.style.transition,worldview:this._worldview});this.style.update(le)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let O=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),O=this._updateAverageElevation(b),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):O=this._updateAverageElevation(b);const z=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,L,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),z&&(this._placementDirty=z.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:L,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 a.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(m.load),this.fire(new a.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),d){const Y=a.o.now()-b;M.endQuery(p.TIME_ELAPSED_EXT),setTimeout(()=>{const Q=M.getQueryParameter(d,M.QUERY_RESULT)/1e6;M.deleteQuery(d),this.fire(new a.z("gpu-timing-frame",{cpuTime:Y,gpuTime:Q}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const Q=this.painter.queryGpuTimers(Y);this.fire(new a.z("gpu-timing-layer",{layerTimes:Q}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const Q=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new a.z("gpu-timing-deferred-render",{gpuTime:Q}))},50)}const V=this._sourcesDirty||this._styleDirty||this._placementDirty||O;if(V||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(O=this._updateAverageElevation(b,!0)),O)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new a.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Q=this._calculateSpeedIndex();this.fire(new a.z("speedindexcompleted",{speedIndex:Q})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||V||(this._fullyLoaded=!0,x.mark(m.fullLoad),this._performanceMetricsCollection&&Ye(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(_){for(const d of this._markers)_&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!_||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(_,d=!1){const p=M=>(this.transform.averageElevation=M,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&p(0);const b=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(b||(d||_-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(_)){const M=this.transform.averageElevation;let L=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(L)?L=0:this._averageElevationLastSampledAt=_;const O=Math.abs(M-L);if(O>1){if(this._isInitialLoad||b)return this._averageElevation.jumpTo(L),p(L);this._averageElevation.easeTo(L,_,300)}else if(O>1e-4)return this._averageElevation.jumpTo(L),p(L)}return!!this._averageElevation.isEasing(_)&&p(this._averageElevation.getValue(_))}_authenticate(){ft(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,_=>{if(_&&(_.message===je||_.status===401)){const d=this.painter.context.gl;Ve(d,!1),this._logoControl instanceof Tv&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Te(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Le(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Fe(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Je(this._requestManager._customAccessToken)}_updateTerrain(){const _=this._isDragging();this.painter.updateTerrain(this.style,_)}_calculateSpeedIndex(){const _=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const p=this.painter.context.gl,b=p.createFramebuffer();function M(L){p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,L,0);const O=new Uint8Array(p.drawingBufferWidth*p.drawingBufferHeight*4);return p.readPixels(0,0,p.drawingBufferWidth,p.drawingBufferHeight,p.RGBA,p.UNSIGNED_BYTE,O),O}return p.bindFramebuffer(p.FRAMEBUFFER,b),this._canvasPixelComparison(M(_),d.canvasCopies.map(M),d.timeStamps)}_canvasPixelComparison(_,d,p){let b=p[1]-p[0];const M=_.length/4;for(let L=0;L{const p=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,p&&this._render(d)}))}_preloadTiles(_){const d=this.style?this.style.getSourceCaches():[];return a.bw(d,(p,b)=>p._preloadTiles(_,b),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(_){this._trackResize&&this.resize({originalEvent:_})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(_){this._showParseStatus!==_&&(this._showParseStatus=_,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(_){this._showTerrainWireframe!==_&&(this._showTerrainWireframe=_,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(_){this._showLayers2DWireframe!==_&&(this._showLayers2DWireframe=_,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(_){this._showLayers3DWireframe!==_&&(this._showLayers3DWireframe=_,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(_){this._speedIndexTiming!==_&&(this._speedIndexTiming=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,this.style&&_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(_){this._showTileAABBs!==_&&(this._showTileAABBs=_,_&&this._update())}_setCacheLimits(_,d){a.f4(_,d)}get version(){return h}},NavigationControl:class{constructor(_={}){this.options=Object.assign({},uae,_),this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(a.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",d=>{this._map&&this._map.zoomIn({},{originalEvent:d})}),S("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",d=>{this._map&&this._map.zoomOut({},{originalEvent:d})}),S("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",d=>{const p=this._map;p&&(this.options.visualizePitch?p.resetNorthPitch({},{originalEvent:d}):p.resetNorth({},{originalEvent:d}))}),this._compassIcon=S("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const _=this._map;if(!_)return;const d=_.getZoom(),p=d===_.getMaxZoom(),b=d===_.getMinZoom();this._zoomInButton.disabled=p,this._zoomOutButton.disabled=b,this._zoomInButton.setAttribute("aria-disabled",p.toString()),this._zoomOutButton.setAttribute("aria-disabled",b.toString())}_rotateCompassArrow(){const _=this._map;if(!_)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(_.transform.pitch*(Math.PI/180)),.5)}) rotateX(${_.transform.pitch}deg) rotateZ(${_.transform.angle*(180/Math.PI)}deg)`:`rotate(${_.transform.angle*(180/Math.PI)}deg)`;_._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),_.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&_.on("pitch",this._rotateCompassArrow),_.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new hae(_,this._compass,this.options.visualizePitch)),this._container}onRemove(){const _=this._map;_&&(this._container.remove(),this.options.showZoom&&_.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&_.off("pitch",this._rotateCompassArrow),_.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(_,d){const p=S("button",_,this._container);return p.type="button",p.addEventListener("click",d),p}_setButtonTitle(_,d){if(!this._map)return;const p=this._map._getUIString(`NavigationControl.${d}`);_.setAttribute("aria-label",p),_.firstElementChild&&_.firstElementChild.setAttribute("title",p)}},GeolocateControl:class extends a.E{constructor(_={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},fae,_),a.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=rN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(_){return this._map=_,this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(_){const d=(p=!!this.options.geolocation)=>{this._supportsGeolocation=p,_(p)};this._supportsGeolocation!==void 0?_(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(p=>d(p.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(_){const d=this._map.getMaxBounds(),p=_.coords;return!!d&&(p.longituded.getEast()||p.latituded.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(_){if(this._map){if(this._isOutOfMapMaxBounds(_))return this._setErrorState(),this.fire(new a.z("outofmaxbounds",_)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=_,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(_),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(_),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("geolocate",Object.assign({coords:_.coords,timestamp:_.timestamp},_.toJSON?{toJSON:_.toJSON.bind(_)}:{}))),this._finish()}}_updateCamera(_){const d=new a.aT(_.coords.longitude,_.coords.latitude),p=_.coords.accuracy,b=this._map.getBearing(),M=Object.assign({bearing:b},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(p),M,{geolocateSource:!0})}_updateMarker(_){if(_){const d=new a.aT(_.coords.longitude,_.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=_.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const _=this._map.transform,d=a.cf(1,_._center.lat)*_.worldSize,p=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(_){if(this._map){if(this.options.trackUserLocation)if(_.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(_.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("error",_)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(_){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=S("button","mapboxgl-ctrl-geolocate",this._container),S("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",_===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=S("div","mapboxgl-user-location"),this._dotElement.appendChild(S("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(S("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new mN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=S("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new mN({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.z("trackuserlocationend")))})}}_onDeviceOrientation(_){this._userLocationDotMarker&&(_.webkitCompassHeading?this._heading=_.webkitCompassHeading:_.absolute===!0&&(this._heading=-1*_.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.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 a.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 a.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 a.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(_={maximumAge:6e5,timeout:0},this._noTimeout=!0):(_=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,_),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const _=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(d=>{d==="granted"&&_()}).catch(console.error):_()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Mv,ScaleControl:class{constructor(_={}){this.options=Object.assign({},Ly,_),a.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const _=this.options.maxWidth||100,d=this._map,p=d._containerHeight/2,b=d._containerWidth/2-_/2,M=d.unproject([b,p]),L=d.unproject([b+_,p]),O=M.distanceTo(L);if(this.options.unit==="imperial"){const z=3.2808*O;z>5280?this._setScale(_,z/5280,"mile"):this._setScale(_,z,"foot")}else this.options.unit==="nautical"?this._setScale(_,O/1852,"nautical-mile"):O>=1e3?this._setScale(_,O/1e3,"kilometer"):this._setScale(_,O,"meter")}_setScale(_,d,p){this._map._requestDomTask(()=>{const b=function(L){const O=Math.pow(10,`${Math.floor(L)}`.length-1);let z=L/O;return z=z>=10?10:z>=5?5:z>=3?3:z>=2?2:z>=1?1:function(V){const Y=Math.pow(10,Math.ceil(-Math.log(V)/Math.LN10));return Math.round(V*Y)/Y}(z),O*z}(d),M=b/d;this._container.innerHTML=p!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:p}).format(b):`${b} ${C3[p]}`,this._container.style.width=_*M+"px"})}onAdd(_){return this._map=_,this._language=_.getLanguage(),this._container=S("div","mapboxgl-ctrl mapboxgl-ctrl-scale",_.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(_){this._language=_,this._update()}setUnit(_){this.options.unit=_,this._update()}},FullscreenControl:class{constructor(_={}){this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:a.w("Full screen control 'container' must be a DOM element.")),a.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=S("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const _=this._fullscreenButton=S("button","mapboxgl-ctrl-fullscreen",this._controlContainer);S("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",_)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Py,Popup:class extends a.E{constructor(_){super(),this.options=Object.assign(Object.create(Ku),_),this._altitude=this.options.altitude,a.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(_&&_.className?_.className.trim().split(/\s+/):[])}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&_.on("preclick",this._onClose),this.options.closeOnMove&&_.on("move",this._onClose),_.on("remove",this.remove),this._update(),_._addPopup(this),this._focusFirstElement(),this._trackPointer?(_.on("mousemove",this._onMouseEvent),_.on("mouseup",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")):_.on("move",this._update),this.fire(new a.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const _=this._map;return _&&(_.off("move",this._update),_.off("move",this._onClose),_.off("preclick",this._onClose),_.off("click",this._onClose),_.off("remove",this.remove),_.off("mousemove",this._onMouseEvent),_.off("mouseup",this._onMouseEvent),_.off("drag",this._onMouseEvent),_._canvasContainer&&_._canvasContainer.classList.remove("mapboxgl-track-pointer"),_._removePopup(this),this._map=void 0),this.fire(new a.z("close")),this}getLngLat(){return this._lngLat}setLngLat(_){this._lngLat=a.aT.convert(_),this._pos=null,this._trackPointer=!1,this._update();const d=this._map;return d&&(d.on("move",this._update),d.off("mousemove",this._onMouseEvent),d._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(_){return this._altitude=_,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const _=this._map;return _&&(_.off("move",this._update),_.on("mousemove",this._onMouseEvent),_.on("drag",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const d=document.createDocumentFragment(),p=document.createElement("body");let b;for(p.innerHTML=_;b=p.firstChild,b;)d.appendChild(b);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=S("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(_),this.options.closeButton){const p=this._closeButton=S("button","mapboxgl-popup-close-button",d);p.type="button",p.setAttribute("aria-label","Close popup"),p.innerHTML='',p.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(_){return this._classList.add(_),this._updateClassList(),this}removeClassName(_){return this._classList.delete(_),this._updateClassList(),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){let d;return this._classList.delete(_)?d=!1:(this._classList.add(_),d=!0),this._updateClassList(),d}_onMouseEvent(_){this._update(_.point)}_getAnchor(_){if(this.options.anchor)return this.options.anchor;const d=this._map,p=this._container,b=this._pos;if(!d||!p||!b)return"bottom";const M=p.offsetWidth,L=p.offsetHeight,O=b.xd.transform.width-M/2;if(b.y+_d.transform.height-L){if(O)return"bottom-left";if(z)return"bottom-right"}return O?"left":z?"right":"bottom"}_updateClassList(){const _=this._container;if(!_)return;const d=[...this._classList];d.push("mapboxgl-popup"),this._anchor&&d.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&d.push("mapboxgl-popup-track-pointer"),_.className=d.join(" ")}_update(_){const d=this._map,p=this._content;if(!d||!this._lngLat&&!this._trackPointer||!p)return;let b=this._container;if(b||(b=this._container=S("div","mapboxgl-popup",d.getContainer()),this._tip=S("div","mapboxgl-popup-tip",b),b.appendChild(p)),this.options.maxWidth&&b.style.maxWidth!==this.options.maxWidth&&(b.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=S3(this._lngLat,this._pos,d.transform)),!this._trackPointer||_){const M=this._pos=this._trackPointer&&_ instanceof a.P?_:d.project(this._lngLat,this._altitude),L=Qg(this.options.offset),O=this._anchor=this._getAnchor(L.y),z=Qg(this.options.offset,O),V=M.add(z).round();d._requestDomTask(()=>{this._container&&O&&(this._container.style.transform=`${dc[O]} translate(${V.x}px,${V.y}px)`)})}if(!this._marker&&d._showingGlobe()){const M=a.f5(d.transform,this._lngLat)?0:1;this._setOpacity(M)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(Zu);_&&_.focus()}_onClose(){this.remove()}_setOpacity(_){this._container&&(this._container.style.opacity=`${_}`),this._content&&(this._content.style.pointerEvents=_?"auto":"none")}},Marker:mN,Style:Wu,LngLat:a.aT,LngLatBounds:a.aI,Point:a.P,MercatorCoordinate:a.ae,FreeCameraOptions:Gc,Evented:a.E,config:a.e,prewarm:a.f9,clearPrewarmedResources:a.f8,get accessToken(){return a.e.ACCESS_TOKEN},set accessToken(_){a.e.ACCESS_TOKEN=_},get baseApiUrl(){return a.e.API_URL},set baseApiUrl(_){a.e.API_URL=_},get workerCount(){return a.fi.workerCount},set workerCount(_){a.fi.workerCount=_},get maxParallelImageRequests(){return a.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(_){a.e.MAX_PARALLEL_IMAGE_REQUESTS=_},clearStorage(_){a.fh(_)},get workerUrl(){return a.fg.workerUrl},set workerUrl(_){a.fg.workerUrl=_},get workerClass(){return a.fg.workerClass},set workerClass(_){a.fg.workerClass=_},get workerParams(){return a.fg.workerParams},set workerParams(_){a.fg.workerParams=_},get dracoUrl(){return a.ff()},set dracoUrl(_){a.fe(_)},get meshoptUrl(){return a.fd()},set meshoptUrl(_){a.fc(_)},setNow:a.o.setNow,restoreNow:a.o.restoreNow}});var c=i;return c})})(mze);var Jwt=mze.exports;const TL=Da(Jwt);function ejt(){const t=ts(),{isAdmin:e}=zr(),n=P.useRef(null),s=P.useRef(null),i=P.useRef([]),o=dze(),{data:c}=lze(),a=hze(),[h,m]=P.useState(""),[x,v]=P.useState(""),[w,k]=P.useState(!0),[C,S]=P.useState(null),[T,I]=P.useState(null),[A,D]=P.useState(!1),[$,F]=P.useState({popby_item_id:"",notes:""}),q=o.filter(re=>re.address||re.city&&re.state);P.useEffect(()=>{(async()=>{k(!0);try{const{data:he}=await ee.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();he!=null&&he.value&&m(he.value)}catch(he){console.error("Error fetching mapbox token:",he)}k(!1)})()},[]),P.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(re=>{S([re.coords.longitude,re.coords.latitude])},re=>{console.log("Could not get location:",re)})},[]),P.useEffect(()=>{if(!(!n.current||!h||s.current))return TL.accessToken=h,s.current=new TL.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:C?12:4,center:C||[-98.5795,39.8283]}),s.current.addControl(new TL.NavigationControl,"top-right"),()=>{var re;(re=s.current)==null||re.remove(),s.current=null}},[h,C]),P.useEffect(()=>{!s.current||!h||(i.current.forEach(re=>re.remove()),i.current=[],q.forEach(async re=>{var ue;const he=[re.address,re.city,re.state,re.zip].filter(Boolean).join(", ");if(he)try{const ne=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(he)}.json?access_token=${h}`)).json();if(ne.features&&ne.features.length>0){const[ye,ie]=ne.features[0].center,me=document.createElement("div");me.className="cursor-pointer",me.innerHTML=`
${re.first_name[0]}${((ue=re.last_name)==null?void 0:ue[0])||""}
${re.isDue?'
':""}
`;const fe=new TL.Marker(me).setLngLat([ye,ie]).addTo(s.current);me.addEventListener("click",()=>{I(re)}),i.current.push(fe)}}catch(je){console.error("Geocoding error for",re.first_name,je)}}))},[q,h]);const W=()=>{C&&s.current?s.current.flyTo({center:C,zoom:13}):Yi({title:"Location not available",description:"Please enable location services",variant:"destructive"})},K=async()=>{T&&(await a.mutateAsync({contact_id:T.id,popby_item_id:$.popby_item_id||void 0,notes:$.notes||void 0,latitude:C==null?void 0:C[1],longitude:C==null?void 0:C[0]}),D(!1),I(null),F({popby_item_id:"",notes:""}))},Z=async()=>{if(x.trim())try{await ee.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),m(x.trim()),Yi({title:"Mapbox token saved!"})}catch{Yi({title:"Error saving token",variant:"destructive"})}};return w?r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):h?r.jsx(Dr,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(te,{variant:"ghost",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(te,{onClick:W,children:[r.jsx(CT,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),r.jsx("span",{children:"Up to date"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),r.jsx("span",{children:"Due for popby"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg"}),q.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(Ul,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),T&&r.jsx(Ze,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[T.first_name," ",T.last_name]}),T.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.city,", ",T.state]})]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>I(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[T.isDue?r.jsxs(Ft,{variant:"destructive",children:[T.daysOverdue,"+ days overdue"]}):r.jsx(Ft,{variant:"secondary",children:"Up to date"}),T.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",un(new Date(T.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[T.phone&&r.jsx(te,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${T.phone}`,children:[r.jsx(Ma,{className:"h-4 w-4 mr-1"}),"Call"]})}),T.address&&r.jsxs(te,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const re=[T.address,T.city,T.state,T.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(re)}`,"_blank")},children:[r.jsx(IT,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(te,{size:"sm",className:"flex-1",onClick:()=>D(!0),children:[r.jsx(Ua,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Ur,{open:A,onOpenChange:D,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Log Popby for ",T==null?void 0:T.first_name," ",T==null?void 0:T.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Popby Item (optional)"}),r.jsxs(_n,{value:$.popby_item_id,onValueChange:re=>F(he=>({...he,popby_item_id:re})),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select a popby item..."})}),r.jsx(vn,{children:c==null?void 0:c.map(re=>r.jsx(tr,{value:re.id,children:re.name},re.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Notes (optional)"}),r.jsx(gs,{placeholder:"Any notes about this popby...",value:$.notes,onChange:re=>F(he=>({...he,notes:re.target.value}))})]}),C&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(cl,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>D(!1),children:"Cancel"}),r.jsxs(te,{onClick:K,disabled:a.isPending,children:[r.jsx(Ba,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):e?r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(cl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Mapbox Public Token"}),r.jsx(xt,{placeholder:"pk.eyJ1I...",value:x,onChange:re=>v(re.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(te,{onClick:Z,className:"w-full",children:"Save Token"}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Ul,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const tjt=s5({property_address:ec().min(1,"Property address is required"),city:ec().optional(),state:ec().optional(),zip:ec().optional(),transaction_type:e6e(["buyer","seller"]),close_date:ec().min(1,"Close date is required"),sale_price:YT().min(0,"Sale price must be positive"),commission_amount:YT().optional(),lead_source_id:ec().optional(),client_type_id:ec().optional(),contact_id:ec().optional(),notes:ec().optional(),is_win:pit()});function xze({open:t,onOpenChange:e,transaction:n}){const[s,i]=P.useState(!1),[o,c]=P.useState(""),[a,h]=P.useState(!1),[m,x]=P.useState(""),v=fse(),w=sft(),{data:k}=hse(),{data:C}=Ig(),{data:S}=vm(),T=GOe(),I=nft(),{data:A}=pse(),D=(A==null?void 0:A.show_commission)??!0,$=ese({resolver:tse(tjt),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}});P.useEffect(()=>{n?$.reset({property_address:n.property_address,city:n.city||"",state:n.state||"",zip:n.zip||"",transaction_type:n.transaction_type,close_date:n.close_date,sale_price:Number(n.sale_price),commission_amount:n.commission_amount?Number(n.commission_amount):void 0,lead_source_id:n.lead_source_id||void 0,client_type_id:n.client_type_id||void 0,contact_id:n.contact_id||void 0,notes:n.notes||"",is_win:n.is_win}):$.reset({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1})},[n,$]);const F=async Z=>{const re={property_address:Z.property_address,transaction_type:Z.transaction_type,close_date:Z.close_date,sale_price:Z.sale_price,is_win:Z.is_win,commission_amount:Z.commission_amount||null,lead_source_id:Z.lead_source_id||null,client_type_id:Z.client_type_id||null,contact_id:Z.contact_id||null,city:Z.city||null,state:Z.state||null,zip:Z.zip||null,notes:Z.notes||null};n?await w.mutateAsync({id:n.id,...re}):await v.mutateAsync(re),e(!1)},q=async()=>{if(!o.trim())return;const[Z,...re]=o.trim().split(" "),he=re.join(" ")||null,ue=await T.mutateAsync({first_name:Z,last_name:he,tagIds:[]});ue&&($.setValue("contact_id",ue.id),c(""),h(!1),i(!1))},W=async()=>{if(!m.trim())return;const Z=await I.mutateAsync(m.trim());Z&&($.setValue("lead_source_id",Z.id),x(""))},K=S==null?void 0:S.find(Z=>Z.id===$.watch("contact_id"));return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(_l,{className:"max-h-[70vh] pr-4",children:r.jsx(rse,{...$,children:r.jsxs("form",{onSubmit:$.handleSubmit(F),className:"space-y-4",children:[r.jsx(kl,{control:$.control,name:"property_address",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Property Address *"}),r.jsx(gl,{children:r.jsx(xt,{placeholder:"123 Main St",...Z})}),r.jsx(yu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(kl,{control:$.control,name:"city",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"City"}),r.jsx(gl,{children:r.jsx(xt,{placeholder:"City",...Z})})]})}),r.jsx(kl,{control:$.control,name:"state",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"State"}),r.jsx(gl,{children:r.jsx(xt,{placeholder:"TX",...Z})})]})}),r.jsx(kl,{control:$.control,name:"zip",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Zip"}),r.jsx(gl,{children:r.jsx(xt,{placeholder:"75001",...Z})})]})})]}),r.jsx(kl,{control:$.control,name:"transaction_type",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Transaction Type *"}),r.jsxs(_n,{onValueChange:Z.onChange,value:Z.value,children:[r.jsx(gl,{children:r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select type"})})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"buyer",children:"Buyer"}),r.jsx(tr,{value:"seller",children:"Seller"})]})]}),r.jsx(yu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(kl,{control:$.control,name:"close_date",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Close Date *"}),r.jsx(gl,{children:r.jsx(xt,{type:"date",...Z})}),r.jsx(yu,{})]})}),r.jsx(kl,{control:$.control,name:"sale_price",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Sale Price *"}),r.jsx(gl,{children:r.jsx(xt,{type:"number",placeholder:"0",...Z,onChange:re=>Z.onChange(Number(re.target.value))})}),r.jsx(yu,{})]})})]}),D&&r.jsx(kl,{control:$.control,name:"commission_amount",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Commission"}),r.jsx(gl,{children:r.jsx(xt,{type:"number",placeholder:"0",...Z,value:Z.value??"",onChange:re=>Z.onChange(re.target.value?Number(re.target.value):void 0)})})]})}),r.jsx(kl,{control:$.control,name:"lead_source_id",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Lead Source"}),r.jsxs(_n,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(gl,{children:r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select source"})})}),r.jsx(vn,{children:k==null?void 0:k.map(re=>r.jsx(tr,{value:re.id,children:re.name},re.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{placeholder:"Add custom source...",value:m,onChange:Z=>x(Z.target.value),className:"flex-1"}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:W,disabled:!m.trim(),children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsx(kl,{control:$.control,name:"client_type_id",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Client Type"}),r.jsxs(_n,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(gl,{children:r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select client type"})})}),r.jsx(vn,{children:C==null?void 0:C.map(re=>r.jsx(tr,{value:re.id,children:re.name},re.id))})]})]})}),r.jsx(kl,{control:$.control,name:"contact_id",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Client Contact"}),r.jsxs(Jh,{open:s,onOpenChange:i,children:[r.jsx(ef,{asChild:!0,children:r.jsx(gl,{children:r.jsxs(te,{variant:"outline",role:"combobox",className:$t("w-full justify-between",!Z.value&&"text-muted-foreground"),children:[K?`${K.first_name} ${K.last_name||""}`.trim():"Select contact",r.jsx(Zw,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(gh,{className:"w-full p-0",align:"start",children:[r.jsxs(Mj,{children:[r.jsx(Tj,{placeholder:"Search contacts..."}),r.jsxs(Aj,{children:[r.jsx(Ej,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!a&&r.jsxs(te,{variant:"outline",size:"sm",className:"w-full",onClick:()=>h(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(Ij,{children:S==null?void 0:S.map(re=>r.jsxs(Pj,{value:`${re.first_name} ${re.last_name||""}`,onSelect:()=>{Z.onChange(re.id),i(!1)},children:[r.jsx($a,{className:$t("mr-2 h-4 w-4",re.id===Z.value?"opacity-100":"opacity-0")}),re.first_name," ",re.last_name||""]},re.id))})]})]}),a&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(xt,{placeholder:"Enter contact name...",value:o,onChange:re=>c(re.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{size:"sm",onClick:q,disabled:!o.trim()||T.isPending,children:"Add Contact"}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>{h(!1),c("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(kl,{control:$.control,name:"notes",render:({field:Z})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Notes"}),r.jsx(gl,{children:r.jsx(gs,{placeholder:"Any notes about this transaction...",...Z})})]})}),r.jsx(kl,{control:$.control,name:"is_win",render:({field:Z})=>r.jsxs(pl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(ml,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(gl,{children:r.jsx(Js,{checked:Z.value,onCheckedChange:Z.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:v.isPending||w.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function yze({transactions:t,showCommission:e,isLoading:n}){const[s,i]=P.useState(null),[o,c]=P.useState(null),[a,h]=P.useState(""),[m,x]=P.useState("all"),[v,w]=P.useState("all"),[k,C]=P.useState("all"),[S,T]=P.useState(!1),I=ift(),A=fse(),{data:D}=hse(),{data:$}=Ig(),F=SI(),q=Z=>{const{id:re,created_at:he,updated_at:ue,lead_source:je,client_type:ne,contact:ye,...ie}=Z;A.mutate(ie)},W=()=>{o&&(I.mutate(o),c(null))},K=t.filter(Z=>{var ye,ie,me,fe;const re=a===""||Z.property_address.toLowerCase().includes(a.toLowerCase())||((ie=(ye=Z.contact)==null?void 0:ye.first_name)==null?void 0:ie.toLowerCase().includes(a.toLowerCase()))||((fe=(me=Z.contact)==null?void 0:me.last_name)==null?void 0:fe.toLowerCase().includes(a.toLowerCase())),he=m==="all"||Z.transaction_type===m,ue=v==="all"||Z.lead_source_id===v,je=k==="all"||Z.client_type_id===k,ne=!S||Z.is_win;return re&&he&&ue&&je&&ne});return n?r.jsx(Ze,{children:r.jsx(et,{className:"p-6 space-y-4",children:[1,2,3].map(Z=>r.jsx(Kr,{className:"h-16 w-full"},Z))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(Xt,{children:["Transactions (",K.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search...",value:a,onChange:Z=>h(Z.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(_n,{value:m,onValueChange:x,children:[r.jsx(yn,{className:"w-[100px]",children:r.jsx(bn,{placeholder:"Type"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Types"}),r.jsx(tr,{value:"buyer",children:"Buyer"}),r.jsx(tr,{value:"seller",children:"Seller"})]})]}),r.jsxs(_n,{value:v,onValueChange:w,children:[r.jsx(yn,{className:"w-[130px]",children:r.jsx(bn,{placeholder:"Lead Source"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Sources"}),D==null?void 0:D.map(Z=>r.jsx(tr,{value:Z.id,children:Z.name},Z.id))]})]}),r.jsxs(te,{variant:S?"default":"outline",size:"sm",onClick:()=>T(!S),children:[r.jsx(Ml,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(et,{children:K.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):F?r.jsx("div",{className:"space-y-3",children:K.map(Z=>r.jsxs(Ze,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium truncate",children:Z.property_address}),Z.is_win&&r.jsx(Ml,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]}),r.jsx(Ft,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Close Date: "}),Fbe(Z.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),Nd(Z.sale_price)]}),e&&Z.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),Nd(Z.commission_amount)]}),Z.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),Z.lead_source.name]}),Z.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),Z.contact.first_name," ",Z.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>i(Z),children:r.jsx(Jl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>q(Z),children:r.jsx(Vl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>c(Z.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})]},Z.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Property"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Close Date"}),r.jsx(Mt,{children:"Sale Price"}),e&&r.jsx(Mt,{children:"Commission"}),r.jsx(Mt,{children:"Lead Source"}),r.jsx(Mt,{children:"Client"}),r.jsx(Mt,{className:"w-[50px]"})]})}),r.jsx(Vs,{children:K.map(Z=>{var re;return r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_win&&r.jsx(Ml,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Z.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]})]})}),r.jsx(yt,{children:r.jsx(Ft,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})}),r.jsx(yt,{children:Fbe(Z.close_date)}),r.jsx(yt,{children:Nd(Z.sale_price)}),e&&r.jsx(yt,{children:Z.commission_amount?Nd(Z.commission_amount):"-"}),r.jsx(yt,{children:((re=Z.lead_source)==null?void 0:re.name)||"-"}),r.jsx(yt,{children:Z.contact?`${Z.contact.first_name} ${Z.contact.last_name||""}`.trim():"-"}),r.jsx(yt,{children:r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(yx,{className:"h-4 w-4"})})}),r.jsxs(ep,{align:"end",children:[r.jsxs(co,{onClick:()=>i(Z),children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(co,{onClick:()=>q(Z),children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(co,{onClick:()=>c(Z.id),className:"text-destructive",children:[r.jsx(es,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},Z.id)})})]})})})]}),r.jsx(xze,{open:!!s,onOpenChange:Z=>!Z&&i(null),transaction:s||void 0}),r.jsx(oh,{open:!!o,onOpenChange:Z=>!Z&&c(null),children:r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Delete Transaction?"}),r.jsx(ju,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:W,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function vze({goals:t,stats:e,year:n,showCommission:s}){const i=new Date().getMonth()+1,o=new Date().getFullYear()===n?i:12,c=12-o,a=(w,k)=>{if(!k||k===0)return null;const C=Math.min(w/k*100,100),S=Math.max(k-w,0),T=c>0?S/c:0,I=o/12*100,A=C>=I?"ahead":C>=I*.8?"on-track":"behind";return{percent:C,remaining:S,pace:T,status:A}},h=a(e.totalTransactions,t.transactions_goal),m=a(e.totalVolume,t.volume_goal),x=s?a(e.totalCommission,t.gci_goal):null,v=w=>{switch(w){case"ahead":return r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(qf,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Ft,{variant:"secondary",children:[r.jsx(s1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Ft,{variant:"destructive",children:[r.jsx(c1,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!t.transactions_goal&&!t.volume_goal&&!t.gci_goal?null:r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rx,{className:"h-5 w-5 text-primary"}),r.jsxs(Xt,{children:[n," Goals Progress"]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[t.transactions_goal&&h&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),v(h.status)]}),r.jsx(Bc,{value:h.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[e.totalTransactions," of ",t.transactions_goal]}),r.jsxs("span",{children:[Math.round(h.percent),"%"]})]}),h.remaining>0&&c>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(h.pace),"/month to hit goal"]})]}),t.volume_goal&&m&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Volume"}),v(m.status)]}),r.jsx(Bc,{value:m.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Nd(e.totalVolume,!0)," of ",Nd(t.volume_goal,!0)]}),r.jsxs("span",{children:[Math.round(m.percent),"%"]})]}),m.remaining>0&&c>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Nd(m.pace,!0),"/month"]})]}),s&&t.gci_goal&&x&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"GCI"}),v(x.status)]}),r.jsx(Bc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Nd(e.totalCommission,!0)," of ",Nd(t.gci_goal,!0)]}),r.jsxs("span",{children:[Math.round(x.percent),"%"]})]}),x.remaining>0&&c>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Nd(x.pace,!0),"/month"]})]})]})})]})}var rjt=Array.isArray,yh=rjt,njt=typeof wx=="object"&&wx&&wx.Object===Object&&wx,_ze=njt,sjt=_ze,ijt=typeof self=="object"&&self&&self.Object===Object&&self,ajt=sjt||ijt||Function("return this")(),Pg=ajt,ojt=Pg,ljt=ojt.Symbol,CI=ljt,tSe=CI,bze=Object.prototype,cjt=bze.hasOwnProperty,djt=bze.toString,FM=tSe?tSe.toStringTag:void 0;function ujt(t){var e=cjt.call(t,FM),n=t[FM];try{t[FM]=void 0;var s=!0}catch{}var i=djt.call(t);return s&&(e?t[FM]=n:delete t[FM]),i}var hjt=ujt,fjt=Object.prototype,pjt=fjt.toString;function mjt(t){return pjt.call(t)}var gjt=mjt,rSe=CI,xjt=hjt,yjt=gjt,vjt="[object Null]",_jt="[object Undefined]",nSe=rSe?rSe.toStringTag:void 0;function bjt(t){return t==null?t===void 0?_jt:vjt:nSe&&nSe in Object(t)?xjt(t):yjt(t)}var ay=bjt;function wjt(t){return t!=null&&typeof t=="object"}var oy=wjt,jjt=ay,kjt=oy,Njt="[object Symbol]";function Sjt(t){return typeof t=="symbol"||kjt(t)&&jjt(t)==Njt}var c5=Sjt,Cjt=yh,Mjt=c5,Tjt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ajt=/^\w*$/;function Ejt(t,e){if(Cjt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Mjt(t)?!0:Ajt.test(t)||!Tjt.test(t)||e!=null&&t in Object(e)}var uye=Ejt;function Ijt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var G1=Ijt;const d5=Da(G1);var Pjt=ay,Ljt=G1,Ojt="[object AsyncFunction]",Djt="[object Function]",Rjt="[object GeneratorFunction]",Fjt="[object Proxy]";function zjt(t){if(!Ljt(t))return!1;var e=Pjt(t);return e==Djt||e==Rjt||e==Ojt||e==Fjt}var hye=zjt;const Oi=Da(hye);var Bjt=Pg,$jt=Bjt["__core-js_shared__"],Ujt=$jt,Mce=Ujt,sSe=function(){var t=/[^.]+$/.exec(Mce&&Mce.keys&&Mce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function qjt(t){return!!sSe&&sSe in t}var Vjt=qjt,Hjt=Function.prototype,Wjt=Hjt.toString;function Gjt(t){if(t!=null){try{return Wjt.call(t)}catch{}try{return t+""}catch{}}return""}var wze=Gjt,Kjt=hye,Zjt=Vjt,Yjt=G1,Xjt=wze,Qjt=/[\\^$.*+?()[\]{}|]/g,Jjt=/^\[object .+?Constructor\]$/,ekt=Function.prototype,tkt=Object.prototype,rkt=ekt.toString,nkt=tkt.hasOwnProperty,skt=RegExp("^"+rkt.call(nkt).replace(Qjt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ikt(t){if(!Yjt(t)||Zjt(t))return!1;var e=Kjt(t)?skt:Jjt;return e.test(Xjt(t))}var akt=ikt;function okt(t,e){return t==null?void 0:t[e]}var lkt=okt,ckt=akt,dkt=lkt;function ukt(t,e){var n=dkt(t,e);return ckt(n)?n:void 0}var Jj=ukt,hkt=Jj,fkt=hkt(Object,"create"),Fse=fkt,iSe=Fse;function pkt(){this.__data__=iSe?iSe(null):{},this.size=0}var mkt=pkt;function gkt(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var xkt=gkt,ykt=Fse,vkt="__lodash_hash_undefined__",_kt=Object.prototype,bkt=_kt.hasOwnProperty;function wkt(t){var e=this.__data__;if(ykt){var n=e[t];return n===vkt?void 0:n}return bkt.call(e,t)?e[t]:void 0}var jkt=wkt,kkt=Fse,Nkt=Object.prototype,Skt=Nkt.hasOwnProperty;function Ckt(t){var e=this.__data__;return kkt?e[t]!==void 0:Skt.call(e,t)}var Mkt=Ckt,Tkt=Fse,Akt="__lodash_hash_undefined__";function Ekt(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Tkt&&e===void 0?Akt:e,this}var Ikt=Ekt,Pkt=mkt,Lkt=xkt,Okt=jkt,Dkt=Mkt,Rkt=Ikt;function u5(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var eNt=Jkt,tNt=zse;function rNt(t,e){var n=this.__data__,s=tNt(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this}var nNt=rNt,sNt=Bkt,iNt=Kkt,aNt=Xkt,oNt=eNt,lNt=nNt;function h5(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},Tw=function(e){return Bj(e)&&e.indexOf("%")===e.length-1},On=function(e){return MSt(e)&&!MI(e)},ISt=function(e){return xa(e)},Fc=function(e){return On(e)||Bj(e)},PSt=0,TI=function(e){var n=++PSt;return"".concat(e||"").concat(n)},Su=function(e,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!On(e)&&!Bj(e))return s;var o;if(Tw(e)){var c=e.indexOf("%");o=n*parseFloat(e.slice(0,c))/100}else o=+e;return MI(o)&&(o=s),i&&o>n&&(o=n),o},v0=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},LSt=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,s={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function $St(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var hSe={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"},$x=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},fSe=null,Ace=null,wye=function t(e){if(e===fSe&&Array.isArray(Ace))return Ace;var n=[];return P.Children.forEach(e,function(s){xa(s)||(jSt.isFragment(s)?n=n.concat(t(s.props.children)):n.push(s))}),Ace=n,fSe=e,n};function Gf(t,e){var n=[],s=[];return Array.isArray(e)?s=e.map(function(i){return $x(i)}):s=[$x(e)],wye(t).forEach(function(i){var o=Kh(i,"type.displayName")||Kh(i,"type.name");s.indexOf(o)!==-1&&n.push(i)}),n}function Ih(t,e){var n=Gf(t,e);return n&&n[0]}var pSe=function(e){if(!e||!e.props)return!1;var n=e.props,s=n.width,i=n.height;return!(!On(s)||s<=0||!On(i)||i<=0)},USt=["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"],qSt=function(e){return e&&e.type&&Bj(e.type)&&USt.indexOf(e.type)>=0},VSt=function(e,n,s,i){var o,c=(o=Tce==null?void 0:Tce[i])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Oi(e)&&(i&&c.includes(n)||RSt.includes(n))||s&&bye.includes(n)},Ni=function(e,n,s){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(P.isValidElement(e)&&(i=e.props),!d5(i))return null;var o={};return Object.keys(i).forEach(function(c){var a;VSt((a=i)===null||a===void 0?void 0:a[c],c,n,s)&&(o[c]=i[c])}),o},rfe=function t(e,n){if(e===n)return!0;var s=P.Children.count(e);if(s!==P.Children.count(n))return!1;if(s===0)return!0;if(s===1)return mSe(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function ZSt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function sfe(t){var e=t.children,n=t.width,s=t.height,i=t.viewBox,o=t.className,c=t.style,a=t.title,h=t.desc,m=KSt(t,GSt),x=i||{width:n,height:s,x:0,y:0},v=ra("recharts-surface",o);return lt.createElement("svg",nfe({},Ni(m,!0,"svg"),{className:v,width:n,height:s,style:c,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),lt.createElement("title",null,a),lt.createElement("desc",null,h),e)}var YSt=["children","className"];function ife(){return ife=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function QSt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var vo=lt.forwardRef(function(t,e){var n=t.children,s=t.className,i=XSt(t,YSt),o=ra("recharts-layer",s);return lt.createElement("g",ife({className:o},Ni(i,!0),{ref:e}),n)}),um=function(e,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++s=s?t:t4t(t,e,n)}var n4t=r4t,s4t="\\ud800-\\udfff",i4t="\\u0300-\\u036f",a4t="\\ufe20-\\ufe2f",o4t="\\u20d0-\\u20ff",l4t=i4t+a4t+o4t,c4t="\\ufe0e\\ufe0f",d4t="\\u200d",u4t=RegExp("["+d4t+s4t+l4t+c4t+"]");function h4t(t){return u4t.test(t)}var Ize=h4t;function f4t(t){return t.split("")}var p4t=f4t,Pze="\\ud800-\\udfff",m4t="\\u0300-\\u036f",g4t="\\ufe20-\\ufe2f",x4t="\\u20d0-\\u20ff",y4t=m4t+g4t+x4t,v4t="\\ufe0e\\ufe0f",_4t="["+Pze+"]",afe="["+y4t+"]",ofe="\\ud83c[\\udffb-\\udfff]",b4t="(?:"+afe+"|"+ofe+")",Lze="[^"+Pze+"]",Oze="(?:\\ud83c[\\udde6-\\uddff]){2}",Dze="[\\ud800-\\udbff][\\udc00-\\udfff]",w4t="\\u200d",Rze=b4t+"?",Fze="["+v4t+"]?",j4t="(?:"+w4t+"(?:"+[Lze,Oze,Dze].join("|")+")"+Fze+Rze+")*",k4t=Fze+Rze+j4t,N4t="(?:"+[Lze+afe+"?",afe,Oze,Dze,_4t].join("|")+")",S4t=RegExp(ofe+"(?="+ofe+")|"+N4t+k4t,"g");function C4t(t){return t.match(S4t)||[]}var M4t=C4t,T4t=p4t,A4t=Ize,E4t=M4t;function I4t(t){return A4t(t)?E4t(t):T4t(t)}var P4t=I4t,L4t=n4t,O4t=Ize,D4t=P4t,R4t=Sze;function F4t(t){return function(e){e=R4t(e);var n=O4t(e)?D4t(e):void 0,s=n?n[0]:e.charAt(0),i=n?L4t(n,1).join(""):e.slice(1);return s[t]()+i}}var z4t=F4t,B4t=z4t,$4t=B4t("toUpperCase"),U4t=$4t;const Jse=Da(U4t);function Vo(t){return function(){return t}}const zze=Math.cos,are=Math.sin,bm=Math.sqrt,ore=Math.PI,eie=2*ore,lfe=Math.PI,cfe=2*lfe,uw=1e-6,q4t=cfe-uw;function Bze(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Bze;const n=10**e;return function(s){this._+=s[0];for(let i=1,o=s.length;iuw)if(!(Math.abs(v*h-m*x)>uw)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let k=s-c,C=i-a,S=h*h+m*m,T=k*k+C*C,I=Math.sqrt(S),A=Math.sqrt(w),D=o*Math.tan((lfe-Math.acos((S+w-T)/(2*I*A)))/2),$=D/A,F=D/I;Math.abs($-1)>uw&&this._append`L${e+$*x},${n+$*v}`,this._append`A${o},${o},0,0,${+(v*k>x*C)},${this._x1=e+F*h},${this._y1=n+F*m}`}}arc(e,n,s,i,o,c){if(e=+e,n=+n,s=+s,c=!!c,s<0)throw new Error(`negative radius: ${s}`);let a=s*Math.cos(i),h=s*Math.sin(i),m=e+a,x=n+h,v=1^c,w=c?i-o:o-i;this._x1===null?this._append`M${m},${x}`:(Math.abs(this._x1-m)>uw||Math.abs(this._y1-x)>uw)&&this._append`L${m},${x}`,s&&(w<0&&(w=w%cfe+cfe),w>q4t?this._append`A${s},${s},0,1,${v},${e-a},${n-h}A${s},${s},0,1,${v},${this._x1=m},${this._y1=x}`:w>uw&&this._append`A${s},${s},0,${+(w>=lfe)},${v},${this._x1=e+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(e,n,s,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${s=+s}v${+i}h${-s}Z`}toString(){return this._}}function jye(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);e=s}return t},()=>new H4t(e)}function kye(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $ze(t){this._context=t}$ze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function tie(t){return new $ze(t)}function Uze(t){return t[0]}function qze(t){return t[1]}function Vze(t,e){var n=Vo(!0),s=null,i=tie,o=null,c=jye(a);t=typeof t=="function"?t:t===void 0?Uze:Vo(t),e=typeof e=="function"?e:e===void 0?qze:Vo(e);function a(h){var m,x=(h=kye(h)).length,v,w=!1,k;for(s==null&&(o=i(k=c())),m=0;m<=x;++m)!(m=k;--C)a.point(D[C],$[C]);a.lineEnd(),a.areaEnd()}I&&(D[w]=+t(T,w,v),$[w]=+e(T,w,v),a.point(s?+s(T,w,v):D[w],n?+n(T,w,v):$[w]))}if(A)return a=null,A+""||null}function x(){return Vze().defined(i).curve(c).context(o)}return m.x=function(v){return arguments.length?(t=typeof v=="function"?v:Vo(+v),s=null,m):t},m.x0=function(v){return arguments.length?(t=typeof v=="function"?v:Vo(+v),m):t},m.x1=function(v){return arguments.length?(s=v==null?null:typeof v=="function"?v:Vo(+v),m):s},m.y=function(v){return arguments.length?(e=typeof v=="function"?v:Vo(+v),n=null,m):e},m.y0=function(v){return arguments.length?(e=typeof v=="function"?v:Vo(+v),m):e},m.y1=function(v){return arguments.length?(n=v==null?null:typeof v=="function"?v:Vo(+v),m):n},m.lineX0=m.lineY0=function(){return x().x(t).y(e)},m.lineY1=function(){return x().x(t).y(n)},m.lineX1=function(){return x().x(s).y(e)},m.defined=function(v){return arguments.length?(i=typeof v=="function"?v:Vo(!!v),m):i},m.curve=function(v){return arguments.length?(c=v,o!=null&&(a=c(o)),m):c},m.context=function(v){return arguments.length?(v==null?o=a=null:a=c(o=v),m):o},m}class Hze{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function W4t(t){return new Hze(t,!0)}function G4t(t){return new Hze(t,!1)}const Nye={draw(t,e){const n=bm(e/ore);t.moveTo(n,0),t.arc(0,0,n,0,eie)}},K4t={draw(t,e){const n=bm(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Wze=bm(1/3),Z4t=Wze*2,Y4t={draw(t,e){const n=bm(e/Z4t),s=n*Wze;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}},X4t={draw(t,e){const n=bm(e),s=-n/2;t.rect(s,s,n,n)}},Q4t=.8908130915292852,Gze=are(ore/10)/are(7*ore/10),J4t=are(eie/10)*Gze,eCt=-zze(eie/10)*Gze,tCt={draw(t,e){const n=bm(e*Q4t),s=J4t*n,i=eCt*n;t.moveTo(0,-n),t.lineTo(s,i);for(let o=1;o<5;++o){const c=eie*o/5,a=zze(c),h=are(c);t.lineTo(h*n,-a*n),t.lineTo(a*s-h*i,h*s+a*i)}t.closePath()}},Ece=bm(3),rCt={draw(t,e){const n=-bm(e/(Ece*3));t.moveTo(0,n*2),t.lineTo(-Ece*n,-n),t.lineTo(Ece*n,-n),t.closePath()}},_f=-.5,bf=bm(3)/2,dfe=1/bm(12),nCt=(dfe/2+1)*3,sCt={draw(t,e){const n=bm(e/nCt),s=n/2,i=n*dfe,o=s,c=n*dfe+n,a=-o,h=c;t.moveTo(s,i),t.lineTo(o,c),t.lineTo(a,h),t.lineTo(_f*s-bf*i,bf*s+_f*i),t.lineTo(_f*o-bf*c,bf*o+_f*c),t.lineTo(_f*a-bf*h,bf*a+_f*h),t.lineTo(_f*s+bf*i,_f*i-bf*s),t.lineTo(_f*o+bf*c,_f*c-bf*o),t.lineTo(_f*a+bf*h,_f*h-bf*a),t.closePath()}};function iCt(t,e){let n=null,s=jye(i);t=typeof t=="function"?t:Vo(t||Nye),e=typeof e=="function"?e:Vo(e===void 0?64:+e);function i(){let o;if(n||(n=o=s()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:Vo(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:Vo(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function lre(){}function cre(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Kze(t){this._context=t}Kze.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:cre(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:cre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function aCt(t){return new Kze(t)}function Zze(t){this._context=t}Zze.prototype={areaStart:lre,areaEnd:lre,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:cre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function oCt(t){return new Zze(t)}function Yze(t){this._context=t}Yze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,s=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:cre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function lCt(t){return new Yze(t)}function Xze(t){this._context=t}Xze.prototype={areaStart:lre,areaEnd:lre,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function cCt(t){return new Xze(t)}function xSe(t){return t<0?-1:1}function ySe(t,e,n){var s=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(s||i<0&&-0),c=(n-t._y1)/(i||s<0&&-0),a=(o*i+c*s)/(s+i);return(xSe(o)+xSe(c))*Math.min(Math.abs(o),Math.abs(c),.5*Math.abs(a))||0}function vSe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Ice(t,e,n){var s=t._x0,i=t._y0,o=t._x1,c=t._y1,a=(o-s)/3;t._context.bezierCurveTo(s+a,i+a*e,o-a,c-a*n,o,c)}function dre(t){this._context=t}dre.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:Ice(this,this._t0,vSe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Ice(this,vSe(this,n=ySe(this,t,e)),n);break;default:Ice(this,this._t0,n=ySe(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function Qze(t){this._context=new Jze(t)}(Qze.prototype=Object.create(dre.prototype)).point=function(t,e){dre.prototype.point.call(this,e,t)};function Jze(t){this._context=t}Jze.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,s,i,o){this._context.bezierCurveTo(e,t,s,n,o,i)}};function dCt(t){return new dre(t)}function uCt(t){return new Qze(t)}function e7e(t){this._context=t}e7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var s=_Se(t),i=_Se(e),o=0,c=1;c=0;--e)i[e]=(c[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function fCt(t){return new rie(t,.5)}function pCt(t){return new rie(t,0)}function mCt(t){return new rie(t,1)}function gC(t,e){if((c=t.length)>1)for(var n=1,s,i,o=t[e[0]],c,a=o.length;n=0;)n[e]=e;return n}function gCt(t,e){return t[e]}function xCt(t){const e=[];return e.key=t,e}function yCt(){var t=Vo([]),e=ufe,n=gC,s=gCt;function i(o){var c=Array.from(t.apply(this,arguments),xCt),a,h=c.length,m=-1,x;for(const v of o)for(a=0,++m;a0){for(var n,s,i=0,o=t[0].length,c;i0){for(var n=0,s=t[e[0]],i,o=s.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,s=1,i,o,c;s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function CCt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var t7e={symbolCircle:Nye,symbolCross:K4t,symbolDiamond:Y4t,symbolSquare:X4t,symbolStar:tCt,symbolTriangle:rCt,symbolWye:sCt},MCt=Math.PI/180,TCt=function(e){var n="symbol".concat(Jse(e));return t7e[n]||Nye},ACt=function(e,n,s){if(n==="area")return e;switch(s){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*MCt;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},ECt=function(e,n){t7e["symbol".concat(Jse(e))]=n},Sye=function(e){var n=e.type,s=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,c=e.sizeType,a=c===void 0?"area":c,h=SCt(e,wCt),m=wSe(wSe({},h),{},{type:s,size:o,sizeType:a}),x=function(){var T=TCt(s),I=iCt().type(T).size(ACt(o,a,s));return I()},v=m.className,w=m.cx,k=m.cy,C=Ni(m,!0);return w===+w&&k===+k&&o===+o?lt.createElement("path",hfe({},C,{className:ra("recharts-symbols",v),transform:"translate(".concat(w,", ").concat(k,")"),d:x()})):null};Sye.registerSymbol=ECt;function xC(t){"@babel/helpers - typeof";return xC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xC(t)}function ffe(){return ffe=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var A=k.inactive?m:k.color;return lt.createElement("li",ffe({className:T,style:v,key:"legend-item-".concat(C)},$j(s.props,k,C)),lt.createElement(sfe,{width:c,height:c,viewBox:x,style:w},s.renderIcon(k)),lt.createElement("span",{className:"recharts-legend-item-text",style:{color:A}},S?S(I,k,C):I))})}},{key:"render",value:function(){var s=this.props,i=s.payload,o=s.layout,c=s.align;if(!i||!i.length)return null;var a={padding:0,margin:0,textAlign:o==="horizontal"?c:"left"};return lt.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])}(P.PureComponent);lE(Cye,"displayName","Legend");lE(Cye,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var $Ct=Bse;function UCt(){this.__data__=new $Ct,this.size=0}var qCt=UCt;function VCt(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var HCt=VCt;function WCt(t){return this.__data__.get(t)}var GCt=WCt;function KCt(t){return this.__data__.has(t)}var ZCt=KCt,YCt=Bse,XCt=pye,QCt=mye,JCt=200;function e5t(t,e){var n=this.__data__;if(n instanceof YCt){var s=n.__data__;if(!XCt||s.lengtha))return!1;var m=o.get(t),x=o.get(e);if(m&&x)return m==e&&x==t;var v=-1,w=!0,k=n&w5t?new y5t:void 0;for(o.set(t,e),o.set(e,t);++v-1&&t%1==0&&t-1&&t%1==0&&t<=S3t}var Eye=C3t,M3t=ay,T3t=Eye,A3t=oy,E3t="[object Arguments]",I3t="[object Array]",P3t="[object Boolean]",L3t="[object Date]",O3t="[object Error]",D3t="[object Function]",R3t="[object Map]",F3t="[object Number]",z3t="[object Object]",B3t="[object RegExp]",$3t="[object Set]",U3t="[object String]",q3t="[object WeakMap]",V3t="[object ArrayBuffer]",H3t="[object DataView]",W3t="[object Float32Array]",G3t="[object Float64Array]",K3t="[object Int8Array]",Z3t="[object Int16Array]",Y3t="[object Int32Array]",X3t="[object Uint8Array]",Q3t="[object Uint8ClampedArray]",J3t="[object Uint16Array]",eMt="[object Uint32Array]",il={};il[W3t]=il[G3t]=il[K3t]=il[Z3t]=il[Y3t]=il[X3t]=il[Q3t]=il[J3t]=il[eMt]=!0;il[E3t]=il[I3t]=il[V3t]=il[P3t]=il[H3t]=il[L3t]=il[O3t]=il[D3t]=il[R3t]=il[F3t]=il[z3t]=il[B3t]=il[$3t]=il[U3t]=il[q3t]=!1;function tMt(t){return A3t(t)&&T3t(t.length)&&!!il[M3t(t)]}var rMt=tMt;function nMt(t){return function(e){return t(e)}}var h7e=nMt,pre={exports:{}};pre.exports;(function(t,e){var n=_ze,s=e&&!e.nodeType&&e,i=s&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===s,c=o&&n.process,a=function(){try{var h=i&&i.require&&i.require("util").types;return h||c&&c.binding&&c.binding("util")}catch{}}();t.exports=a})(pre,pre.exports);var sMt=pre.exports,iMt=rMt,aMt=h7e,TSe=sMt,ASe=TSe&&TSe.isTypedArray,oMt=ASe?aMt(ASe):iMt,f7e=oMt,lMt=u3t,cMt=Tye,dMt=yh,uMt=u7e,hMt=Aye,fMt=f7e,pMt=Object.prototype,mMt=pMt.hasOwnProperty;function gMt(t,e){var n=dMt(t),s=!n&&cMt(t),i=!n&&!s&&uMt(t),o=!n&&!s&&!i&&fMt(t),c=n||s||i||o,a=c?lMt(t.length,String):[],h=a.length;for(var m in t)(e||mMt.call(t,m))&&!(c&&(m=="length"||i&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||hMt(m,h)))&&a.push(m);return a}var xMt=gMt,yMt=Object.prototype;function vMt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||yMt;return t===n}var _Mt=vMt;function bMt(t,e){return function(n){return t(e(n))}}var p7e=bMt,wMt=p7e,jMt=wMt(Object.keys,Object),kMt=jMt,NMt=_Mt,SMt=kMt,CMt=Object.prototype,MMt=CMt.hasOwnProperty;function TMt(t){if(!NMt(t))return SMt(t);var e=[];for(var n in Object(t))MMt.call(t,n)&&n!="constructor"&&e.push(n);return e}var AMt=TMt,EMt=hye,IMt=Eye;function PMt(t){return t!=null&&IMt(t.length)&&!EMt(t)}var AI=PMt,LMt=xMt,OMt=AMt,DMt=AI;function RMt(t){return DMt(t)?LMt(t):OMt(t)}var nie=RMt,FMt=J5t,zMt=c3t,BMt=nie;function $Mt(t){return FMt(t,BMt,zMt)}var UMt=$Mt,ESe=UMt,qMt=1,VMt=Object.prototype,HMt=VMt.hasOwnProperty;function WMt(t,e,n,s,i,o){var c=n&qMt,a=ESe(t),h=a.length,m=ESe(e),x=m.length;if(h!=x&&!c)return!1;for(var v=h;v--;){var w=a[v];if(!(c?w in e:HMt.call(e,w)))return!1}var k=o.get(t),C=o.get(e);if(k&&C)return k==e&&C==t;var S=!0;o.set(t,e),o.set(e,t);for(var T=c;++v-1}var VAt=qAt;function HAt(t,e,n){for(var s=-1,i=t==null?0:t.length;++s=aEt){var m=e?null:sEt(t);if(m)return iEt(m);c=!1,i=nEt,h=new eEt}else h=e?[]:a;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function wEt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function jEt(t){return t.value}function kEt(t,e){if(lt.isValidElement(t))return lt.cloneElement(t,e);if(typeof t=="function")return lt.createElement(t,e);e.ref;var n=bEt(e,fEt);return lt.createElement(Cye,n)}var GSe=1,C4=function(t){function e(){var n;pEt(this,e);for(var s=arguments.length,i=new Array(s),o=0;oGSe||Math.abs(i.height-this.lastBoundingBox.height)>GSe)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,s&&s(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?cx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var i=this.props,o=i.layout,c=i.align,a=i.verticalAlign,h=i.margin,m=i.chartWidth,x=i.chartHeight,v,w;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(c==="center"&&o==="vertical"){var k=this.getBBoxSnapshot();v={left:((m||0)-k.width)/2}}else v=c==="right"?{right:h&&h.right||0}:{left:h&&h.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(a==="middle"){var C=this.getBBoxSnapshot();w={top:((x||0)-C.height)/2}}else w=a==="bottom"?{bottom:h&&h.bottom||0}:{top:h&&h.top||0};return cx(cx({},v),w)}},{key:"render",value:function(){var s=this,i=this.props,o=i.content,c=i.width,a=i.height,h=i.wrapperStyle,m=i.payloadUniqBy,x=i.payload,v=cx(cx({position:"absolute",width:c||"auto",height:a||"auto"},this.getDefaultPosition(h)),h);return lt.createElement("div",{className:"recharts-legend-wrapper",style:v,ref:function(k){s.wrapperNode=k}},kEt(o,cx(cx({},this.props),{},{payload:b7e(x,m,jEt)})))}}],[{key:"getWithHeight",value:function(s,i){var o=cx(cx({},this.defaultProps),s.props),c=o.layout;return c==="vertical"&&On(s.props.height)?{height:s.props.height}:c==="horizontal"?{width:s.props.width||i}:null}}])}(P.PureComponent);sie(C4,"displayName","Legend");sie(C4,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var KSe=CI,NEt=Tye,SEt=yh,ZSe=KSe?KSe.isConcatSpreadable:void 0;function CEt(t){return SEt(t)||NEt(t)||!!(ZSe&&t&&t[ZSe])}var MEt=CEt,TEt=c7e,AEt=MEt;function k7e(t,e,n,s,i){var o=-1,c=t.length;for(n||(n=AEt),i||(i=[]);++o0&&n(a)?e>1?k7e(a,e-1,n,s,i):TEt(i,a):s||(i[i.length]=a)}return i}var N7e=k7e;function EEt(t){return function(e,n,s){for(var i=-1,o=Object(e),c=s(e),a=c.length;a--;){var h=c[t?a:++i];if(n(o[h],h,o)===!1)break}return e}}var IEt=EEt,PEt=IEt,LEt=PEt(),OEt=LEt,DEt=OEt,REt=nie;function FEt(t,e){return t&&DEt(t,e,REt)}var S7e=FEt,zEt=AI;function BEt(t,e){return function(n,s){if(n==null)return n;if(!zEt(n))return t(n,s);for(var i=n.length,o=e?i:-1,c=Object(n);(e?o--:++oe||o&&c&&h&&!a&&!m||s&&c&&h||!n&&h||!i)return 1;if(!s&&!o&&!m&&t=a)return h;var m=n[s];return h*(m=="desc"?-1:1)}}return t.index-e.index}var eIt=JEt,Dce=xye,tIt=yye,rIt=Lg,nIt=C7e,sIt=ZEt,iIt=h7e,aIt=eIt,oIt=g5,lIt=yh;function cIt(t,e,n){e.length?e=Dce(e,function(o){return lIt(o)?function(c){return tIt(c,o.length===1?o[0]:o)}:o}):e=[oIt];var s=-1;e=Dce(e,iIt(rIt));var i=nIt(t,function(o,c,a){var h=Dce(e,function(m){return m(o)});return{criteria:h,index:++s,value:o}});return sIt(i,function(o,c){return aIt(o,c,n)})}var dIt=cIt;function uIt(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var hIt=uIt,fIt=hIt,XSe=Math.max;function pIt(t,e,n){return e=XSe(e===void 0?t.length-1:e,0),function(){for(var s=arguments,i=-1,o=XSe(s.length-e,0),c=Array(o);++i0){if(++e>=kIt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var MIt=CIt,TIt=jIt,AIt=MIt,EIt=AIt(TIt),IIt=EIt,PIt=g5,LIt=mIt,OIt=IIt;function DIt(t,e){return OIt(LIt(t,e,PIt),t+"")}var RIt=DIt,FIt=fye,zIt=AI,BIt=Aye,$It=G1;function UIt(t,e,n){if(!$It(n))return!1;var s=typeof e;return(s=="number"?zIt(n)&&BIt(e,n.length):s=="string"&&e in n)?FIt(n[e],t):!1}var iie=UIt,qIt=N7e,VIt=dIt,HIt=RIt,JSe=iie,WIt=HIt(function(t,e){if(t==null)return[];var n=e.length;return n>1&&JSe(t,e[0],e[1])?e=[]:n>2&&JSe(e[0],e[1],e[2])&&(e=[e[0]]),VIt(t,qIt(e,1),[])}),GIt=WIt;const Lye=Da(GIt);function cE(t){"@babel/helpers - typeof";return cE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cE(t)}function bfe(){return bfe=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=e.x),"".concat(zM,"-left"),On(n)&&e&&On(e.x)&&n=e.y),"".concat(zM,"-top"),On(s)&&e&&On(e.y)&&sS?Math.max(x,h[s]):Math.max(v,h[s])}function lPt(t){var e=t.translateX,n=t.translateY,s=t.useTranslate3d;return{transform:s?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function cPt(t){var e=t.allowEscapeViewBox,n=t.coordinate,s=t.offsetTopLeft,i=t.position,o=t.reverseDirection,c=t.tooltipBox,a=t.useTranslate3d,h=t.viewBox,m,x,v;return c.height>0&&c.width>0&&n?(x=r4e({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:c.width,viewBox:h,viewBoxDimension:h.width}),v=r4e({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:c.height,viewBox:h,viewBoxDimension:h.height}),m=lPt({translateX:x,translateY:v,useTranslate3d:a})):m=aPt,{cssProperties:m,cssClasses:oPt({translateX:x,translateY:v,coordinate:n})}}function vC(t){"@babel/helpers - typeof";return vC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vC(t)}function n4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function s4e(t){for(var e=1;ei4e||Math.abs(s.height-this.state.lastBoundingBox.height)>i4e)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,i=this.props,o=i.active,c=i.allowEscapeViewBox,a=i.animationDuration,h=i.animationEasing,m=i.children,x=i.coordinate,v=i.hasPayload,w=i.isAnimationActive,k=i.offset,C=i.position,S=i.reverseDirection,T=i.useTranslate3d,I=i.viewBox,A=i.wrapperStyle,D=cPt({allowEscapeViewBox:c,coordinate:x,offsetTopLeft:k,position:C,reverseDirection:S,tooltipBox:this.state.lastBoundingBox,useTranslate3d:T,viewBox:I}),$=D.cssClasses,F=D.cssProperties,q=s4e(s4e({transition:w&&o?"transform ".concat(a,"ms ").concat(h):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&v?"visible":"hidden",position:"absolute",top:0,left:0},A);return lt.createElement("div",{tabIndex:-1,className:$,style:q,ref:function(K){s.wrapperNode=K}},m)}}])}(P.PureComponent),vPt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},x5={isSsr:vPt()};function _C(t){"@babel/helpers - typeof";return _C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_C(t)}function a4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function o4e(t){for(var e=1;e0;return lt.createElement(yPt,{allowEscapeViewBox:c,animationDuration:a,animationEasing:h,isAnimationActive:w,active:o,coordinate:x,hasPayload:q,offset:k,position:T,reverseDirection:I,useTranslate3d:A,viewBox:D,wrapperStyle:$},TPt(m,o4e(o4e({},this.props),{},{payload:F})))}}])}(P.PureComponent);Oye(Hp,"displayName","Tooltip");Oye(Hp,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!x5.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 APt=Pg,EPt=function(){return APt.Date.now()},IPt=EPt,PPt=/\s/;function LPt(t){for(var e=t.length;e--&&PPt.test(t.charAt(e)););return e}var OPt=LPt,DPt=OPt,RPt=/^\s+/;function FPt(t){return t&&t.slice(0,DPt(t)+1).replace(RPt,"")}var zPt=FPt,BPt=zPt,l4e=G1,$Pt=c5,c4e=NaN,UPt=/^[-+]0x[0-9a-f]+$/i,qPt=/^0b[01]+$/i,VPt=/^0o[0-7]+$/i,HPt=parseInt;function WPt(t){if(typeof t=="number")return t;if($Pt(t))return c4e;if(l4e(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=l4e(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=BPt(t);var n=qPt.test(t);return n||VPt.test(t)?HPt(t.slice(2),n?2:8):UPt.test(t)?c4e:+t}var P7e=WPt,GPt=G1,Fce=IPt,d4e=P7e,KPt="Expected a function",ZPt=Math.max,YPt=Math.min;function XPt(t,e,n){var s,i,o,c,a,h,m=0,x=!1,v=!1,w=!0;if(typeof t!="function")throw new TypeError(KPt);e=d4e(e)||0,GPt(n)&&(x=!!n.leading,v="maxWait"in n,o=v?ZPt(d4e(n.maxWait)||0,e):o,w="trailing"in n?!!n.trailing:w);function k(q){var W=s,K=i;return s=i=void 0,m=q,c=t.apply(K,W),c}function C(q){return m=q,a=setTimeout(I,e),x?k(q):c}function S(q){var W=q-h,K=q-m,Z=e-W;return v?YPt(Z,o-K):Z}function T(q){var W=q-h,K=q-m;return h===void 0||W>=e||W<0||v&&K>=o}function I(){var q=Fce();if(T(q))return A(q);a=setTimeout(I,S(q))}function A(q){return a=void 0,w&&s?k(q):(s=i=void 0,c)}function D(){a!==void 0&&clearTimeout(a),m=0,s=h=i=a=void 0}function $(){return a===void 0?c:A(Fce())}function F(){var q=Fce(),W=T(q);if(s=arguments,i=this,h=q,W){if(a===void 0)return C(h);if(v)return clearTimeout(a),a=setTimeout(I,e),k(h)}return a===void 0&&(a=setTimeout(I,e)),c}return F.cancel=D,F.flush=$,F}var QPt=XPt,JPt=QPt,e6t=G1,t6t="Expected a function";function r6t(t,e,n){var s=!0,i=!0;if(typeof t!="function")throw new TypeError(t6t);return e6t(n)&&(s="leading"in n?!!n.leading:s,i="trailing"in n?!!n.trailing:i),JPt(t,e,{leading:s,maxWait:e,trailing:i})}var n6t=r6t;const L7e=Da(n6t);function uE(t){"@babel/helpers - typeof";return uE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uE(t)}function u4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function PL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&(je=L7e(je,S,{trailing:!0,leading:!1}));var ne=new ResizeObserver(je),ye=F.current.getBoundingClientRect(),ie=ye.width,me=ye.height;return he(ie,me),ne.observe(F.current),function(){ne.disconnect()}},[he,S]);var ue=P.useMemo(function(){var je=Z.containerWidth,ne=Z.containerHeight;if(je<0||ne<0)return null;um(Tw(c)||Tw(h),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,c,h),um(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ye=Tw(c)?je:c,ie=Tw(h)?ne:h;n&&n>0&&(ye?ie=ye/n:ie&&(ye=ie*n),w&&ie>w&&(ie=w)),um(ye>0||ie>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.`,ye,ie,c,h,x,v,n);var me=!Array.isArray(k)&&$x(k.type).endsWith("Chart");return lt.Children.map(k,function(fe){return lt.isValidElement(fe)?P.cloneElement(fe,PL({width:ye,height:ie},me?{style:PL({height:"100%",width:"100%",maxHeight:ie,maxWidth:ye},fe.props.style)}:{})):fe})},[n,k,h,w,v,x,Z,c]);return lt.createElement("div",{id:T?"".concat(T):void 0,className:ra("recharts-responsive-container",I),style:PL(PL({},$),{},{width:c,height:h,minWidth:x,minHeight:v,maxHeight:w}),ref:F},ue)}),aie=function(e){return null};aie.displayName="Cell";function hE(t){"@babel/helpers - typeof";return hE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hE(t)}function f4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Sfe(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||x5.isSsr)return{width:0,height:0};var s=x6t(n),i=JSON.stringify({text:e,copyStyle:s});if(rS.widthCache[i])return rS.widthCache[i];try{var o=document.getElementById(p4e);o||(o=document.createElement("span"),o.setAttribute("id",p4e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var c=Sfe(Sfe({},g6t),s);Object.assign(o.style,c),o.textContent="".concat(e);var a=o.getBoundingClientRect(),h={width:a.width,height:a.height};return rS.widthCache[i]=h,++rS.cacheCount>m6t&&(rS.cacheCount=0,rS.widthCache={}),h}catch{return{width:0,height:0}}},y6t=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function fE(t){"@babel/helpers - typeof";return fE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fE(t)}function yre(t,e){return w6t(t)||b6t(t,e)||_6t(t,e)||v6t()}function v6t(){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 _6t(t,e){if(t){if(typeof t=="string")return m4e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m4e(t,e)}}function m4e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function D6t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function b4e(t,e){return B6t(t)||z6t(t,e)||F6t(t,e)||R6t()}function R6t(){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 F6t(t,e){if(t){if(typeof t=="string")return w4e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w4e(t,e)}}function w4e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return ye.reduce(function(ie,me){var fe=me.word,ve=me.width,Ie=ie[ie.length-1];if(Ie&&(i==null||o||Ie.width+ve+sme.width?ie:me})};if(!x)return k;for(var S="…",T=function(ye){var ie=v.slice(0,ye),me=F7e({breakAll:m,style:h,children:ie+S}).wordsWithComputedWidth,fe=w(me),ve=fe.length>c||C(fe).width>Number(i);return[ve,fe]},I=0,A=v.length-1,D=0,$;I<=A&&D<=v.length-1;){var F=Math.floor((I+A)/2),q=F-1,W=T(q),K=b4e(W,2),Z=K[0],re=K[1],he=T(F),ue=b4e(he,1),je=ue[0];if(!Z&&!je&&(I=F+1),Z&&je&&(A=F-1),!Z&&je){$=re;break}D++}return $||k},j4e=function(e){var n=xa(e)?[]:e.toString().split(R7e);return[{words:n}]},U6t=function(e){var n=e.width,s=e.scaleToFit,i=e.children,o=e.style,c=e.breakAll,a=e.maxLines;if((n||s)&&!x5.isSsr){var h,m,x=F7e({breakAll:c,children:i,style:o});if(x){var v=x.wordsWithComputedWidth,w=x.spaceWidth;h=v,m=w}else return j4e(i);return $6t({breakAll:c,children:i,maxLines:a,style:o},h,m,n,s)}return j4e(i)},k4e="#808080",Uj=function(e){var n=e.x,s=n===void 0?0:n,i=e.y,o=i===void 0?0:i,c=e.lineHeight,a=c===void 0?"1em":c,h=e.capHeight,m=h===void 0?"0.71em":h,x=e.scaleToFit,v=x===void 0?!1:x,w=e.textAnchor,k=w===void 0?"start":w,C=e.verticalAnchor,S=C===void 0?"end":C,T=e.fill,I=T===void 0?k4e:T,A=_4e(e,L6t),D=P.useMemo(function(){return U6t({breakAll:A.breakAll,children:A.children,maxLines:A.maxLines,scaleToFit:v,style:A.style,width:A.width})},[A.breakAll,A.children,A.maxLines,v,A.style,A.width]),$=A.dx,F=A.dy,q=A.angle,W=A.className,K=A.breakAll,Z=_4e(A,O6t);if(!Fc(s)||!Fc(o))return null;var re=s+(On($)?$:0),he=o+(On(F)?F:0),ue;switch(S){case"start":ue=zce("calc(".concat(m,")"));break;case"middle":ue=zce("calc(".concat((D.length-1)/2," * -").concat(a," + (").concat(m," / 2))"));break;default:ue=zce("calc(".concat(D.length-1," * -").concat(a,")"));break}var je=[];if(v){var ne=D[0].width,ye=A.width;je.push("scale(".concat((On(ye)?ye/ne:1)/ne,")"))}return q&&je.push("rotate(".concat(q,", ").concat(re,", ").concat(he,")")),je.length&&(Z.transform=je.join(" ")),lt.createElement("text",Cfe({},Ni(Z,!0),{x:re,y:he,className:ra("recharts-text",W),textAnchor:k,fill:I.includes("url")?k4e:I}),D.map(function(ie,me){var fe=ie.words.join(K?"":" ");return lt.createElement("tspan",{x:re,dy:me===0?ue:a,key:"".concat(fe,"-").concat(me)},fe)}))};function _1(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function q6t(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Dye(t){let e,n,s;t.length!==2?(e=_1,n=(a,h)=>_1(t(a),h),s=(a,h)=>t(a)-h):(e=t===_1||t===q6t?t:V6t,n=t,s=t);function i(a,h,m=0,x=a.length){if(m>>1;n(a[v],h)<0?m=v+1:x=v}while(m>>1;n(a[v],h)<=0?m=v+1:x=v}while(mm&&s(a[v-1],h)>-s(a[v],h)?v-1:v}return{left:i,center:c,right:o}}function V6t(){return 0}function z7e(t){return t===null?NaN:+t}function*H6t(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const W6t=Dye(_1),EI=W6t.right;Dye(z7e).center;class N4e extends Map{constructor(e,n=Z6t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[s,i]of e)this.set(s,i)}get(e){return super.get(S4e(this,e))}has(e){return super.has(S4e(this,e))}set(e,n){return super.set(G6t(this,e),n)}delete(e){return super.delete(K6t(this,e))}}function S4e({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):n}function G6t({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):(t.set(s,n),n)}function K6t({_intern:t,_key:e},n){const s=e(n);return t.has(s)&&(n=t.get(s),t.delete(s)),n}function Z6t(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Y6t(t=_1){if(t===_1)return B7e;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const s=t(e,n);return s||s===0?s:(t(n,n)===0)-(t(e,e)===0)}}function B7e(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const X6t=Math.sqrt(50),Q6t=Math.sqrt(10),J6t=Math.sqrt(2);function vre(t,e,n){const s=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(s)),o=s/Math.pow(10,i),c=o>=X6t?10:o>=Q6t?5:o>=J6t?2:1;let a,h,m;return i<0?(m=Math.pow(10,-i)/c,a=Math.round(t*m),h=Math.round(e*m),a/me&&--h,m=-m):(m=Math.pow(10,i)*c,a=Math.round(t/m),h=Math.round(e/m),a*me&&--h),h0))return[];if(t===e)return[t];const s=e=i))return[];const a=o-i+1,h=new Array(a);if(s)if(c<0)for(let m=0;m=s)&&(n=s);return n}function M4e(t,e){let n;for(const s of t)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function $7e(t,e,n=0,s=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(t.length-1,s)),!(n<=e&&e<=s))return t;for(i=i===void 0?B7e:Y6t(i);s>n;){if(s-n>600){const h=s-n+1,m=e-n+1,x=Math.log(h),v=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*v*(h-v)/h)*(m-h/2<0?-1:1),k=Math.max(n,Math.floor(e-m*v/h+w)),C=Math.min(s,Math.floor(e+(h-m)*v/h+w));$7e(t,e,k,C,i)}const o=t[e];let c=n,a=s;for(BM(t,n,e),i(t[s],o)>0&&BM(t,n,s);c0;)--a}i(t[n],o)===0?BM(t,n,a):(++a,BM(t,a,s)),a<=e&&(n=a+1),e<=a&&(s=a-1)}return t}function BM(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function eLt(t,e,n){if(t=Float64Array.from(H6t(t)),!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return M4e(t);if(e>=1)return C4e(t);var s,i=(s-1)*e,o=Math.floor(i),c=C4e($7e(t,o).subarray(0,o+1)),a=M4e(t.subarray(o+1));return c+(a-c)*(i-o)}}function tLt(t,e,n=z7e){if(!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return+n(t[0],0,t);if(e>=1)return+n(t[s-1],s-1,t);var s,i=(s-1)*e,o=Math.floor(i),c=+n(t[o],o,t),a=+n(t[o+1],o+1,t);return c+(a-c)*(i-o)}}function rLt(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var s=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++s>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?OL(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?OL(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=sLt.exec(t))?new lh(e[1],e[2],e[3],1):(e=iLt.exec(t))?new lh(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=aLt.exec(t))?OL(e[1],e[2],e[3],e[4]):(e=oLt.exec(t))?OL(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=lLt.exec(t))?O4e(e[1],e[2]/100,e[3]/100,1):(e=cLt.exec(t))?O4e(e[1],e[2]/100,e[3]/100,e[4]):T4e.hasOwnProperty(t)?I4e(T4e[t]):t==="transparent"?new lh(NaN,NaN,NaN,0):null}function I4e(t){return new lh(t>>16&255,t>>8&255,t&255,1)}function OL(t,e,n,s){return s<=0&&(t=e=n=NaN),new lh(t,e,n,s)}function hLt(t){return t instanceof II||(t=xE(t)),t?(t=t.rgb(),new lh(t.r,t.g,t.b,t.opacity)):new lh}function Ife(t,e,n,s){return arguments.length===1?hLt(t):new lh(t,e,n,s??1)}function lh(t,e,n,s){this.r=+t,this.g=+e,this.b=+n,this.opacity=+s}Fye(lh,Ife,q7e(II,{brighter(t){return t=t==null?_re:Math.pow(_re,t),new lh(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?mE:Math.pow(mE,t),new lh(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lh(fj(this.r),fj(this.g),fj(this.b),bre(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:P4e,formatHex:P4e,formatHex8:fLt,formatRgb:L4e,toString:L4e}));function P4e(){return`#${Aw(this.r)}${Aw(this.g)}${Aw(this.b)}`}function fLt(){return`#${Aw(this.r)}${Aw(this.g)}${Aw(this.b)}${Aw((isNaN(this.opacity)?1:this.opacity)*255)}`}function L4e(){const t=bre(this.opacity);return`${t===1?"rgb(":"rgba("}${fj(this.r)}, ${fj(this.g)}, ${fj(this.b)}${t===1?")":`, ${t})`}`}function bre(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function fj(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Aw(t){return t=fj(t),(t<16?"0":"")+t.toString(16)}function O4e(t,e,n,s){return s<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Xp(t,e,n,s)}function V7e(t){if(t instanceof Xp)return new Xp(t.h,t.s,t.l,t.opacity);if(t instanceof II||(t=xE(t)),!t)return new Xp;if(t instanceof Xp)return t;t=t.rgb();var e=t.r/255,n=t.g/255,s=t.b/255,i=Math.min(e,n,s),o=Math.max(e,n,s),c=NaN,a=o-i,h=(o+i)/2;return a?(e===o?c=(n-s)/a+(n0&&h<1?0:c,new Xp(c,a,h,t.opacity)}function pLt(t,e,n,s){return arguments.length===1?V7e(t):new Xp(t,e,n,s??1)}function Xp(t,e,n,s){this.h=+t,this.s=+e,this.l=+n,this.opacity=+s}Fye(Xp,pLt,q7e(II,{brighter(t){return t=t==null?_re:Math.pow(_re,t),new Xp(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?mE:Math.pow(mE,t),new Xp(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*e,i=2*n-s;return new lh(Bce(t>=240?t-240:t+120,i,s),Bce(t,i,s),Bce(t<120?t+240:t-120,i,s),this.opacity)},clamp(){return new Xp(D4e(this.h),DL(this.s),DL(this.l),bre(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=bre(this.opacity);return`${t===1?"hsl(":"hsla("}${D4e(this.h)}, ${DL(this.s)*100}%, ${DL(this.l)*100}%${t===1?")":`, ${t})`}`}}));function D4e(t){return t=(t||0)%360,t<0?t+360:t}function DL(t){return Math.max(0,Math.min(1,t||0))}function Bce(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const zye=t=>()=>t;function mLt(t,e){return function(n){return t+n*e}}function gLt(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(s){return Math.pow(t+s*e,n)}}function xLt(t){return(t=+t)==1?H7e:function(e,n){return n-e?gLt(e,n,t):zye(isNaN(e)?n:e)}}function H7e(t,e){var n=e-t;return n?mLt(t,n):zye(isNaN(t)?e:t)}const R4e=function t(e){var n=xLt(e);function s(i,o){var c=n((i=Ife(i)).r,(o=Ife(o)).r),a=n(i.g,o.g),h=n(i.b,o.b),m=H7e(i.opacity,o.opacity);return function(x){return i.r=c(x),i.g=a(x),i.b=h(x),i.opacity=m(x),i+""}}return s.gamma=t,s}(1);function yLt(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,s=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),a[c]?a[c]+=o:a[++c]=o),(s=s[0])===(i=i[0])?a[c]?a[c]+=i:a[++c]=i:(a[++c]=null,h.push({i:c,x:wre(s,i)})),n=$ce.lastIndex;return ne&&(n=t,t=e,e=n),function(s){return Math.max(t,Math.min(e,s))}}function TLt(t,e,n){var s=t[0],i=t[1],o=e[0],c=e[1];return i2?ALt:TLt,h=m=null,v}function v(w){return w==null||isNaN(w=+w)?o:(h||(h=a(t.map(s),e,n)))(s(c(w)))}return v.invert=function(w){return c(i((m||(m=a(e,t.map(s),wre)))(w)))},v.domain=function(w){return arguments.length?(t=Array.from(w,jre),x()):t.slice()},v.range=function(w){return arguments.length?(e=Array.from(w),x()):e.slice()},v.rangeRound=function(w){return e=Array.from(w),n=Bye,x()},v.clamp=function(w){return arguments.length?(c=w?!0:Cu,x()):c!==Cu},v.interpolate=function(w){return arguments.length?(n=w,x()):n},v.unknown=function(w){return arguments.length?(o=w,v):o},function(w,k){return s=w,i=k,x()}}function $ye(){return oie()(Cu,Cu)}function ELt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kre(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,s=t.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+t.slice(n+1)]}function bC(t){return t=kre(Math.abs(t)),t?t[1]:NaN}function ILt(t,e){return function(n,s){for(var i=n.length,o=[],c=0,a=t[0],h=0;i>0&&a>0&&(h+a+1>s&&(a=Math.max(1,s-h)),o.push(n.substring(i-=a,i+a)),!((h+=a+1)>s));)a=t[c=(c+1)%t.length];return o.reverse().join(e)}}function PLt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var LLt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yE(t){if(!(e=LLt.exec(t)))throw new Error("invalid format: "+t);var e;return new Uye({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}yE.prototype=Uye.prototype;function Uye(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+""}Uye.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 OLt(t){e:for(var e=t.length,n=1,s=-1,i;n0&&(s=0);break}return s>0?t.slice(0,s)+t.slice(i+1):t}var W7e;function DLt(t,e){var n=kre(t,e);if(!n)return t+"";var s=n[0],i=n[1],o=i-(W7e=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,c=s.length;return o===c?s:o>c?s+new Array(o-c+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+kre(t,Math.max(0,e+o-1))[0]}function z4e(t,e){var n=kre(t,e);if(!n)return t+"";var s=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+s:s.length>i+1?s.slice(0,i+1)+"."+s.slice(i+1):s+new Array(i-s.length+2).join("0")}const B4e={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ELt,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>z4e(t*100,e),r:z4e,s:DLt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function $4e(t){return t}var U4e=Array.prototype.map,q4e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function RLt(t){var e=t.grouping===void 0||t.thousands===void 0?$4e:ILt(U4e.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",s=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?$4e:PLt(U4e.call(t.numerals,String)),c=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",h=t.nan===void 0?"NaN":t.nan+"";function m(v){v=yE(v);var w=v.fill,k=v.align,C=v.sign,S=v.symbol,T=v.zero,I=v.width,A=v.comma,D=v.precision,$=v.trim,F=v.type;F==="n"?(A=!0,F="g"):B4e[F]||(D===void 0&&(D=12),$=!0,F="g"),(T||w==="0"&&k==="=")&&(T=!0,w="0",k="=");var q=S==="$"?n:S==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",W=S==="$"?s:/[%p]/.test(F)?c:"",K=B4e[F],Z=/[defgprs%]/.test(F);D=D===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));function re(he){var ue=q,je=W,ne,ye,ie;if(F==="c")je=K(he)+je,he="";else{he=+he;var me=he<0||1/he<0;if(he=isNaN(he)?h:K(Math.abs(he),D),$&&(he=OLt(he)),me&&+he==0&&C!=="+"&&(me=!1),ue=(me?C==="("?C:a:C==="-"||C==="("?"":C)+ue,je=(F==="s"?q4e[8+W7e/3]:"")+je+(me&&C==="("?")":""),Z){for(ne=-1,ye=he.length;++neie||ie>57){je=(ie===46?i+he.slice(ne+1):he.slice(ne))+je,he=he.slice(0,ne);break}}}A&&!T&&(he=e(he,1/0));var fe=ue.length+he.length+je.length,ve=fe>1)+ue+he+je+ve.slice(fe);break;default:he=ve+ue+he+je;break}return o(he)}return re.toString=function(){return v+""},re}function x(v,w){var k=m((v=yE(v),v.type="f",v)),C=Math.max(-8,Math.min(8,Math.floor(bC(w)/3)))*3,S=Math.pow(10,-C),T=q4e[8+C/3];return function(I){return k(S*I)+T}}return{format:m,formatPrefix:x}}var RL,qye,G7e;FLt({thousands:",",grouping:[3],currency:["$",""]});function FLt(t){return RL=RLt(t),qye=RL.format,G7e=RL.formatPrefix,RL}function zLt(t){return Math.max(0,-bC(Math.abs(t)))}function BLt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bC(e)/3)))*3-bC(Math.abs(t)))}function $Lt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,bC(e)-bC(t))+1}function K7e(t,e,n,s){var i=Afe(t,e,n),o;switch(s=yE(s??",f"),s.type){case"s":{var c=Math.max(Math.abs(t),Math.abs(e));return s.precision==null&&!isNaN(o=BLt(i,c))&&(s.precision=o),G7e(s,c)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=$Lt(i,Math.max(Math.abs(t),Math.abs(e))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=zLt(i))&&(s.precision=o-(s.type==="%")*2);break}}return qye(s)}function K1(t){var e=t.domain;return t.ticks=function(n){var s=e();return Mfe(s[0],s[s.length-1],n??10)},t.tickFormat=function(n,s){var i=e();return K7e(i[0],i[i.length-1],n??10,s)},t.nice=function(n){n==null&&(n=10);var s=e(),i=0,o=s.length-1,c=s[i],a=s[o],h,m,x=10;for(a0;){if(m=Tfe(c,a,n),m===h)return s[i]=c,s[o]=a,e(s);if(m>0)c=Math.floor(c/m)*m,a=Math.ceil(a/m)*m;else if(m<0)c=Math.ceil(c*m)/m,a=Math.floor(a*m)/m;else break;h=m}return t},t}function Nre(){var t=$ye();return t.copy=function(){return PI(t,Nre())},rp.apply(t,arguments),K1(t)}function Z7e(t){var e;function n(s){return s==null||isNaN(s=+s)?e:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(t=Array.from(s,jre),n):t.slice()},n.unknown=function(s){return arguments.length?(e=s,n):e},n.copy=function(){return Z7e(t).unknown(e)},t=arguments.length?Array.from(t,jre):[0,1],K1(n)}function Y7e(t,e){t=t.slice();var n=0,s=t.length-1,i=t[n],o=t[s],c;return oMath.pow(t,e)}function WLt(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function W4e(t){return(e,n)=>-t(-e,n)}function Vye(t){const e=t(V4e,H4e),n=e.domain;let s=10,i,o;function c(){return i=WLt(s),o=HLt(s),n()[0]<0?(i=W4e(i),o=W4e(o),t(ULt,qLt)):t(V4e,H4e),e}return e.base=function(a){return arguments.length?(s=+a,c()):s},e.domain=function(a){return arguments.length?(n(a),c()):n()},e.ticks=a=>{const h=n();let m=h[0],x=h[h.length-1];const v=x0){for(;w<=k;++w)for(C=1;Cx)break;I.push(S)}}else for(;w<=k;++w)for(C=s-1;C>=1;--C)if(S=w>0?C/o(-w):C*o(w),!(Sx)break;I.push(S)}I.length*2{if(a==null&&(a=10),h==null&&(h=s===10?"s":","),typeof h!="function"&&(!(s%1)&&(h=yE(h)).precision==null&&(h.trim=!0),h=qye(h)),a===1/0)return h;const m=Math.max(1,s*a/e.ticks().length);return x=>{let v=x/o(Math.round(i(x)));return v*sn(Y7e(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),e}function X7e(){const t=Vye(oie()).domain([1,10]);return t.copy=()=>PI(t,X7e()).base(t.base()),rp.apply(t,arguments),t}function G4e(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function K4e(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Hye(t){var e=1,n=t(G4e(e),K4e(e));return n.constant=function(s){return arguments.length?t(G4e(e=+s),K4e(e)):e},K1(n)}function Q7e(){var t=Hye(oie());return t.copy=function(){return PI(t,Q7e()).constant(t.constant())},rp.apply(t,arguments)}function Z4e(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function GLt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function KLt(t){return t<0?-t*t:t*t}function Wye(t){var e=t(Cu,Cu),n=1;function s(){return n===1?t(Cu,Cu):n===.5?t(GLt,KLt):t(Z4e(n),Z4e(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,s()):n},K1(e)}function Gye(){var t=Wye(oie());return t.copy=function(){return PI(t,Gye()).exponent(t.exponent())},rp.apply(t,arguments),t}function ZLt(){return Gye.apply(null,arguments).exponent(.5)}function Y4e(t){return Math.sign(t)*t*t}function YLt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function J7e(){var t=$ye(),e=[0,1],n=!1,s;function i(o){var c=YLt(t(o));return isNaN(c)?s:n?Math.round(c):c}return i.invert=function(o){return t.invert(Y4e(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,jre)).map(Y4e)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.copy=function(){return J7e(t.domain(),e).round(n).clamp(t.clamp()).unknown(s)},rp.apply(i,arguments),K1(i)}function eBe(){var t=[],e=[],n=[],s;function i(){var c=0,a=Math.max(1,e.length);for(n=new Array(a-1);++c0?n[a-1]:t[0],a=n?[s[n-1],e]:[s[m-1],s[m]]},c.unknown=function(h){return arguments.length&&(o=h),c},c.thresholds=function(){return s.slice()},c.copy=function(){return tBe().domain([t,e]).range(i).unknown(o)},rp.apply(K1(c),arguments)}function rBe(){var t=[.5],e=[0,1],n,s=1;function i(o){return o!=null&&o<=o?e[EI(t,o,0,s)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),s=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),s=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var c=e.indexOf(o);return[t[c-1],t[c]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return rBe().domain(t).range(e).unknown(n)},rp.apply(i,arguments)}const Uce=new Date,qce=new Date;function $c(t,e,n,s){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const c=i(o),a=i.ceil(o);return o-c(e(o=new Date(+o),c==null?1:Math.floor(c)),o),i.range=(o,c,a)=>{const h=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o0))return h;let m;do h.push(m=new Date(+o)),e(o,a),t(o);while(m$c(c=>{if(c>=c)for(;t(c),!o(c);)c.setTime(c-1)},(c,a)=>{if(c>=c)if(a<0)for(;++a<=0;)for(;e(c,-1),!o(c););else for(;--a>=0;)for(;e(c,1),!o(c););}),n&&(i.count=(o,c)=>(Uce.setTime(+o),qce.setTime(+c),t(Uce),t(qce),Math.floor(n(Uce,qce))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(s?c=>s(c)%o===0:c=>i.count(0,c)%o===0):i)),i}const Sre=$c(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Sre.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?$c(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Sre);Sre.range;const Cx=1e3,Df=Cx*60,Mx=Df*60,Qx=Mx*24,Kye=Qx*7,X4e=Qx*30,Vce=Qx*365,Ew=$c(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Cx)},(t,e)=>(e-t)/Cx,t=>t.getUTCSeconds());Ew.range;const Zye=$c(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Cx)},(t,e)=>{t.setTime(+t+e*Df)},(t,e)=>(e-t)/Df,t=>t.getMinutes());Zye.range;const Yye=$c(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Df)},(t,e)=>(e-t)/Df,t=>t.getUTCMinutes());Yye.range;const Xye=$c(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Cx-t.getMinutes()*Df)},(t,e)=>{t.setTime(+t+e*Mx)},(t,e)=>(e-t)/Mx,t=>t.getHours());Xye.range;const Qye=$c(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Mx)},(t,e)=>(e-t)/Mx,t=>t.getUTCHours());Qye.range;const LI=$c(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Df)/Qx,t=>t.getDate()-1);LI.range;const lie=$c(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qx,t=>t.getUTCDate()-1);lie.range;const nBe=$c(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qx,t=>Math.floor(t/Qx));nBe.range;function ek(t){return $c(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Df)/Kye)}const cie=ek(0),Cre=ek(1),XLt=ek(2),QLt=ek(3),wC=ek(4),JLt=ek(5),eOt=ek(6);cie.range;Cre.range;XLt.range;QLt.range;wC.range;JLt.range;eOt.range;function tk(t){return $c(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Kye)}const die=tk(0),Mre=tk(1),tOt=tk(2),rOt=tk(3),jC=tk(4),nOt=tk(5),sOt=tk(6);die.range;Mre.range;tOt.range;rOt.range;jC.range;nOt.range;sOt.range;const Jye=$c(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Jye.range;const e0e=$c(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());e0e.range;const Jx=$c(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Jx.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:$c(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Jx.range;const ey=$c(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());ey.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:$c(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});ey.range;function sBe(t,e,n,s,i,o){const c=[[Ew,1,Cx],[Ew,5,5*Cx],[Ew,15,15*Cx],[Ew,30,30*Cx],[o,1,Df],[o,5,5*Df],[o,15,15*Df],[o,30,30*Df],[i,1,Mx],[i,3,3*Mx],[i,6,6*Mx],[i,12,12*Mx],[s,1,Qx],[s,2,2*Qx],[n,1,Kye],[e,1,X4e],[e,3,3*X4e],[t,1,Vce]];function a(m,x,v){const w=xT).right(c,w);if(k===c.length)return t.every(Afe(m/Vce,x/Vce,v));if(k===0)return Sre.every(Math.max(Afe(m,x,v),1));const[C,S]=c[w/c[k-1][2]53)return null;"w"in Ae||(Ae.w=1),"Z"in Ae?(ge=Wce($M(Ae.y,0,1)),ft=ge.getUTCDay(),ge=ft>4||ft===0?Mre.ceil(ge):Mre(ge),ge=lie.offset(ge,(Ae.V-1)*7),Ae.y=ge.getUTCFullYear(),Ae.m=ge.getUTCMonth(),Ae.d=ge.getUTCDate()+(Ae.w+6)%7):(ge=Hce($M(Ae.y,0,1)),ft=ge.getDay(),ge=ft>4||ft===0?Cre.ceil(ge):Cre(ge),ge=LI.offset(ge,(Ae.V-1)*7),Ae.y=ge.getFullYear(),Ae.m=ge.getMonth(),Ae.d=ge.getDate()+(Ae.w+6)%7)}else("W"in Ae||"U"in Ae)&&("w"in Ae||(Ae.w="u"in Ae?Ae.u%7:"W"in Ae?1:0),ft="Z"in Ae?Wce($M(Ae.y,0,1)).getUTCDay():Hce($M(Ae.y,0,1)).getDay(),Ae.m=0,Ae.d="W"in Ae?(Ae.w+6)%7+Ae.W*7-(ft+5)%7:Ae.w+Ae.U*7-(ft+6)%7);return"Z"in Ae?(Ae.H+=Ae.Z/100|0,Ae.M+=Ae.Z%100,Wce(Ae)):Hce(Ae)}}function K(Fe,Ce,Je,Ae){for(var Ye=0,ge=Ce.length,ft=Je.length,nt,Ve;Ye=ft)return-1;if(nt=Ce.charCodeAt(Ye++),nt===37){if(nt=Ce.charAt(Ye++),Ve=F[nt in Q4e?Ce.charAt(Ye++):nt],!Ve||(Ae=Ve(Fe,Je,Ae))<0)return-1}else if(nt!=Je.charCodeAt(Ae++))return-1}return Ae}function Z(Fe,Ce,Je){var Ae=m.exec(Ce.slice(Je));return Ae?(Fe.p=x.get(Ae[0].toLowerCase()),Je+Ae[0].length):-1}function re(Fe,Ce,Je){var Ae=k.exec(Ce.slice(Je));return Ae?(Fe.w=C.get(Ae[0].toLowerCase()),Je+Ae[0].length):-1}function he(Fe,Ce,Je){var Ae=v.exec(Ce.slice(Je));return Ae?(Fe.w=w.get(Ae[0].toLowerCase()),Je+Ae[0].length):-1}function ue(Fe,Ce,Je){var Ae=I.exec(Ce.slice(Je));return Ae?(Fe.m=A.get(Ae[0].toLowerCase()),Je+Ae[0].length):-1}function je(Fe,Ce,Je){var Ae=S.exec(Ce.slice(Je));return Ae?(Fe.m=T.get(Ae[0].toLowerCase()),Je+Ae[0].length):-1}function ne(Fe,Ce,Je){return K(Fe,e,Ce,Je)}function ye(Fe,Ce,Je){return K(Fe,n,Ce,Je)}function ie(Fe,Ce,Je){return K(Fe,s,Ce,Je)}function me(Fe){return c[Fe.getDay()]}function fe(Fe){return o[Fe.getDay()]}function ve(Fe){return h[Fe.getMonth()]}function Ie(Fe){return a[Fe.getMonth()]}function Se(Fe){return i[+(Fe.getHours()>=12)]}function oe(Fe){return 1+~~(Fe.getMonth()/3)}function ae(Fe){return c[Fe.getUTCDay()]}function Ne(Fe){return o[Fe.getUTCDay()]}function Te(Fe){return h[Fe.getUTCMonth()]}function Be(Fe){return a[Fe.getUTCMonth()]}function Le(Fe){return i[+(Fe.getUTCHours()>=12)]}function Qe(Fe){return 1+~~(Fe.getUTCMonth()/3)}return{format:function(Fe){var Ce=q(Fe+="",D);return Ce.toString=function(){return Fe},Ce},parse:function(Fe){var Ce=W(Fe+="",!1);return Ce.toString=function(){return Fe},Ce},utcFormat:function(Fe){var Ce=q(Fe+="",$);return Ce.toString=function(){return Fe},Ce},utcParse:function(Fe){var Ce=W(Fe+="",!0);return Ce.toString=function(){return Fe},Ce}}}var Q4e={"-":"",_:" ",0:"0"},fd=/^\s*\d+/,dOt=/^%/,uOt=/[\\^$*+?|[\]().{}]/g;function Ja(t,e,n){var s=t<0?"-":"",i=(s?-t:t)+"",o=i.length;return s+(o[e.toLowerCase(),n]))}function fOt(t,e,n){var s=fd.exec(e.slice(n,n+1));return s?(t.w=+s[0],n+s[0].length):-1}function pOt(t,e,n){var s=fd.exec(e.slice(n,n+1));return s?(t.u=+s[0],n+s[0].length):-1}function mOt(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.U=+s[0],n+s[0].length):-1}function gOt(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.V=+s[0],n+s[0].length):-1}function xOt(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.W=+s[0],n+s[0].length):-1}function J4e(t,e,n){var s=fd.exec(e.slice(n,n+4));return s?(t.y=+s[0],n+s[0].length):-1}function eCe(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function yOt(t,e,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return s?(t.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function vOt(t,e,n){var s=fd.exec(e.slice(n,n+1));return s?(t.q=s[0]*3-3,n+s[0].length):-1}function _Ot(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.m=s[0]-1,n+s[0].length):-1}function tCe(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.d=+s[0],n+s[0].length):-1}function bOt(t,e,n){var s=fd.exec(e.slice(n,n+3));return s?(t.m=0,t.d=+s[0],n+s[0].length):-1}function rCe(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.H=+s[0],n+s[0].length):-1}function wOt(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.M=+s[0],n+s[0].length):-1}function jOt(t,e,n){var s=fd.exec(e.slice(n,n+2));return s?(t.S=+s[0],n+s[0].length):-1}function kOt(t,e,n){var s=fd.exec(e.slice(n,n+3));return s?(t.L=+s[0],n+s[0].length):-1}function NOt(t,e,n){var s=fd.exec(e.slice(n,n+6));return s?(t.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function SOt(t,e,n){var s=dOt.exec(e.slice(n,n+1));return s?n+s[0].length:-1}function COt(t,e,n){var s=fd.exec(e.slice(n));return s?(t.Q=+s[0],n+s[0].length):-1}function MOt(t,e,n){var s=fd.exec(e.slice(n));return s?(t.s=+s[0],n+s[0].length):-1}function nCe(t,e){return Ja(t.getDate(),e,2)}function TOt(t,e){return Ja(t.getHours(),e,2)}function AOt(t,e){return Ja(t.getHours()%12||12,e,2)}function EOt(t,e){return Ja(1+LI.count(Jx(t),t),e,3)}function iBe(t,e){return Ja(t.getMilliseconds(),e,3)}function IOt(t,e){return iBe(t,e)+"000"}function POt(t,e){return Ja(t.getMonth()+1,e,2)}function LOt(t,e){return Ja(t.getMinutes(),e,2)}function OOt(t,e){return Ja(t.getSeconds(),e,2)}function DOt(t){var e=t.getDay();return e===0?7:e}function ROt(t,e){return Ja(cie.count(Jx(t)-1,t),e,2)}function aBe(t){var e=t.getDay();return e>=4||e===0?wC(t):wC.ceil(t)}function FOt(t,e){return t=aBe(t),Ja(wC.count(Jx(t),t)+(Jx(t).getDay()===4),e,2)}function zOt(t){return t.getDay()}function BOt(t,e){return Ja(Cre.count(Jx(t)-1,t),e,2)}function $Ot(t,e){return Ja(t.getFullYear()%100,e,2)}function UOt(t,e){return t=aBe(t),Ja(t.getFullYear()%100,e,2)}function qOt(t,e){return Ja(t.getFullYear()%1e4,e,4)}function VOt(t,e){var n=t.getDay();return t=n>=4||n===0?wC(t):wC.ceil(t),Ja(t.getFullYear()%1e4,e,4)}function HOt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ja(e/60|0,"0",2)+Ja(e%60,"0",2)}function sCe(t,e){return Ja(t.getUTCDate(),e,2)}function WOt(t,e){return Ja(t.getUTCHours(),e,2)}function GOt(t,e){return Ja(t.getUTCHours()%12||12,e,2)}function KOt(t,e){return Ja(1+lie.count(ey(t),t),e,3)}function oBe(t,e){return Ja(t.getUTCMilliseconds(),e,3)}function ZOt(t,e){return oBe(t,e)+"000"}function YOt(t,e){return Ja(t.getUTCMonth()+1,e,2)}function XOt(t,e){return Ja(t.getUTCMinutes(),e,2)}function QOt(t,e){return Ja(t.getUTCSeconds(),e,2)}function JOt(t){var e=t.getUTCDay();return e===0?7:e}function e8t(t,e){return Ja(die.count(ey(t)-1,t),e,2)}function lBe(t){var e=t.getUTCDay();return e>=4||e===0?jC(t):jC.ceil(t)}function t8t(t,e){return t=lBe(t),Ja(jC.count(ey(t),t)+(ey(t).getUTCDay()===4),e,2)}function r8t(t){return t.getUTCDay()}function n8t(t,e){return Ja(Mre.count(ey(t)-1,t),e,2)}function s8t(t,e){return Ja(t.getUTCFullYear()%100,e,2)}function i8t(t,e){return t=lBe(t),Ja(t.getUTCFullYear()%100,e,2)}function a8t(t,e){return Ja(t.getUTCFullYear()%1e4,e,4)}function o8t(t,e){var n=t.getUTCDay();return t=n>=4||n===0?jC(t):jC.ceil(t),Ja(t.getUTCFullYear()%1e4,e,4)}function l8t(){return"+0000"}function iCe(){return"%"}function aCe(t){return+t}function oCe(t){return Math.floor(+t/1e3)}var nS,cBe,dBe;c8t({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 c8t(t){return nS=cOt(t),cBe=nS.format,nS.parse,dBe=nS.utcFormat,nS.utcParse,nS}function d8t(t){return new Date(t)}function u8t(t){return t instanceof Date?+t:+new Date(+t)}function t0e(t,e,n,s,i,o,c,a,h,m){var x=$ye(),v=x.invert,w=x.domain,k=m(".%L"),C=m(":%S"),S=m("%I:%M"),T=m("%I %p"),I=m("%a %d"),A=m("%b %d"),D=m("%B"),$=m("%Y");function F(q){return(h(q)e(i/(t.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(i,o)=>eLt(t,o/s))},n.copy=function(){return pBe(e).domain(t)},ly.apply(n,arguments)}function hie(){var t=0,e=.5,n=1,s=1,i,o,c,a,h,m=Cu,x,v=!1,w;function k(S){return isNaN(S=+S)?w:(S=.5+((S=+x(S))-o)*(s*Se}var yBe=y8t,v8t=fie,_8t=yBe,b8t=g5;function w8t(t){return t&&t.length?v8t(t,b8t,_8t):void 0}var j8t=w8t;const pie=Da(j8t);function k8t(t,e){return tt.e^o.s<0?1:-1;for(s=o.d.length,i=t.d.length,e=0,n=st.d[e]^o.s<0?1:-1;return s===i?0:s>i^o.s<0?1:-1};ys.decimalPlaces=ys.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*ol;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};ys.dividedBy=ys.div=function(t){return Ux(this,new this.constructor(t))};ys.dividedToIntegerBy=ys.idiv=function(t){var e=this,n=e.constructor;return Lo(Ux(e,new n(t),0,1),n.precision)};ys.equals=ys.eq=function(t){return!this.cmp(t)};ys.exponent=function(){return kc(this)};ys.greaterThan=ys.gt=function(t){return this.cmp(t)>0};ys.greaterThanOrEqualTo=ys.gte=function(t){return this.cmp(t)>=0};ys.isInteger=ys.isint=function(){return this.e>this.d.length-2};ys.isNegative=ys.isneg=function(){return this.s<0};ys.isPositive=ys.ispos=function(){return this.s>0};ys.isZero=function(){return this.s===0};ys.lessThan=ys.lt=function(t){return this.cmp(t)<0};ys.lessThanOrEqualTo=ys.lte=function(t){return this.cmp(t)<1};ys.logarithm=ys.log=function(t){var e,n=this,s=n.constructor,i=s.precision,o=i+5;if(t===void 0)t=new s(10);else if(t=new s(t),t.s<1||t.eq(zh))throw Error(Xf+"NaN");if(n.s<1)throw Error(Xf+(n.s?"NaN":"-Infinity"));return n.eq(zh)?new s(0):(yl=!1,e=Ux(vE(n,o),vE(t,o),o),yl=!0,Lo(e,i))};ys.minus=ys.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?jBe(e,t):bBe(e,(t.s=-t.s,t))};ys.modulo=ys.mod=function(t){var e,n=this,s=n.constructor,i=s.precision;if(t=new s(t),!t.s)throw Error(Xf+"NaN");return n.s?(yl=!1,e=Ux(n,t,0,1).times(t),yl=!0,n.minus(e)):Lo(new s(n),i)};ys.naturalExponential=ys.exp=function(){return wBe(this)};ys.naturalLogarithm=ys.ln=function(){return vE(this)};ys.negated=ys.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};ys.plus=ys.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?bBe(e,t):jBe(e,(t.s=-t.s,t))};ys.precision=ys.sd=function(t){var e,n,s,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(pj+t);if(e=kc(i)+1,s=i.d.length-1,n=s*ol+1,s=i.d[s],s){for(;s%10==0;s/=10)n--;for(s=i.d[0];s>=10;s/=10)n++}return t&&e>n?e:n};ys.squareRoot=ys.sqrt=function(){var t,e,n,s,i,o,c,a=this,h=a.constructor;if(a.s<1){if(!a.s)return new h(0);throw Error(Xf+"NaN")}for(t=kc(a),yl=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=ag(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=_5((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),s=new h(e)):s=new h(i.toString()),n=h.precision,i=c=n+3;;)if(o=s,s=o.plus(Ux(a,o,c+2)).times(.5),ag(o.d).slice(0,c)===(e=ag(s.d)).slice(0,c)){if(e=e.slice(c-3,c+1),i==c&&e=="4999"){if(Lo(o,n+1,0),o.times(o).eq(a)){s=o;break}}else if(e!="9999")break;c+=4}return yl=!0,Lo(s,n)};ys.times=ys.mul=function(t){var e,n,s,i,o,c,a,h,m,x=this,v=x.constructor,w=x.d,k=(t=new v(t)).d;if(!x.s||!t.s)return new v(0);for(t.s*=x.s,n=x.e+t.e,h=w.length,m=k.length,h=0;){for(e=0,i=h+s;i>s;)a=o[i]+k[s]*w[i-s-1]+e,o[i--]=a%Jc|0,e=a/Jc|0;o[i]=(o[i]+e)%Jc|0}for(;!o[--c];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,yl?Lo(t,v.precision):t};ys.toDecimalPlaces=ys.todp=function(t,e){var n=this,s=n.constructor;return n=new s(n),t===void 0?n:(Ng(t,0,v5),e===void 0?e=s.rounding:Ng(e,0,8),Lo(n,t+kc(n)+1,e))};ys.toExponential=function(t,e){var n,s=this,i=s.constructor;return t===void 0?n=qj(s,!0):(Ng(t,0,v5),e===void 0?e=i.rounding:Ng(e,0,8),s=Lo(new i(s),t+1,e),n=qj(s,!0,t+1)),n};ys.toFixed=function(t,e){var n,s,i=this,o=i.constructor;return t===void 0?qj(i):(Ng(t,0,v5),e===void 0?e=o.rounding:Ng(e,0,8),s=Lo(new o(i),t+kc(i)+1,e),n=qj(s.abs(),!1,t+kc(s)+1),i.isneg()&&!i.isZero()?"-"+n:n)};ys.toInteger=ys.toint=function(){var t=this,e=t.constructor;return Lo(new e(t),kc(t)+1,e.rounding)};ys.toNumber=function(){return+this};ys.toPower=ys.pow=function(t){var e,n,s,i,o,c,a=this,h=a.constructor,m=12,x=+(t=new h(t));if(!t.s)return new h(zh);if(a=new h(a),!a.s){if(t.s<1)throw Error(Xf+"Infinity");return a}if(a.eq(zh))return a;if(s=h.precision,t.eq(zh))return Lo(a,s);if(e=t.e,n=t.d.length-1,c=e>=n,o=a.s,c){if((n=x<0?-x:x)<=_Be){for(i=new h(zh),e=Math.ceil(s/ol+4),yl=!1;n%2&&(i=i.times(a),dCe(i.d,e)),n=_5(n/2),n!==0;)a=a.times(a),dCe(a.d,e);return yl=!0,t.s<0?new h(zh).div(i):Lo(i,s)}}else if(o<0)throw Error(Xf+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,yl=!1,i=t.times(vE(a,s+m)),yl=!0,i=wBe(i),i.s=o,i};ys.toPrecision=function(t,e){var n,s,i=this,o=i.constructor;return t===void 0?(n=kc(i),s=qj(i,n<=o.toExpNeg||n>=o.toExpPos)):(Ng(t,1,v5),e===void 0?e=o.rounding:Ng(e,0,8),i=Lo(new o(i),t,e),n=kc(i),s=qj(i,t<=n||n<=o.toExpNeg,t)),s};ys.toSignificantDigits=ys.tosd=function(t,e){var n=this,s=n.constructor;return t===void 0?(t=s.precision,e=s.rounding):(Ng(t,1,v5),e===void 0?e=s.rounding:Ng(e,0,8)),Lo(new s(n),t,e)};ys.toString=ys.valueOf=ys.val=ys.toJSON=ys[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=kc(t),n=t.constructor;return qj(t,e<=n.toExpNeg||e>=n.toExpPos)};function bBe(t,e){var n,s,i,o,c,a,h,m,x=t.constructor,v=x.precision;if(!t.s||!e.s)return e.s||(e=new x(t)),yl?Lo(e,v):e;if(h=t.d,m=e.d,c=t.e,i=e.e,h=h.slice(),o=c-i,o){for(o<0?(s=h,o=-o,a=m.length):(s=m,i=c,a=h.length),c=Math.ceil(v/ol),a=c>a?c+1:a+1,o>a&&(o=a,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(a=h.length,o=m.length,a-o<0&&(o=a,s=m,m=h,h=s),n=0;o;)n=(h[--o]=h[o]+m[o]+n)/Jc|0,h[o]%=Jc;for(n&&(h.unshift(n),++i),a=h.length;h[--a]==0;)h.pop();return e.d=h,e.e=i,yl?Lo(e,v):e}function Ng(t,e,n){if(t!==~~t||tn)throw Error(pj+t)}function ag(t){var e,n,s,i=t.length-1,o="",c=t[0];if(i>0){for(o+=c,e=1;ec?1:-1;else for(a=h=0;ai[a]?1:-1;break}return h}function n(s,i,o){for(var c=0;o--;)s[o]-=c,c=s[o]1;)s.shift()}return function(s,i,o,c){var a,h,m,x,v,w,k,C,S,T,I,A,D,$,F,q,W,K,Z=s.constructor,re=s.s==i.s?1:-1,he=s.d,ue=i.d;if(!s.s)return new Z(s);if(!i.s)throw Error(Xf+"Division by zero");for(h=s.e-i.e,W=ue.length,F=he.length,k=new Z(re),C=k.d=[],m=0;ue[m]==(he[m]||0);)++m;if(ue[m]>(he[m]||0)&&--h,o==null?A=o=Z.precision:c?A=o+(kc(s)-kc(i))+1:A=o,A<0)return new Z(0);if(A=A/ol+2|0,m=0,W==1)for(x=0,ue=ue[0],A++;(m1&&(ue=t(ue,x),he=t(he,x),W=ue.length,F=he.length),$=W,S=he.slice(0,W),T=S.length;T=Jc/2&&++q;do x=0,a=e(ue,S,W,T),a<0?(I=S[0],W!=T&&(I=I*Jc+(S[1]||0)),x=I/q|0,x>1?(x>=Jc&&(x=Jc-1),v=t(ue,x),w=v.length,T=S.length,a=e(v,S,w,T),a==1&&(x--,n(v,W16)throw Error(s0e+kc(t));if(!t.s)return new x(zh);for(yl=!1,a=v,c=new x(.03125);t.abs().gte(.1);)t=t.times(c),m+=5;for(s=Math.log(fw(2,m))/Math.LN10*2+5|0,a+=s,n=i=o=new x(zh),x.precision=a;;){if(i=Lo(i.times(t),a),n=n.times(++h),c=o.plus(Ux(i,n,a)),ag(c.d).slice(0,a)===ag(o.d).slice(0,a)){for(;m--;)o=Lo(o.times(o),a);return x.precision=v,e==null?(yl=!0,Lo(o,v)):o}o=c}}function kc(t){for(var e=t.e*ol,n=t.d[0];n>=10;n/=10)e++;return e}function Gce(t,e,n){if(e>t.LN10.sd())throw yl=!0,n&&(t.precision=n),Error(Xf+"LN10 precision limit exceeded");return Lo(new t(t.LN10),e)}function f0(t){for(var e="";t--;)e+="0";return e}function vE(t,e){var n,s,i,o,c,a,h,m,x,v=1,w=10,k=t,C=k.d,S=k.constructor,T=S.precision;if(k.s<1)throw Error(Xf+(k.s?"NaN":"-Infinity"));if(k.eq(zh))return new S(0);if(e==null?(yl=!1,m=T):m=e,k.eq(10))return e==null&&(yl=!0),Gce(S,m);if(m+=w,S.precision=m,n=ag(C),s=n.charAt(0),o=kc(k),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)k=k.times(t),n=ag(k.d),s=n.charAt(0),v++;o=kc(k),s>1?(k=new S("0."+n),o++):k=new S(s+"."+n.slice(1))}else return h=Gce(S,m+2,T).times(o+""),k=vE(new S(s+"."+n.slice(1)),m-w).plus(h),S.precision=T,e==null?(yl=!0,Lo(k,T)):k;for(a=c=k=Ux(k.minus(zh),k.plus(zh),m),x=Lo(k.times(k),m),i=3;;){if(c=Lo(c.times(x),m),h=a.plus(Ux(c,new S(i),m)),ag(h.d).slice(0,m)===ag(a.d).slice(0,m))return a=a.times(2),o!==0&&(a=a.plus(Gce(S,m+2,T).times(o+""))),a=Ux(a,new S(v),m),S.precision=T,e==null?(yl=!0,Lo(a,T)):a;a=h,i+=2}}function cCe(t,e){var n,s,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(s=e.search(/e/i))>0?(n<0&&(n=s),n+=+e.slice(s+1),e=e.substring(0,s)):n<0&&(n=e.length),s=0;e.charCodeAt(s)===48;)++s;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(s,i),e){if(i-=s,n=n-s-1,t.e=_5(n/ol),t.d=[],s=(n+1)%ol,n<0&&(s+=ol),sTre||t.e<-Tre))throw Error(s0e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Lo(t,e,n){var s,i,o,c,a,h,m,x,v=t.d;for(c=1,o=v[0];o>=10;o/=10)c++;if(s=e-c,s<0)s+=ol,i=e,m=v[x=0];else{if(x=Math.ceil((s+1)/ol),o=v.length,x>=o)return t;for(m=o=v[x],c=1;o>=10;o/=10)c++;s%=ol,i=s-ol+c}if(n!==void 0&&(o=fw(10,c-i-1),a=m/o%10|0,h=e<0||v[x+1]!==void 0||m%o,h=n<4?(a||h)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||h||n==6&&(s>0?i>0?m/fw(10,c-i):0:v[x-1])%10&1||n==(t.s<0?8:7))),e<1||!v[0])return h?(o=kc(t),v.length=1,e=e-o-1,v[0]=fw(10,(ol-e%ol)%ol),t.e=_5(-e/ol)||0):(v.length=1,v[0]=t.e=t.s=0),t;if(s==0?(v.length=x,o=1,x--):(v.length=x+1,o=fw(10,ol-s),v[x]=i>0?(m/fw(10,c-i)%fw(10,i)|0)*o:0),h)for(;;)if(x==0){(v[0]+=o)==Jc&&(v[0]=1,++t.e);break}else{if(v[x]+=o,v[x]!=Jc)break;v[x--]=0,o=1}for(s=v.length;v[--s]===0;)v.pop();if(yl&&(t.e>Tre||t.e<-Tre))throw Error(s0e+kc(t));return t}function jBe(t,e){var n,s,i,o,c,a,h,m,x,v,w=t.constructor,k=w.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new w(t),yl?Lo(e,k):e;if(h=t.d,v=e.d,s=e.e,m=t.e,h=h.slice(),c=m-s,c){for(x=c<0,x?(n=h,c=-c,a=v.length):(n=v,s=m,a=h.length),i=Math.max(Math.ceil(k/ol),a)+2,c>i&&(c=i,n.length=1),n.reverse(),i=c;i--;)n.push(0);n.reverse()}else{for(i=h.length,a=v.length,x=i0;--i)h[a++]=0;for(i=v.length;i>c;){if(h[--i]0?o=o.charAt(0)+"."+o.slice(1)+f0(s):c>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+f0(-i-1)+o,n&&(s=n-c)>0&&(o+=f0(s))):i>=c?(o+=f0(i+1-c),n&&(s=n-i-1)>0&&(o=o+"."+f0(s))):((s=i+1)0&&(i+1===c&&(o+="."),o+=f0(s))),t.s<0?"-"+o:o}function dCe(t,e){if(t.length>e)return t.length=e,!0}function kBe(t){var e,n,s;function i(o){var c=this;if(!(c instanceof i))return new i(o);if(c.constructor=i,o instanceof i){c.s=o.s,c.e=o.e,c.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(pj+o);if(o>0)c.s=1;else if(o<0)o=-o,c.s=-1;else{c.s=0,c.e=0,c.d=[0];return}if(o===~~o&&o<1e7){c.e=0,c.d=[o];return}return cCe(c,o.toString())}else if(typeof o!="string")throw Error(pj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),c.s=-1):c.s=1,H8t.test(o))cCe(c,o);else throw Error(pj+o)}if(i.prototype=ys,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=kBe,i.config=i.set=W8t,t===void 0&&(t={}),t)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&s<=i[e+2])this[n]=s;else throw Error(pj+n+": "+s);if((s=t[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(pj+n+": "+s);return this}var i0e=kBe(V8t);zh=new i0e(1);const Co=i0e;function G8t(t){return X8t(t)||Y8t(t)||Z8t(t)||K8t()}function K8t(){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 Z8t(t,e){if(t){if(typeof t=="string")return Ofe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ofe(t,e)}}function Y8t(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function X8t(t){if(Array.isArray(t))return Ofe(t)}function Ofe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=e?n.apply(void 0,i):t(e-c,uCe(function(){for(var a=arguments.length,h=new Array(a),m=0;mt.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],s=!0,i=!1,o=void 0;try{for(var c=t[Symbol.iterator](),a;!(s=(a=c.next()).done)&&(n.push(a.value),!(e&&n.length===e));s=!0);}catch(h){i=!0,o=h}finally{try{!s&&c.return!=null&&c.return()}finally{if(i)throw o}}return n}}function hDt(t){if(Array.isArray(t))return t}function TBe(t){var e=_E(t,2),n=e[0],s=e[1],i=n,o=s;return n>s&&(i=s,o=n),[i,o]}function ABe(t,e,n){if(t.lte(0))return new Co(0);var s=yie.getDigitCount(t.toNumber()),i=new Co(10).pow(s),o=t.div(i),c=s!==1?.05:.1,a=new Co(Math.ceil(o.div(c).toNumber())).add(n).mul(c),h=a.mul(i);return e?h:new Co(Math.ceil(h))}function fDt(t,e,n){var s=1,i=new Co(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(s=new Co(10).pow(yie.getDigitCount(t)-1),i=new Co(Math.floor(i.div(s).toNumber())).mul(s)):o>1&&(i=new Co(Math.floor(t)))}else t===0?i=new Co(Math.floor((e-1)/2)):n||(i=new Co(Math.floor(t)));var c=Math.floor((e-1)/2),a=tDt(eDt(function(h){return i.add(new Co(h-c).mul(s)).toNumber()}),Dfe);return a(0,e)}function EBe(t,e,n,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Co(0),tickMin:new Co(0),tickMax:new Co(0)};var o=ABe(new Co(e).sub(t).div(n-1),s,i),c;t<=0&&e>=0?c=new Co(0):(c=new Co(t).add(e).div(2),c=c.sub(new Co(c).mod(o)));var a=Math.ceil(c.sub(t).div(o).toNumber()),h=Math.ceil(new Co(e).sub(c).div(o).toNumber()),m=a+h+1;return m>n?EBe(t,e,n,s,i+1):(m0?h+(n-m):h,a=e>0?a:a+(n-m)),{step:o,tickMin:c.sub(new Co(a).mul(o)),tickMax:c.add(new Co(h).mul(o))})}function pDt(t){var e=_E(t,2),n=e[0],s=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=Math.max(i,2),a=TBe([n,s]),h=_E(a,2),m=h[0],x=h[1];if(m===-1/0||x===1/0){var v=x===1/0?[m].concat(Ffe(Dfe(0,i-1).map(function(){return 1/0}))):[].concat(Ffe(Dfe(0,i-1).map(function(){return-1/0})),[x]);return n>s?Rfe(v):v}if(m===x)return fDt(m,i,o);var w=EBe(m,x,c,o),k=w.step,C=w.tickMin,S=w.tickMax,T=yie.rangeStep(C,S.add(new Co(.1).mul(k)),k);return n>s?Rfe(T):T}function mDt(t,e){var n=_E(t,2),s=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=TBe([s,i]),a=_E(c,2),h=a[0],m=a[1];if(h===-1/0||m===1/0)return[s,i];if(h===m)return[h];var x=Math.max(e,2),v=ABe(new Co(m).sub(h).div(x-1),o,0),w=[].concat(Ffe(yie.rangeStep(new Co(h),new Co(m).sub(new Co(.99).mul(v)),v)),[m]);return s>i?Rfe(w):w}var gDt=CBe(pDt),xDt=CBe(mDt),yDt="Invariant failed";function Vj(t,e){throw new Error(yDt)}var vDt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function kC(t){"@babel/helpers - typeof";return kC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kC(t)}function Are(){return Are=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function SDt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function CDt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MDt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,c=-1,a=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(a<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var h=o.range,m=0;m0?i[m-1].coordinate:i[a-1].coordinate,v=i[m].coordinate,w=m>=a-1?i[0].coordinate:i[m+1].coordinate,k=void 0;if(Nu(v-x)!==Nu(w-v)){var C=[];if(Nu(w-v)===Nu(h[1]-h[0])){k=w;var S=v+h[1]-h[0];C[0]=Math.min(S,(S+x)/2),C[1]=Math.max(S,(S+x)/2)}else{k=x;var T=w+h[1]-h[0];C[0]=Math.min(v,(T+v)/2),C[1]=Math.max(v,(T+v)/2)}var I=[Math.min(v,(k+v)/2),Math.max(v,(k+v)/2)];if(e>I[0]&&e<=I[1]||e>=C[0]&&e<=C[1]){c=i[m].index;break}}else{var A=Math.min(x,w),D=Math.max(x,w);if(e>(A+v)/2&&e<=(D+v)/2){c=i[m].index;break}}}else for(var $=0;$0&&$(s[$].coordinate+s[$-1].coordinate)/2&&e<=(s[$].coordinate+s[$+1].coordinate)/2||$===a-1&&e>(s[$].coordinate+s[$-1].coordinate)/2){c=s[$].index;break}return c},a0e=function(e){var n,s=e,i=s.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Bl(Bl({},e.type.defaultProps),e.props):e.props,c=o.stroke,a=o.fill,h;switch(i){case"Line":h=c;break;case"Area":case"Radar":h=c&&c!=="none"?c:a;break;default:h=a;break}return h},HDt=function(e){var n=e.barSize,s=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var c={},a=Object.keys(o),h=0,m=a.length;h=0});if(I&&I.length){var A=I[0].type.defaultProps,D=A!==void 0?Bl(Bl({},A),I[0].props):I[0].props,$=D.barSize,F=D[T];c[F]||(c[F]=[]);var q=xa($)?n:$;c[F].push({item:I[0],stackList:I.slice(1),barSize:xa(q)?void 0:Su(q,s,0)})}}return c},WDt=function(e){var n=e.barGap,s=e.barCategoryGap,i=e.bandSize,o=e.sizeList,c=o===void 0?[]:o,a=e.maxBarSize,h=c.length;if(h<1)return null;var m=Su(n,i,0,!0),x,v=[];if(c[0].barSize===+c[0].barSize){var w=!1,k=i/h,C=c.reduce(function($,F){return $+F.barSize||0},0);C+=(h-1)*m,C>=i&&(C-=(h-1)*m,m=0),C>=i&&k>0&&(w=!0,k*=.9,C=h*k);var S=(i-C)/2>>0,T={offset:S-m,size:0};x=c.reduce(function($,F){var q={item:F.item,position:{offset:T.offset+T.size+m,size:w?k:F.barSize}},W=[].concat(pCe($),[q]);return T=W[W.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){W.push({item:K,position:T})}),W},v)}else{var I=Su(s,i,0,!0);i-2*I-(h-1)*m<=0&&(m=0);var A=(i-2*I-(h-1)*m)/h;A>1&&(A>>=0);var D=a===+a?Math.min(A,a):A;x=c.reduce(function($,F,q){var W=[].concat(pCe($),[{item:F.item,position:{offset:I+(A+m)*q+(A-D)/2,size:D}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){W.push({item:K,position:W[W.length-1].position})}),W},v)}return x},GDt=function(e,n,s,i){var o=s.children,c=s.width,a=s.margin,h=c-(a.left||0)-(a.right||0),m=OBe({children:o,legendWidth:h});if(m){var x=i||{},v=x.width,w=x.height,k=m.align,C=m.verticalAlign,S=m.layout;if((S==="vertical"||S==="horizontal"&&C==="middle")&&k!=="center"&&On(e[k]))return Bl(Bl({},e),{},T4({},k,e[k]+(v||0)));if((S==="horizontal"||S==="vertical"&&k==="center")&&C!=="middle"&&On(e[C]))return Bl(Bl({},e),{},T4({},C,e[C]+(w||0)))}return e},KDt=function(e,n,s){return xa(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},DBe=function(e,n,s,i,o){var c=n.props.children,a=Gf(c,vie).filter(function(m){return KDt(i,o,m.props.direction)});if(a&&a.length){var h=a.map(function(m){return m.props.dataKey});return e.reduce(function(m,x){var v=Wd(x,s);if(xa(v))return m;var w=Array.isArray(v)?[mie(v),pie(v)]:[v,v],k=h.reduce(function(C,S){var T=Wd(x,S,0),I=w[0]-Math.abs(Array.isArray(T)?T[0]:T),A=w[1]+Math.abs(Array.isArray(T)?T[1]:T);return[Math.min(I,C[0]),Math.max(A,C[1])]},[1/0,-1/0]);return[Math.min(k[0],m[0]),Math.max(k[1],m[1])]},[1/0,-1/0])}return null},ZDt=function(e,n,s,i,o){var c=n.map(function(a){return DBe(e,a,s,o,i)}).filter(function(a){return!xa(a)});return c&&c.length?c.reduce(function(a,h){return[Math.min(a[0],h[0]),Math.max(a[1],h[1])]},[1/0,-1/0]):null},RBe=function(e,n,s,i,o){var c=n.map(function(h){var m=h.props.dataKey;return s==="number"&&m&&DBe(e,h,m,i)||hA(e,m,s,o)});if(s==="number")return c.reduce(function(h,m){return[Math.min(h[0],m[0]),Math.max(h[1],m[1])]},[1/0,-1/0]);var a={};return c.reduce(function(h,m){for(var x=0,v=m.length;x=2?Nu(a[0]-a[1])*2*m:m,n&&(e.ticks||e.niceTicks)){var x=(e.ticks||e.niceTicks).map(function(v){var w=o?o.indexOf(v):v;return{coordinate:i(w)+m,value:v,offset:m}});return x.filter(function(v){return!MI(v.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(v,w){return{coordinate:i(v)+m,value:v,index:w,offset:m}}):i.ticks&&!s?i.ticks(e.tickCount).map(function(v){return{coordinate:i(v)+m,value:v,offset:m}}):i.domain().map(function(v,w){return{coordinate:i(v)+m,value:o?o[v]:v,index:w,offset:m}})},Kce=new WeakMap,FL=function(e,n){if(typeof n!="function")return e;Kce.has(e)||Kce.set(e,new WeakMap);var s=Kce.get(e);if(s.has(n))return s.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,i),i},BBe=function(e,n,s){var i=e.scale,o=e.type,c=e.layout,a=e.axisType;if(i==="auto")return c==="radial"&&a==="radiusAxis"?{scale:pE(),realScaleType:"band"}:c==="radial"&&a==="angleAxis"?{scale:Nre(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:uA(),realScaleType:"point"}:o==="category"?{scale:pE(),realScaleType:"band"}:{scale:Nre(),realScaleType:"linear"};if(Bj(i)){var h="scale".concat(Jse(i));return{scale:(lCe[h]||uA)(),realScaleType:lCe[h]?h:"point"}}return Oi(i)?{scale:i}:{scale:uA(),realScaleType:"point"}},gCe=1e-4,$Be=function(e){var n=e.domain();if(!(!n||n.length<=2)){var s=n.length,i=e.range(),o=Math.min(i[0],i[1])-gCe,c=Math.max(i[0],i[1])+gCe,a=e(n[0]),h=e(n[s-1]);(ac||hc)&&e.domain([n[0],n[s-1]])}},YDt=function(e,n){if(!e)return null;for(var s=0,i=e.length;si)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[a][s][0]=o,e[a][s][1]=o+h,o=e[a][s][1]):(e[a][s][0]=c,e[a][s][1]=c+h,c=e[a][s][1])}},JDt=function(e){var n=e.length;if(!(n<=0))for(var s=0,i=e[0].length;s=0?(e[c][s][0]=o,e[c][s][1]=o+a,o=e[c][s][1]):(e[c][s][0]=0,e[c][s][1]=0)}},eRt={sign:QDt,expand:vCt,none:gC,silhouette:_Ct,wiggle:bCt,positive:JDt},tRt=function(e,n,s){var i=n.map(function(a){return a.props.dataKey}),o=eRt[s],c=yCt().keys(i).value(function(a,h){return+Wd(a,h,0)}).order(ufe).offset(o);return c(e)},rRt=function(e,n,s,i,o,c){if(!e)return null;var a=c?n.reverse():n,h={},m=a.reduce(function(v,w){var k,C=(k=w.type)!==null&&k!==void 0&&k.defaultProps?Bl(Bl({},w.type.defaultProps),w.props):w.props,S=C.stackId,T=C.hide;if(T)return v;var I=C[s],A=v[I]||{hasStack:!1,stackGroups:{}};if(Fc(S)){var D=A.stackGroups[S]||{numericAxisId:s,cateAxisId:i,items:[]};D.items.push(w),A.hasStack=!0,A.stackGroups[S]=D}else A.stackGroups[TI("_stackId_")]={numericAxisId:s,cateAxisId:i,items:[w]};return Bl(Bl({},v),{},T4({},I,A))},h),x={};return Object.keys(m).reduce(function(v,w){var k=m[w];if(k.hasStack){var C={};k.stackGroups=Object.keys(k.stackGroups).reduce(function(S,T){var I=k.stackGroups[T];return Bl(Bl({},S),{},T4({},T,{numericAxisId:s,cateAxisId:i,items:I.items,stackedData:tRt(e,I.items,o)}))},C)}return Bl(Bl({},v),{},T4({},w,k))},x)},UBe=function(e,n){var s=n.realScaleType,i=n.type,o=n.tickCount,c=n.originalDomain,a=n.allowDecimals,h=s||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&i==="number"&&c&&(c[0]==="auto"||c[1]==="auto")){var m=e.domain();if(!m.length)return null;var x=gDt(m,o,a);return e.domain([mie(x),pie(x)]),{niceTicks:x}}if(o&&i==="number"){var v=e.domain(),w=xDt(v,o,a);return{niceTicks:w}}return null},xCe=function(e){var n=e.axis,s=e.ticks,i=e.offset,o=e.bandSize,c=e.entry,a=e.index;if(n.type==="category")return s[a]?s[a].coordinate+i:null;var h=Wd(c,n.dataKey,n.domain[a]);return xa(h)?null:n.scale(h)-o/2+i},nRt=function(e){var n=e.numericAxis,s=n.scale.domain();if(n.type==="number"){var i=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return i<=0&&o>=0?0:o<0?o:i}return s[0]},sRt=function(e,n){var s,i=(s=e.type)!==null&&s!==void 0&&s.defaultProps?Bl(Bl({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(Fc(o)){var c=n[o];if(c){var a=c.items.indexOf(e);return a>=0?c.stackedData[a]:null}}return null},iRt=function(e){return e.reduce(function(n,s){return[mie(s.concat([n[0]]).filter(On)),pie(s.concat([n[1]]).filter(On))]},[1/0,-1/0])},qBe=function(e,n,s){return Object.keys(e).reduce(function(i,o){var c=e[o],a=c.stackedData,h=a.reduce(function(m,x){var v=iRt(x.slice(n,s+1));return[Math.min(m[0],v[0]),Math.max(m[1],v[1])]},[1/0,-1/0]);return[Math.min(h[0],i[0]),Math.max(h[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},yCe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vCe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ufe=function(e,n,s){if(Oi(e))return e(n,s);if(!Array.isArray(e))return n;var i=[];if(On(e[0]))i[0]=s?e[0]:Math.min(e[0],n[0]);else if(yCe.test(e[0])){var o=+yCe.exec(e[0])[1];i[0]=n[0]-o}else Oi(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(On(e[1]))i[1]=s?e[1]:Math.max(e[1],n[1]);else if(vCe.test(e[1])){var c=+vCe.exec(e[1])[1];i[1]=n[1]+c}else Oi(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},Ire=function(e,n,s){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!s||i>0)return i}if(e&&n&&n.length>=2){for(var o=Lye(n,function(v){return v.coordinate}),c=1/0,a=1,h=o.length;at.length)&&(e=t.length);for(var n=0,s=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},pRt=function(e,n,s,i,o){var c=e.width,a=e.height,h=e.startAngle,m=e.endAngle,x=Su(e.cx,c,c/2),v=Su(e.cy,a,a/2),w=WBe(c,a,s),k=Su(e.innerRadius,w,0),C=Su(e.outerRadius,w,w*.8),S=Object.keys(n);return S.reduce(function(T,I){var A=n[I],D=A.domain,$=A.reversed,F;if(xa(A.range))i==="angleAxis"?F=[h,m]:i==="radiusAxis"&&(F=[k,C]),$&&(F=[F[1],F[0]]);else{F=A.range;var q=F,W=lRt(q,2);h=W[0],m=W[1]}var K=BBe(A,o),Z=K.realScaleType,re=K.scale;re.domain(D).range(F),$Be(re);var he=UBe(re,mx(mx({},A),{},{realScaleType:Z})),ue=mx(mx(mx({},A),he),{},{range:F,radius:C,realScaleType:Z,scale:re,cx:x,cy:v,innerRadius:k,outerRadius:C,startAngle:h,endAngle:m});return mx(mx({},T),{},HBe({},I,ue))},{})},mRt=function(e,n){var s=e.x,i=e.y,o=n.x,c=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(i-c,2))},gRt=function(e,n){var s=e.x,i=e.y,o=n.cx,c=n.cy,a=mRt({x:s,y:i},{x:o,y:c});if(a<=0)return{radius:a};var h=(s-o)/a,m=Math.acos(h);return i>c&&(m=2*Math.PI-m),{radius:a,angle:fRt(m),angleInRadian:m}},xRt=function(e){var n=e.startAngle,s=e.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),c=Math.min(i,o);return{startAngle:n-c*360,endAngle:s-c*360}},yRt=function(e,n){var s=n.startAngle,i=n.endAngle,o=Math.floor(s/360),c=Math.floor(i/360),a=Math.min(o,c);return e+a*360},jCe=function(e,n){var s=e.x,i=e.y,o=gRt({x:s,y:i},n),c=o.radius,a=o.angle,h=n.innerRadius,m=n.outerRadius;if(cm)return!1;if(c===0)return!0;var x=xRt(n),v=x.startAngle,w=x.endAngle,k=a,C;if(v<=w){for(;k>w;)k-=360;for(;k=v&&k<=w}else{for(;k>v;)k-=360;for(;k=w&&k<=v}return C?mx(mx({},n),{},{radius:c,angle:yRt(k,n)}):null},GBe=function(e){return!P.isValidElement(e)&&!Oi(e)&&typeof e!="boolean"?e.className:""};function kE(t){"@babel/helpers - typeof";return kE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kE(t)}var vRt=["offset"];function _Rt(t){return kRt(t)||jRt(t)||wRt(t)||bRt()}function bRt(){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 wRt(t,e){if(t){if(typeof t=="string")return qfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qfe(t,e)}}function jRt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kRt(t){if(Array.isArray(t))return qfe(t)}function qfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function SRt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function kCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Ac(t){for(var e=1;e=0?1:-1,D,$;i==="insideStart"?(D=k+A*c,$=S):i==="insideEnd"?(D=C-A*c,$=!S):i==="end"&&(D=C+A*c,$=S),$=I<=0?$:!$;var F=Ko(m,x,T,D),q=Ko(m,x,T,D+($?1:-1)*359),W="M".concat(F.x,",").concat(F.y,` A`).concat(T,",").concat(T,",0,1,").concat($?0:1,`, `).concat(q.x,",").concat(q.y),K=xa(e.id)?TI("recharts-radial-line-"):e.id;return lt.createElement("text",NE({},s,{dominantBaseline:"central",className:ra("recharts-radial-bar-label",a)}),lt.createElement("defs",null,lt.createElement("path",{id:K,d:W})),lt.createElement("textPath",{xlinkHref:"#".concat(K)},n))},PRt=function(e){var n=e.viewBox,s=e.offset,i=e.position,o=n,c=o.cx,a=o.cy,h=o.innerRadius,m=o.outerRadius,x=o.startAngle,v=o.endAngle,w=(x+v)/2;if(i==="outside"){var k=Ko(c,a,m+s,w),C=k.x,S=k.y;return{x:C,y:S,textAnchor:C>=c?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:c,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:c,y:a,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:c,y:a,textAnchor:"middle",verticalAnchor:"end"};var T=(h+m)/2,I=Ko(c,a,T,w),A=I.x,D=I.y;return{x:A,y:D,textAnchor:"middle",verticalAnchor:"middle"}},LRt=function(e){var n=e.viewBox,s=e.parentViewBox,i=e.offset,o=e.position,c=n,a=c.x,h=c.y,m=c.width,x=c.height,v=x>=0?1:-1,w=v*i,k=v>0?"end":"start",C=v>0?"start":"end",S=m>=0?1:-1,T=S*i,I=S>0?"end":"start",A=S>0?"start":"end";if(o==="top"){var D={x:a+m/2,y:h-v*i,textAnchor:"middle",verticalAnchor:k};return Ac(Ac({},D),s?{height:Math.max(h-s.y,0),width:m}:{})}if(o==="bottom"){var $={x:a+m/2,y:h+x+w,textAnchor:"middle",verticalAnchor:C};return Ac(Ac({},$),s?{height:Math.max(s.y+s.height-(h+x),0),width:m}:{})}if(o==="left"){var F={x:a-T,y:h+x/2,textAnchor:I,verticalAnchor:"middle"};return Ac(Ac({},F),s?{width:Math.max(F.x-s.x,0),height:x}:{})}if(o==="right"){var q={x:a+m+T,y:h+x/2,textAnchor:A,verticalAnchor:"middle"};return Ac(Ac({},q),s?{width:Math.max(s.x+s.width-q.x,0),height:x}:{})}var W=s?{width:m,height:x}:{};return o==="insideLeft"?Ac({x:a+T,y:h+x/2,textAnchor:A,verticalAnchor:"middle"},W):o==="insideRight"?Ac({x:a+m-T,y:h+x/2,textAnchor:I,verticalAnchor:"middle"},W):o==="insideTop"?Ac({x:a+m/2,y:h+w,textAnchor:"middle",verticalAnchor:C},W):o==="insideBottom"?Ac({x:a+m/2,y:h+x-w,textAnchor:"middle",verticalAnchor:k},W):o==="insideTopLeft"?Ac({x:a+T,y:h+w,textAnchor:A,verticalAnchor:C},W):o==="insideTopRight"?Ac({x:a+m-T,y:h+w,textAnchor:I,verticalAnchor:C},W):o==="insideBottomLeft"?Ac({x:a+T,y:h+x-w,textAnchor:A,verticalAnchor:k},W):o==="insideBottomRight"?Ac({x:a+m-T,y:h+x-w,textAnchor:I,verticalAnchor:k},W):d5(o)&&(On(o.x)||Tw(o.x))&&(On(o.y)||Tw(o.y))?Ac({x:a+Su(o.x,m),y:h+Su(o.y,x),textAnchor:"end",verticalAnchor:"end"},W):Ac({x:a+m/2,y:h+x/2,textAnchor:"middle",verticalAnchor:"middle"},W)},ORt=function(e){return"cx"in e&&On(e.cx)};function rd(t){var e=t.offset,n=e===void 0?5:e,s=NRt(t,vRt),i=Ac({offset:n},s),o=i.viewBox,c=i.position,a=i.value,h=i.children,m=i.content,x=i.className,v=x===void 0?"":x,w=i.textBreakAll;if(!o||xa(a)&&xa(h)&&!P.isValidElement(m)&&!Oi(m))return null;if(P.isValidElement(m))return P.cloneElement(m,i);var k;if(Oi(m)){if(k=P.createElement(m,i),P.isValidElement(k))return k}else k=ARt(i);var C=ORt(o),S=Ni(i,!0);if(C&&(c==="insideStart"||c==="insideEnd"||c==="end"))return IRt(i,k,S);var T=C?PRt(i):LRt(i);return lt.createElement(Uj,NE({className:ra("recharts-label",v)},S,T,{breakAll:w}),k)}rd.displayName="Label";var KBe=function(e){var n=e.cx,s=e.cy,i=e.angle,o=e.startAngle,c=e.endAngle,a=e.r,h=e.radius,m=e.innerRadius,x=e.outerRadius,v=e.x,w=e.y,k=e.top,C=e.left,S=e.width,T=e.height,I=e.clockWise,A=e.labelViewBox;if(A)return A;if(On(S)&&On(T)){if(On(v)&&On(w))return{x:v,y:w,width:S,height:T};if(On(k)&&On(C))return{x:k,y:C,width:S,height:T}}return On(v)&&On(w)?{x:v,y:w,width:0,height:0}:On(n)&&On(s)?{cx:n,cy:s,startAngle:o||i||0,endAngle:c||i||0,innerRadius:m||0,outerRadius:x||h||a||0,clockWise:I}:e.viewBox?e.viewBox:{}},DRt=function(e,n){return e?e===!0?lt.createElement(rd,{key:"label-implicit",viewBox:n}):Fc(e)?lt.createElement(rd,{key:"label-implicit",viewBox:n,value:e}):P.isValidElement(e)?e.type===rd?P.cloneElement(e,{key:"label-implicit",viewBox:n}):lt.createElement(rd,{key:"label-implicit",content:e,viewBox:n}):Oi(e)?lt.createElement(rd,{key:"label-implicit",content:e,viewBox:n}):d5(e)?lt.createElement(rd,NE({viewBox:n},e,{key:"label-implicit"})):null:null},RRt=function(e,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&s&&!e.label)return null;var i=e.children,o=KBe(e),c=Gf(i,rd).map(function(h,m){return P.cloneElement(h,{viewBox:n||o,key:"label-".concat(m)})});if(!s)return c;var a=DRt(e.label,n||o);return[a].concat(_Rt(c))};rd.parseViewBox=KBe;rd.renderCallByParent=RRt;function FRt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var zRt=FRt;const BRt=Da(zRt);function SE(t){"@babel/helpers - typeof";return SE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SE(t)}var $Rt=["valueAccessor"],URt=["data","dataKey","clockWise","id","textBreakAll"];function qRt(t){return GRt(t)||WRt(t)||HRt(t)||VRt()}function VRt(){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 HRt(t,e){if(t){if(typeof t=="string")return Vfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vfe(t,e)}}function WRt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function GRt(t){if(Array.isArray(t))return Vfe(t)}function Vfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function XRt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var QRt=function(e){return Array.isArray(e.value)?BRt(e.value):e.value};function b1(t){var e=t.valueAccessor,n=e===void 0?QRt:e,s=CCe(t,$Rt),i=s.data,o=s.dataKey,c=s.clockWise,a=s.id,h=s.textBreakAll,m=CCe(s,URt);return!i||!i.length?null:lt.createElement(vo,{className:"recharts-label-list"},i.map(function(x,v){var w=xa(o)?n(x,v):Wd(x&&x.payload,o),k=xa(a)?{}:{id:"".concat(a,"-").concat(v)};return lt.createElement(rd,Lre({},Ni(x,!0),m,k,{parentViewBox:x.parentViewBox,value:w,textBreakAll:h,viewBox:rd.parseViewBox(xa(c)?x:SCe(SCe({},x),{},{clockWise:c})),key:"label-".concat(v),index:v}))}))}b1.displayName="LabelList";function JRt(t,e){return t?t===!0?lt.createElement(b1,{key:"labelList-implicit",data:e}):lt.isValidElement(t)||Oi(t)?lt.createElement(b1,{key:"labelList-implicit",data:e,content:t}):d5(t)?lt.createElement(b1,Lre({data:e},t,{key:"labelList-implicit"})):null:null}function eFt(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var s=t.children,i=Gf(s,b1).map(function(c,a){return P.cloneElement(c,{data:e,key:"labelList-".concat(a)})});if(!n)return i;var o=JRt(t.label,e);return[o].concat(qRt(i))}b1.renderCallByParent=eFt;function CE(t){"@babel/helpers - typeof";return CE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},CE(t)}function Hfe(){return Hfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(c>m),`, `).concat(v.x,",").concat(v.y,` `);if(i>0){var k=Ko(n,s,i,c),C=Ko(n,s,i,m);w+="L ".concat(C.x,",").concat(C.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(h)>180),",").concat(+(c<=m),`, `).concat(k.x,",").concat(k.y," Z")}else w+="L ".concat(n,",").concat(s," Z");return w},iFt=function(e){var n=e.cx,s=e.cy,i=e.innerRadius,o=e.outerRadius,c=e.cornerRadius,a=e.forceCornerRadius,h=e.cornerIsExternal,m=e.startAngle,x=e.endAngle,v=Nu(x-m),w=zL({cx:n,cy:s,radius:o,angle:m,sign:v,cornerRadius:c,cornerIsExternal:h}),k=w.circleTangency,C=w.lineTangency,S=w.theta,T=zL({cx:n,cy:s,radius:o,angle:x,sign:-v,cornerRadius:c,cornerIsExternal:h}),I=T.circleTangency,A=T.lineTangency,D=T.theta,$=h?Math.abs(m-x):Math.abs(m-x)-S-D;if($<0)return a?"M ".concat(C.x,",").concat(C.y,` a`).concat(c,",").concat(c,",0,0,1,").concat(c*2,`,0 a`).concat(c,",").concat(c,",0,0,1,").concat(-c*2,`,0 `):ZBe({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:m,endAngle:x});var F="M ".concat(C.x,",").concat(C.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(k.x,",").concat(k.y,` A`).concat(o,",").concat(o,",0,").concat(+($>180),",").concat(+(v<0),",").concat(I.x,",").concat(I.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(A.x,",").concat(A.y,` `);if(i>0){var q=zL({cx:n,cy:s,radius:i,angle:m,sign:v,isExternal:!0,cornerRadius:c,cornerIsExternal:h}),W=q.circleTangency,K=q.lineTangency,Z=q.theta,re=zL({cx:n,cy:s,radius:i,angle:x,sign:-v,isExternal:!0,cornerRadius:c,cornerIsExternal:h}),he=re.circleTangency,ue=re.lineTangency,je=re.theta,ne=h?Math.abs(m-x):Math.abs(m-x)-Z-je;if(ne<0&&c===0)return"".concat(F,"L").concat(n,",").concat(s,"Z");F+="L".concat(ue.x,",").concat(ue.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(he.x,",").concat(he.y,` A`).concat(i,",").concat(i,",0,").concat(+(ne>180),",").concat(+(v>0),",").concat(W.x,",").concat(W.y,` A`).concat(c,",").concat(c,",0,0,").concat(+(v<0),",").concat(K.x,",").concat(K.y,"Z")}else F+="L".concat(n,",").concat(s,"Z");return F},aFt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},YBe=function(e){var n=TCe(TCe({},aFt),e),s=n.cx,i=n.cy,o=n.innerRadius,c=n.outerRadius,a=n.cornerRadius,h=n.forceCornerRadius,m=n.cornerIsExternal,x=n.startAngle,v=n.endAngle,w=n.className;if(c0&&Math.abs(x-v)<360?T=iFt({cx:s,cy:i,innerRadius:o,outerRadius:c,cornerRadius:Math.min(S,C/2),forceCornerRadius:h,cornerIsExternal:m,startAngle:x,endAngle:v}):T=ZBe({cx:s,cy:i,innerRadius:o,outerRadius:c,startAngle:x,endAngle:v}),lt.createElement("path",Hfe({},Ni(n,!0),{className:k,d:T,role:"img"}))};function ME(t){"@babel/helpers - typeof";return ME=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ME(t)}function Wfe(){return Wfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function NFt(t,e){return rk(t.getTime(),e.getTime())}function SFt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function CFt(t,e){return t===e}function RCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var i=new Array(s),o=t.entries(),c,a,h=0;(c=o.next())&&!c.done;){for(var m=e.entries(),x=!1,v=0;(a=m.next())&&!a.done;){if(i[v]){v++;continue}var w=c.value,k=a.value;if(n.equals(w[0],k[0],h,v,t,e,n)&&n.equals(w[1],k[1],w[0],k[0],t,e,n)){x=i[v]=!0;break}v++}if(!x)return!1;h++}return!0}var MFt=rk;function TFt(t,e,n){var s=DCe(t),i=s.length;if(DCe(e).length!==i)return!1;for(;i-- >0;)if(!e9e(t,e,n,s[i]))return!1;return!0}function WM(t,e,n){var s=LCe(t),i=s.length;if(LCe(e).length!==i)return!1;for(var o,c,a;i-- >0;)if(o=s[i],!e9e(t,e,n,o)||(c=OCe(t,o),a=OCe(e,o),(c||a)&&(!c||!a||c.configurable!==a.configurable||c.enumerable!==a.enumerable||c.writable!==a.writable)))return!1;return!0}function AFt(t,e){return rk(t.valueOf(),e.valueOf())}function EFt(t,e){return t.source===e.source&&t.flags===e.flags}function FCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var i=new Array(s),o=t.values(),c,a;(c=o.next())&&!c.done;){for(var h=e.values(),m=!1,x=0;(a=h.next())&&!a.done;){if(!i[x]&&n.equals(c.value,a.value,c.value,a.value,t,e,n)){m=i[x]=!0;break}x++}if(!m)return!1}return!0}function IFt(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function PFt(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function e9e(t,e,n,s){return(s===jFt||s===wFt||s===bFt)&&(t.$$typeof||e.$$typeof)?!0:_Ft(e,s)&&n.equals(t[s],e[s],s,s,t,e,n)}var LFt="[object Arguments]",OFt="[object Boolean]",DFt="[object Date]",RFt="[object Error]",FFt="[object Map]",zFt="[object Number]",BFt="[object Object]",$Ft="[object RegExp]",UFt="[object Set]",qFt="[object String]",VFt="[object URL]",HFt=Array.isArray,zCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,BCe=Object.assign,WFt=Object.prototype.toString.call.bind(Object.prototype.toString);function GFt(t){var e=t.areArraysEqual,n=t.areDatesEqual,s=t.areErrorsEqual,i=t.areFunctionsEqual,o=t.areMapsEqual,c=t.areNumbersEqual,a=t.areObjectsEqual,h=t.arePrimitiveWrappersEqual,m=t.areRegExpsEqual,x=t.areSetsEqual,v=t.areTypedArraysEqual,w=t.areUrlsEqual;return function(C,S,T){if(C===S)return!0;if(C==null||S==null)return!1;var I=typeof C;if(I!==typeof S)return!1;if(I!=="object")return I==="number"?c(C,S,T):I==="function"?i(C,S,T):!1;var A=C.constructor;if(A!==S.constructor)return!1;if(A===Object)return a(C,S,T);if(HFt(C))return e(C,S,T);if(zCe!=null&&zCe(C))return v(C,S,T);if(A===Date)return n(C,S,T);if(A===RegExp)return m(C,S,T);if(A===Map)return o(C,S,T);if(A===Set)return x(C,S,T);var D=WFt(C);return D===DFt?n(C,S,T):D===$Ft?m(C,S,T):D===FFt?o(C,S,T):D===UFt?x(C,S,T):D===BFt?typeof C.then!="function"&&typeof S.then!="function"&&a(C,S,T):D===VFt?w(C,S,T):D===RFt?s(C,S,T):D===LFt?a(C,S,T):D===OFt||D===zFt||D===qFt?h(C,S,T):!1}}function KFt(t){var e=t.circular,n=t.createCustomConfig,s=t.strict,i={areArraysEqual:s?WM:kFt,areDatesEqual:NFt,areErrorsEqual:SFt,areFunctionsEqual:CFt,areMapsEqual:s?PCe(RCe,WM):RCe,areNumbersEqual:MFt,areObjectsEqual:s?WM:TFt,arePrimitiveWrappersEqual:AFt,areRegExpsEqual:EFt,areSetsEqual:s?PCe(FCe,WM):FCe,areTypedArraysEqual:s?WM:IFt,areUrlsEqual:PFt};if(n&&(i=BCe({},i,n(i))),e){var o=$L(i.areArraysEqual),c=$L(i.areMapsEqual),a=$L(i.areObjectsEqual),h=$L(i.areSetsEqual);i=BCe({},i,{areArraysEqual:o,areMapsEqual:c,areObjectsEqual:a,areSetsEqual:h})}return i}function ZFt(t){return function(e,n,s,i,o,c,a){return t(e,n,a)}}function YFt(t){var e=t.circular,n=t.comparator,s=t.createState,i=t.equals,o=t.strict;if(s)return function(h,m){var x=s(),v=x.cache,w=v===void 0?e?new WeakMap:void 0:v,k=x.meta;return n(h,m,{cache:w,equals:i,meta:k,strict:o})};if(e)return function(h,m){return n(h,m,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var c={cache:void 0,equals:i,meta:void 0,strict:o};return function(h,m){return n(h,m,c)}}var XFt=Y1();Y1({strict:!0});Y1({circular:!0});Y1({circular:!0,strict:!0});Y1({createInternalComparator:function(){return rk}});Y1({strict:!0,createInternalComparator:function(){return rk}});Y1({circular:!0,createInternalComparator:function(){return rk}});Y1({circular:!0,createInternalComparator:function(){return rk},strict:!0});function Y1(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,s=t.createInternalComparator,i=t.createState,o=t.strict,c=o===void 0?!1:o,a=KFt(t),h=GFt(a),m=s?s(h):ZFt(h);return YFt({circular:n,comparator:h,createState:i,equals:m,strict:c})}function QFt(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function $Ce(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):QFt(i)};requestAnimationFrame(s)}function Kfe(t){"@babel/helpers - typeof";return Kfe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kfe(t)}function JFt(t){return nzt(t)||rzt(t)||tzt(t)||ezt()}function ezt(){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 tzt(t,e){if(t){if(typeof t=="string")return UCe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return UCe(t,e)}}function UCe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n1?1:I<0?0:I},S=function(I){for(var A=I>1?1:I,D=A,$=0;$<8;++$){var F=v(D)-A,q=k(D);if(Math.abs(F-A)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,s=n===void 0?100:n,i=e.damping,o=i===void 0?8:i,c=e.dt,a=c===void 0?17:c,h=function(x,v,w){var k=-(x-v)*s,C=w*o,S=w+(k-C)*a/1e3,T=w*a/1e3+x;return Math.abs(T-v)t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function Lzt(t,e){if(t==null)return{};var n={},s=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function Zce(t){return Fzt(t)||Rzt(t)||Dzt(t)||Ozt()}function Ozt(){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 Dzt(t,e){if(t){if(typeof t=="string")return Jfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jfe(t,e)}}function Rzt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Fzt(t){if(Array.isArray(t))return Jfe(t)}function Jfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rre(t){return Rre=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Rre(t)}var ty=function(t){qzt(n,t);var e=Vzt(n);function n(s,i){var o;zzt(this,n),o=e.call(this,s,i);var c=o.props,a=c.isActive,h=c.attributeName,m=c.from,x=c.to,v=c.steps,w=c.children,k=c.duration;if(o.handleStyleChange=o.handleStyleChange.bind(rpe(o)),o.changeStyle=o.changeStyle.bind(rpe(o)),!a||k<=0)return o.state={style:{}},typeof w=="function"&&(o.state={style:x}),tpe(o);if(v&&v.length)o.state={style:v[0].style};else if(m){if(typeof w=="function")return o.state={style:m},tpe(o);o.state={style:h?cT({},h,m):m}}else o.state={style:{}};return o}return $zt(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,c=i.canBegin;this.mounted=!0,!(!o||!c)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,c=o.isActive,a=o.canBegin,h=o.attributeName,m=o.shouldReAnimate,x=o.to,v=o.from,w=this.state.style;if(a){if(!c){var k={style:h?cT({},h,x):x};this.state&&w&&(h&&w[h]!==x||!h&&w!==x)&&this.setState(k);return}if(!(XFt(i.to,x)&&i.canBegin&&i.isActive)){var C=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var S=C||m?v:i.to;if(this.state&&w){var T={style:h?cT({},h,S):S};(h&&w[h]!==S||!h&&w!==S)&&this.setState(T)}this.runAnimation(Lp(Lp({},this.props),{},{from:S,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,c=i.from,a=i.to,h=i.duration,m=i.easing,x=i.begin,v=i.onAnimationEnd,w=i.onAnimationStart,k=Ezt(c,a,_zt(m),h,this.changeStyle),C=function(){o.stopJSAnimation=k()};this.manager.start([w,x,C,h,v])}},{key:"runStepAnimation",value:function(i){var o=this,c=i.steps,a=i.begin,h=i.onAnimationStart,m=c[0],x=m.style,v=m.duration,w=v===void 0?0:v,k=function(S,T,I){if(I===0)return S;var A=T.duration,D=T.easing,$=D===void 0?"ease":D,F=T.style,q=T.properties,W=T.onAnimationEnd,K=I>0?c[I-1]:T,Z=q||Object.keys(F);if(typeof $=="function"||$==="spring")return[].concat(Zce(S),[o.runJSAnimation.bind(o,{from:K.style,to:F,duration:A,easing:$}),A]);var re=HCe(Z,A,$),he=Lp(Lp(Lp({},K.style),F),{},{transition:re});return[].concat(Zce(S),[he,A,W]).filter(lzt)};return this.manager.start([h].concat(Zce(c.reduce(k,[x,Math.max(w,a)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=szt());var o=i.begin,c=i.duration,a=i.attributeName,h=i.to,m=i.easing,x=i.onAnimationStart,v=i.onAnimationEnd,w=i.steps,k=i.children,C=this.manager;if(this.unSubscribe=C.subscribe(this.handleStyleChange),typeof m=="function"||typeof k=="function"||m==="spring"){this.runJSAnimation(i);return}if(w.length>1){this.runStepAnimation(i);return}var S=a?cT({},a,h):h,T=HCe(Object.keys(S),c,m);C.start([x,o,Lp(Lp({},S),{},{transition:T}),c,v])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var c=i.duration;i.attributeName,i.easing;var a=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var h=Pzt(i,Izt),m=P.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!a||m===0||c<=0)return o;var v=function(k){var C=k.props,S=C.style,T=S===void 0?{}:S,I=C.className,A=P.cloneElement(k,Lp(Lp({},h),{},{style:Lp(Lp({},T),x),className:I}));return A};return m===1?v(P.Children.only(o)):lt.createElement("div",null,P.Children.map(o,function(w){return v(w)}))}}]),n}(P.PureComponent);ty.displayName="Animate";ty.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};ty.propTypes={from:lo.oneOfType([lo.object,lo.string]),to:lo.oneOfType([lo.object,lo.string]),attributeName:lo.string,duration:lo.number,begin:lo.number,easing:lo.oneOfType([lo.string,lo.func]),steps:lo.arrayOf(lo.shape({duration:lo.number.isRequired,style:lo.object.isRequired,easing:lo.oneOfType([lo.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),lo.func]),properties:lo.arrayOf("string"),onAnimationEnd:lo.func})),children:lo.oneOfType([lo.node,lo.func]),isActive:lo.bool,canBegin:lo.bool,onAnimationEnd:lo.func,shouldReAnimate:lo.bool,onAnimationStart:lo.func,onAnimationReStart:lo.func};function EE(t){"@babel/helpers - typeof";return EE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},EE(t)}function Fre(){return Fre=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0?1:-1,h=s>=0?1:-1,m=i>=0&&s>=0||i<0&&s<0?1:0,x;if(c>0&&o instanceof Array){for(var v=[0,0,0,0],w=0,k=4;wc?c:o[w];x="M".concat(e,",").concat(n+a*v[0]),v[0]>0&&(x+="A ".concat(v[0],",").concat(v[0],",0,0,").concat(m,",").concat(e+h*v[0],",").concat(n)),x+="L ".concat(e+s-h*v[1],",").concat(n),v[1]>0&&(x+="A ".concat(v[1],",").concat(v[1],",0,0,").concat(m,`, `).concat(e+s,",").concat(n+a*v[1])),x+="L ".concat(e+s,",").concat(n+i-a*v[2]),v[2]>0&&(x+="A ".concat(v[2],",").concat(v[2],",0,0,").concat(m,`, `).concat(e+s-h*v[2],",").concat(n+i)),x+="L ".concat(e+h*v[3],",").concat(n+i),v[3]>0&&(x+="A ".concat(v[3],",").concat(v[3],",0,0,").concat(m,`, `).concat(e,",").concat(n+i-a*v[3])),x+="Z"}else if(c>0&&o===+o&&o>0){var C=Math.min(c,o);x="M ".concat(e,",").concat(n+a*C,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e+h*C,",").concat(n,` L `).concat(e+s-h*C,",").concat(n,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e+s,",").concat(n+a*C,` L `).concat(e+s,",").concat(n+i-a*C,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e+s-h*C,",").concat(n+i,` L `).concat(e+h*C,",").concat(n+i,` A `).concat(C,",").concat(C,",0,0,").concat(m,",").concat(e,",").concat(n+i-a*C," Z")}else x="M ".concat(e,",").concat(n," h ").concat(s," v ").concat(i," h ").concat(-s," Z");return x},e7t=function(e,n){if(!e||!n)return!1;var s=e.x,i=e.y,o=n.x,c=n.y,a=n.width,h=n.height;if(Math.abs(a)>0&&Math.abs(h)>0){var m=Math.min(o,o+a),x=Math.max(o,o+a),v=Math.min(c,c+h),w=Math.max(c,c+h);return s>=m&&s<=x&&i>=v&&i<=w}return!1},t7t={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},o0e=function(e){var n=JCe(JCe({},t7t),e),s=P.useRef(),i=P.useState(-1),o=Wzt(i,2),c=o[0],a=o[1];P.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var $=s.current.getTotalLength();$&&a($)}catch{}},[]);var h=n.x,m=n.y,x=n.width,v=n.height,w=n.radius,k=n.className,C=n.animationEasing,S=n.animationDuration,T=n.animationBegin,I=n.isAnimationActive,A=n.isUpdateAnimationActive;if(h!==+h||m!==+m||x!==+x||v!==+v||x===0||v===0)return null;var D=ra("recharts-rectangle",k);return A?lt.createElement(ty,{canBegin:c>0,from:{width:x,height:v,x:h,y:m},to:{width:x,height:v,x:h,y:m},duration:S,animationEasing:C,isActive:A},function($){var F=$.width,q=$.height,W=$.x,K=$.y;return lt.createElement(ty,{canBegin:c>0,from:"0px ".concat(c===-1?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:T,duration:S,isActive:I,easing:C},lt.createElement("path",Fre({},Ni(n,!0),{className:D,d:e5e(W,K,F,q,w),ref:s})))}):lt.createElement("path",Fre({},Ni(n,!0),{className:D,d:e5e(h,m,x,v,w)}))},r7t=["points","className","baseLinePoints","connectNulls"];function AS(){return AS=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function s7t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function t5e(t){return l7t(t)||o7t(t)||a7t(t)||i7t()}function i7t(){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 a7t(t,e){if(t){if(typeof t=="string")return npe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return npe(t,e)}}function o7t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function l7t(t){if(Array.isArray(t))return npe(t)}function npe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(s){r5e(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),r5e(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},pA=function(e,n){var s=c7t(e);n&&(s=[s.reduce(function(o,c){return[].concat(t5e(o),t5e(c))},[])]);var i=s.map(function(o){return o.reduce(function(c,a,h){return"".concat(c).concat(h===0?"M":"L").concat(a.x,",").concat(a.y)},"")}).join("");return s.length===1?"".concat(i,"Z"):i},d7t=function(e,n,s){var i=pA(e,s);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(pA(n.reverse(),s).slice(1))},u7t=function(e){var n=e.points,s=e.className,i=e.baseLinePoints,o=e.connectNulls,c=n7t(e,r7t);if(!n||!n.length)return null;var a=ra("recharts-polygon",s);if(i&&i.length){var h=c.stroke&&c.stroke!=="none",m=d7t(n,i,o);return lt.createElement("g",{className:a},lt.createElement("path",AS({},Ni(c,!0),{fill:m.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:m})),h?lt.createElement("path",AS({},Ni(c,!0),{fill:"none",d:pA(n,o)})):null,h?lt.createElement("path",AS({},Ni(c,!0),{fill:"none",d:pA(i,o)})):null)}var x=pA(n,o);return lt.createElement("path",AS({},Ni(c,!0),{fill:x.slice(-1)==="Z"?c.fill:"none",className:a,d:x}))};function spe(){return spe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function y7t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var v7t=function(e,n,s,i,o,c){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(c,",").concat(n,"h").concat(s)},_7t=function(e){var n=e.x,s=n===void 0?0:n,i=e.y,o=i===void 0?0:i,c=e.top,a=c===void 0?0:c,h=e.left,m=h===void 0?0:h,x=e.width,v=x===void 0?0:x,w=e.height,k=w===void 0?0:w,C=e.className,S=x7t(e,h7t),T=f7t({x:s,y:o,top:a,left:m,width:v,height:k},S);return!On(s)||!On(o)||!On(v)||!On(k)||!On(a)||!On(m)?null:lt.createElement("path",ipe({},Ni(T,!0),{className:ra("recharts-cross",C),d:v7t(s,o,v,k,a,m)}))},b7t=fie,w7t=yBe,j7t=Lg;function k7t(t,e){return t&&t.length?b7t(t,j7t(e),w7t):void 0}var N7t=k7t;const S7t=Da(N7t);var C7t=fie,M7t=Lg,T7t=vBe;function A7t(t,e){return t&&t.length?C7t(t,M7t(e),T7t):void 0}var E7t=A7t;const I7t=Da(E7t);var P7t=["cx","cy","angle","ticks","axisLine"],L7t=["ticks","tick","angle","tickFormatter","stroke"];function SC(t){"@babel/helpers - typeof";return SC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SC(t)}function mA(){return mA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function O7t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function D7t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a5e(t,e){for(var n=0;nc5e?c=i==="outer"?"start":"end":o<-c5e?c=i==="outer"?"end":"start":c="middle",c}},{key:"renderAxisLine",value:function(){var s=this.props,i=s.cx,o=s.cy,c=s.radius,a=s.axisLine,h=s.axisLineType,m=Gv(Gv({},Ni(this.props,!1)),{},{fill:"none"},Ni(a,!1));if(h==="circle")return lt.createElement(l0e,yw({className:"recharts-polar-angle-axis-line"},m,{cx:i,cy:o,r:c}));var x=this.props.ticks,v=x.map(function(w){return Ko(i,o,c,w.coordinate)});return lt.createElement(u7t,yw({className:"recharts-polar-angle-axis-line"},m,{points:v}))}},{key:"renderTicks",value:function(){var s=this,i=this.props,o=i.ticks,c=i.tick,a=i.tickLine,h=i.tickFormatter,m=i.stroke,x=Ni(this.props,!1),v=Ni(c,!1),w=Gv(Gv({},x),{},{fill:"none"},Ni(a,!1)),k=o.map(function(C,S){var T=s.getTickLineCoord(C),I=s.getTickTextAnchor(C),A=Gv(Gv(Gv({textAnchor:I},x),{},{stroke:"none",fill:m},v),{},{index:S,payload:C,x:T.x2,y:T.y2});return lt.createElement(vo,yw({className:ra("recharts-polar-angle-axis-tick",GBe(c)),key:"tick-".concat(C.coordinate)},$j(s.props,C,S)),a&<.createElement("line",yw({className:"recharts-polar-angle-axis-tick-line"},w,T)),c&&e.renderTickItem(c,A,h?h(C.value,S):C.value))});return lt.createElement(vo,{className:"recharts-polar-angle-axis-ticks"},k)}},{key:"render",value:function(){var s=this.props,i=s.ticks,o=s.radius,c=s.axisLine;return o<=0||!i||!i.length?null:lt.createElement(vo,{className:ra("recharts-polar-angle-axis",this.props.className)},c&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,i,o){var c;return lt.isValidElement(s)?c=lt.cloneElement(s,i):Oi(s)?c=s(i):c=lt.createElement(Uj,yw({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),c}}])}(P.PureComponent);wie(jie,"displayName","PolarAngleAxis");wie(jie,"axisType","angleAxis");wie(jie,"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 X7t=p7e,Q7t=X7t(Object.getPrototypeOf,Object),J7t=Q7t,eBt=ay,tBt=J7t,rBt=oy,nBt="[object Object]",sBt=Function.prototype,iBt=Object.prototype,u9e=sBt.toString,aBt=iBt.hasOwnProperty,oBt=u9e.call(Object);function lBt(t){if(!rBt(t)||eBt(t)!=nBt)return!1;var e=tBt(t);if(e===null)return!0;var n=aBt.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&u9e.call(n)==oBt}var cBt=lBt;const dBt=Da(cBt);var uBt=ay,hBt=oy,fBt="[object Boolean]";function pBt(t){return t===!0||t===!1||hBt(t)&&uBt(t)==fBt}var mBt=pBt;const gBt=Da(mBt);function PE(t){"@babel/helpers - typeof";return PE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},PE(t)}function $re(){return $re=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:w,x:h,y:m},to:{upperWidth:x,lowerWidth:v,height:w,x:h,y:m},duration:S,animationEasing:C,isActive:I},function(D){var $=D.upperWidth,F=D.lowerWidth,q=D.height,W=D.x,K=D.y;return lt.createElement(ty,{canBegin:c>0,from:"0px ".concat(c===-1?1:c,"px"),to:"".concat(c,"px 0px"),attributeName:"strokeDasharray",begin:T,duration:S,easing:C},lt.createElement("path",$re({},Ni(n,!0),{className:A,d:f5e(W,K,$,F,q),ref:s})))}):lt.createElement("g",null,lt.createElement("path",$re({},Ni(n,!0),{className:A,d:f5e(h,m,x,v,w)})))},CBt=["option","shapeType","propTransformer","activeClassName","isActive"];function LE(t){"@babel/helpers - typeof";return LE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},LE(t)}function MBt(t,e){if(t==null)return{};var n=TBt(t,e),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function TBt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function p5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Ure(t){for(var e=1;e0?Kh(D,"paddingAngle",0):0;if(F){var W=h0(F.endAngle-F.startAngle,D.endAngle-D.startAngle),K=qo(qo({},D),{},{startAngle:A+q,endAngle:A+W(S)+q});T.push(K),A=K.endAngle}else{var Z=D.endAngle,re=D.startAngle,he=h0(0,Z-re),ue=he(S),je=qo(qo({},D),{},{startAngle:A+q,endAngle:A+ue+q});T.push(je),A=je.endAngle}}),lt.createElement(vo,null,s.renderSectorsStatically(T))})}},{key:"attachKeyboardHandlers",value:function(s){var i=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var c=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"ArrowRight":{var a=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[a].focus(),i.setState({sectorToFocus:a});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,i=s.sectors,o=s.isAnimationActive,c=this.state.prevSectors;return o&&i&&i.length&&(!c||!gie(c,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,i=this.props,o=i.hide,c=i.sectors,a=i.className,h=i.label,m=i.cx,x=i.cy,v=i.innerRadius,w=i.outerRadius,k=i.isAnimationActive,C=this.state.isAnimationFinished;if(o||!c||!c.length||!On(m)||!On(x)||!On(v)||!On(w))return null;var S=ra("recharts-pie",a);return lt.createElement(vo,{tabIndex:this.props.rootTabIndex,className:S,ref:function(I){s.pieRef=I}},this.renderSectors(),h&&this.renderLabels(c),rd.renderCallByParent(this.props,null,!1),(!k||C)&&b1.renderCallByParent(this.props,c,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,i){return i.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==i.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:s.sectors!==i.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,i){return s>i?"start":s=360?A:A-1)*h,$=T-A*k-D,F=i.reduce(function(K,Z){var re=Wd(Z,I,0);return K+(On(re)?re:0)},0),q;if(F>0){var W;q=i.map(function(K,Z){var re=Wd(K,I,0),he=Wd(K,x,Z),ue=(On(re)?re:0)/F,je;Z?je=W.endAngle+Nu(S)*h*(re!==0?1:0):je=c;var ne=je+Nu(S)*((re!==0?k:0)+ue*$),ye=(je+ne)/2,ie=(C.innerRadius+C.outerRadius)/2,me=[{name:he,value:re,payload:K,dataKey:I,type:w}],fe=Ko(C.cx,C.cy,ie,ye);return W=qo(qo(qo({percent:ue,cornerRadius:o,name:he,tooltipPayload:me,midAngle:ye,middleRadius:ie,tooltipPosition:fe},K),C),{},{value:Wd(K,I),startAngle:je,endAngle:ne,payload:K,paddingAngle:Nu(S)*h}),W})}return qo(qo({},C),{},{sectors:q,data:i})});var YBt=Math.ceil,XBt=Math.max;function QBt(t,e,n,s){for(var i=-1,o=XBt(YBt((e-t)/(n||1)),0),c=Array(o);o--;)c[s?o:++i]=t,t+=n;return c}var JBt=QBt,e9t=P7e,y5e=1/0,t9t=17976931348623157e292;function r9t(t){if(!t)return t===0?t:0;if(t=e9t(t),t===y5e||t===-y5e){var e=t<0?-1:1;return e*t9t}return t===t?t:0}var m9e=r9t,n9t=JBt,s9t=iie,Yce=m9e;function i9t(t){return function(e,n,s){return s&&typeof s!="number"&&s9t(e,n,s)&&(n=s=void 0),e=Yce(e),n===void 0?(n=e,e=0):n=Yce(n),s=s===void 0?e0&&s.handleDrag(i.changedTouches[0])}),Th(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=s.props,o=i.endIndex,c=i.onDragEnd,a=i.startIndex;c==null||c({endIndex:o,startIndex:a})}),s.detachDragEndListener()}),Th(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Th(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Th(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Th(s,"handleSlideDragStart",function(i){var o=j5e(i)?i.changedTouches[0]:i;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}return v9t(e,t),m9t(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var i=s.startX,o=s.endX,c=this.state.scaleValues,a=this.props,h=a.gap,m=a.data,x=m.length-1,v=Math.min(i,o),w=Math.max(i,o),k=e.getIndexInRange(c,v),C=e.getIndexInRange(c,w);return{startIndex:k-k%h,endIndex:C===x?x:C-C%h}}},{key:"getTextOfTick",value:function(s){var i=this.props,o=i.data,c=i.tickFormatter,a=i.dataKey,h=Wd(o[s],a,s);return Oi(c)?c(h,s):h}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var i=this.state,o=i.slideMoveStartX,c=i.startX,a=i.endX,h=this.props,m=h.x,x=h.width,v=h.travellerWidth,w=h.startIndex,k=h.endIndex,C=h.onChange,S=s.pageX-o;S>0?S=Math.min(S,m+x-v-a,m+x-v-c):S<0&&(S=Math.max(S,m-c,m-a));var T=this.getIndex({startX:c+S,endX:a+S});(T.startIndex!==w||T.endIndex!==k)&&C&&C(T),this.setState({startX:c+S,endX:a+S,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,i){var o=j5e(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var i=this.state,o=i.brushMoveStartX,c=i.movingTravellerId,a=i.endX,h=i.startX,m=this.state[c],x=this.props,v=x.x,w=x.width,k=x.travellerWidth,C=x.onChange,S=x.gap,T=x.data,I={startX:this.state.startX,endX:this.state.endX},A=s.pageX-o;A>0?A=Math.min(A,v+w-k-m):A<0&&(A=Math.max(A,v-m)),I[c]=m+A;var D=this.getIndex(I),$=D.startIndex,F=D.endIndex,q=function(){var K=T.length-1;return c==="startX"&&(a>h?$%S===0:F%S===0)||ah?F%S===0:$%S===0)||a>h&&F===K};this.setState(Th(Th({},c,m+A),"brushMoveStartX",s.pageX),function(){C&&q()&&C(D)})}},{key:"handleTravellerMoveKeyboard",value:function(s,i){var o=this,c=this.state,a=c.scaleValues,h=c.startX,m=c.endX,x=this.state[i],v=a.indexOf(x);if(v!==-1){var w=v+s;if(!(w===-1||w>=a.length)){var k=a[w];i==="startX"&&k>=m||i==="endX"&&k<=h||this.setState(Th({},i,k),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,i=s.x,o=s.y,c=s.width,a=s.height,h=s.fill,m=s.stroke;return lt.createElement("rect",{stroke:m,fill:h,x:i,y:o,width:c,height:a})}},{key:"renderPanorama",value:function(){var s=this.props,i=s.x,o=s.y,c=s.width,a=s.height,h=s.data,m=s.children,x=s.padding,v=P.Children.only(m);return v?lt.cloneElement(v,{x:i,y:o,width:c,height:a,margin:x,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(s,i){var o,c,a=this,h=this.props,m=h.y,x=h.travellerWidth,v=h.height,w=h.traveller,k=h.ariaLabel,C=h.data,S=h.startIndex,T=h.endIndex,I=Math.max(s,this.props.x),A=Xce(Xce({},Ni(this.props,!1)),{},{x:I,y:m,width:x,height:v}),D=k||"Min value: ".concat((o=C[S])===null||o===void 0?void 0:o.name,", Max value: ").concat((c=C[T])===null||c===void 0?void 0:c.name);return lt.createElement(vo,{tabIndex:0,role:"slider","aria-label":D,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),a.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,i))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(w,A))}},{key:"renderSlide",value:function(s,i){var o=this.props,c=o.y,a=o.height,h=o.stroke,m=o.travellerWidth,x=Math.min(s,i)+m,v=Math.max(Math.abs(i-s)-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:h,fillOpacity:.2,x,y:c,width:v,height:a})}},{key:"renderText",value:function(){var s=this.props,i=s.startIndex,o=s.endIndex,c=s.y,a=s.height,h=s.travellerWidth,m=s.stroke,x=this.state,v=x.startX,w=x.endX,k=5,C={pointerEvents:"none",fill:m};return lt.createElement(vo,{className:"recharts-brush-texts"},lt.createElement(Uj,Hre({textAnchor:"end",verticalAnchor:"middle",x:Math.min(v,w)-k,y:c+a/2},C),this.getTextOfTick(i)),lt.createElement(Uj,Hre({textAnchor:"start",verticalAnchor:"middle",x:Math.max(v,w)+h+k,y:c+a/2},C),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,i=s.data,o=s.className,c=s.children,a=s.x,h=s.y,m=s.width,x=s.height,v=s.alwaysShowText,w=this.state,k=w.startX,C=w.endX,S=w.isTextActive,T=w.isSlideMoving,I=w.isTravellerMoving,A=w.isTravellerFocused;if(!i||!i.length||!On(a)||!On(h)||!On(m)||!On(x)||m<=0||x<=0)return null;var D=ra("recharts-brush",o),$=lt.Children.count(c)===1,F=f9t("userSelect","none");return lt.createElement(vo,{className:D,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),$&&this.renderPanorama(),this.renderSlide(k,C),this.renderTravellerLayer(k,"startX"),this.renderTravellerLayer(C,"endX"),(S||T||I||A||v)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var i=s.x,o=s.y,c=s.width,a=s.height,h=s.stroke,m=Math.floor(o+a/2)-1;return lt.createElement(lt.Fragment,null,lt.createElement("rect",{x:i,y:o,width:c,height:a,fill:h,stroke:"none"}),lt.createElement("line",{x1:i+1,y1:m,x2:i+c-1,y2:m,fill:"none",stroke:"#fff"}),lt.createElement("line",{x1:i+1,y1:m+2,x2:i+c-1,y2:m+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,i){var o;return lt.isValidElement(s)?o=lt.cloneElement(s,i):Oi(s)?o=s(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(s,i){var o=s.data,c=s.width,a=s.x,h=s.travellerWidth,m=s.updateId,x=s.startIndex,v=s.endIndex;if(o!==i.prevData||m!==i.prevUpdateId)return Xce({prevData:o,prevTravellerWidth:h,prevUpdateId:m,prevX:a,prevWidth:c},o&&o.length?b9t({data:o,width:c,x:a,travellerWidth:h,startIndex:x,endIndex:v}):{scale:null,scaleValues:null});if(i.scale&&(c!==i.prevWidth||a!==i.prevX||h!==i.prevTravellerWidth)){i.scale.range([a,a+c-h]);var w=i.scale.domain().map(function(k){return i.scale(k)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:m,prevX:a,prevWidth:c,startX:i.scale(s.startIndex),endX:i.scale(s.endIndex),scaleValues:w}}return null}},{key:"getIndexInRange",value:function(s,i){for(var o=s.length,c=0,a=o-1;a-c>1;){var h=Math.floor((c+a)/2);s[h]>i?a=h:c=h}return i>=s[a]?a:c}}])}(P.PureComponent);Th(AC,"displayName","Brush");Th(AC,"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 w9t=Pye;function j9t(t,e){var n;return w9t(t,function(s,i,o){return n=e(s,i,o),!n}),!!n}var k9t=j9t,N9t=a7e,S9t=Lg,C9t=k9t,M9t=yh,T9t=iie;function A9t(t,e,n){var s=M9t(t)?N9t:C9t;return n&&T9t(t,e,n)&&(e=void 0),s(t,S9t(e))}var E9t=A9t;const I9t=Da(E9t);var vg=function(e,n){var s=e.alwaysShow,i=e.ifOverflow;return s&&(i="extendDomain"),i===n},k5e=M7e;function P9t(t,e,n){e=="__proto__"&&k5e?k5e(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var L9t=P9t,O9t=L9t,D9t=S7e,R9t=Lg;function F9t(t,e){var n={};return e=R9t(e),D9t(t,function(s,i,o){O9t(n,i,e(s,i,o))}),n}var z9t=F9t;const B9t=Da(z9t);function $9t(t,e){for(var n=-1,s=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function s$t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function i$t(t,e){var n=t.x,s=t.y,i=n$t(t,J9t),o="".concat(n),c=parseInt(o,10),a="".concat(s),h=parseInt(a,10),m="".concat(e.height||i.height),x=parseInt(m,10),v="".concat(e.width||i.width),w=parseInt(v,10);return GM(GM(GM(GM(GM({},e),i),c?{x:c}:{}),h?{y:h}:{}),{},{height:x,width:w,name:e.name,radius:e.radius})}function S5e(t){return lt.createElement(h9e,dpe({shapeType:"rectangle",propTransformer:i$t,activeClassName:"recharts-active-bar"},t))}var a$t=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,i){if(typeof e=="number")return e;var o=On(s)||ISt(s);return o?e(s,i):(o||Vj(),n)}},o$t=["value","background"],_9e;function EC(t){"@babel/helpers - typeof";return EC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},EC(t)}function l$t(t,e){if(t==null)return{};var n=c$t(t,e),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function c$t(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function Gre(){return Gre=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(ye)0&&Math.abs(ne)0&&(je=Math.min((Ne||0)-(ne[Te-1]||0),je))}),Number.isFinite(je)){var ye=je/ue,ie=S.layout==="vertical"?s.height:s.width;if(S.padding==="gap"&&(W=ye*ie/2),S.padding==="no-gap"){var me=Su(e.barCategoryGap,ye*ie),fe=ye*ie/2;W=fe-me-(fe-me)/ie*me}}}i==="xAxis"?K=[s.left+(D.left||0)+(W||0),s.left+s.width-(D.right||0)-(W||0)]:i==="yAxis"?K=h==="horizontal"?[s.top+s.height-(D.bottom||0),s.top+(D.top||0)]:[s.top+(D.top||0)+(W||0),s.top+s.height-(D.bottom||0)-(W||0)]:K=S.range,F&&(K=[K[1],K[0]]);var ve=BBe(S,o,w),Ie=ve.scale,Se=ve.realScaleType;Ie.domain(I).range(K),$Be(Ie);var oe=UBe(Ie,Wp(Wp({},S),{},{realScaleType:Se}));i==="xAxis"?(he=T==="top"&&!$||T==="bottom"&&$,Z=s.left,re=v[q]-he*S.height):i==="yAxis"&&(he=T==="left"&&!$||T==="right"&&$,Z=v[q]-he*S.width,re=s.top);var ae=Wp(Wp(Wp({},S),oe),{},{realScaleType:Se,x:Z,y:re,scale:Ie,width:i==="xAxis"?s.width:S.width,height:i==="yAxis"?s.height:S.height});return ae.bandSize=Ire(ae,oe),!S.hide&&i==="xAxis"?v[q]+=(he?-1:1)*ae.height:S.hide||(v[q]+=(he?-1:1)*ae.width),Wp(Wp({},k),{},Sie({},C,ae))},{})},k9e=function(e,n){var s=e.x,i=e.y,o=n.x,c=n.y;return{x:Math.min(s,o),y:Math.min(i,c),width:Math.abs(o-s),height:Math.abs(c-i)}},b$t=function(e){var n=e.x1,s=e.y1,i=e.x2,o=e.y2;return k9e({x:n,y:s},{x:i,y:o})},N9e=function(){function t(e){x$t(this,t),this.scale=e}return y$t(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(n)+a}default:return this.scale(n)}if(i){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),i=s[0],o=s[s.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();Sie(N9e,"EPS",1e-4);var c0e=function(e){var n=Object.keys(e).reduce(function(s,i){return Wp(Wp({},s),{},Sie({},i,N9e.create(e[i])))},{});return Wp(Wp({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=o.bandAware,a=o.position;return B9t(i,function(h,m){return n[m].apply(h,{bandAware:c,position:a})})},isInRange:function(i){return v9e(i,function(o,c){return n[c].isInRange(o)})}})};function w$t(t){return(t%180+180)%180}var j$t=function(e){var n=e.width,s=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=w$t(i),c=o*Math.PI/180,a=Math.atan(s/n),h=c>a&&c-1?i[o?e[c]:c]:void 0}}var M$t=C$t,T$t=m9e;function A$t(t){var e=T$t(t),n=e%1;return e===e?n?e-n:e:0}var E$t=A$t,I$t=_7e,P$t=Lg,L$t=E$t,O$t=Math.max;function D$t(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var i=n==null?0:L$t(n);return i<0&&(i=O$t(s+i,0)),I$t(t,P$t(e),i)}var R$t=D$t,F$t=M$t,z$t=R$t,B$t=F$t(z$t),$$t=B$t;const U$t=Da($$t);var q$t=FNt(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("")}),d0e=P.createContext(void 0),u0e=P.createContext(void 0),S9e=P.createContext(void 0),C9e=P.createContext({}),M9e=P.createContext(void 0),T9e=P.createContext(0),A9e=P.createContext(0),E5e=function(e){var n=e.state,s=n.xAxisMap,i=n.yAxisMap,o=n.offset,c=e.clipPathId,a=e.children,h=e.width,m=e.height,x=q$t(o);return lt.createElement(d0e.Provider,{value:s},lt.createElement(u0e.Provider,{value:i},lt.createElement(C9e.Provider,{value:o},lt.createElement(S9e.Provider,{value:x},lt.createElement(M9e.Provider,{value:c},lt.createElement(T9e.Provider,{value:m},lt.createElement(A9e.Provider,{value:h},a)))))))},V$t=function(){return P.useContext(M9e)},E9e=function(e){var n=P.useContext(d0e);n==null&&Vj();var s=n[e];return s==null&&Vj(),s},H$t=function(){var e=P.useContext(d0e);return v0(e)},W$t=function(){var e=P.useContext(u0e),n=U$t(e,function(s){return v9e(s.domain,Number.isFinite)});return n||v0(e)},I9e=function(e){var n=P.useContext(u0e);n==null&&Vj();var s=n[e];return s==null&&Vj(),s},G$t=function(){var e=P.useContext(S9e);return e},K$t=function(){return P.useContext(C9e)},h0e=function(){return P.useContext(A9e)},f0e=function(){return P.useContext(T9e)};function IC(t){"@babel/helpers - typeof";return IC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},IC(t)}function Z$t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y$t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);nt*i)return!1;var o=n();return t*(e-t*o/2-s)>=0&&t*(e+t*o/2-i)<=0}function EUt(t,e){return z9e(t,e+1)}function IUt(t,e,n,s,i){for(var o=(s||[]).slice(),c=e.start,a=e.end,h=0,m=1,x=c,v=function(){var C=s==null?void 0:s[h];if(C===void 0)return{v:z9e(s,m)};var S=h,T,I=function(){return T===void 0&&(T=n(C,S)),T},A=C.coordinate,D=h===0||Qre(t,A,I,x,a);D||(h=0,x=c,m+=1),D&&(x=A+t*(I()/2+i),h+=m)},w;m<=o.length;)if(w=v(),w)return w.v;return[]}function zE(t){"@babel/helpers - typeof";return zE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zE(t)}function z5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function qd(t){for(var e=1;e0?k.coordinate-T*t:k.coordinate})}else o[w]=k=qd(qd({},k),{},{tickCoord:k.coordinate});var I=Qre(t,k.tickCoord,S,a,h);I&&(h=k.tickCoord-t*(S()/2+i),o[w]=qd(qd({},k),{},{isShow:!0}))},x=c-1;x>=0;x--)m(x);return o}function RUt(t,e,n,s,i,o){var c=(s||[]).slice(),a=c.length,h=e.start,m=e.end;if(o){var x=s[a-1],v=n(x,a-1),w=t*(x.coordinate+t*v/2-m);c[a-1]=x=qd(qd({},x),{},{tickCoord:w>0?x.coordinate-w*t:x.coordinate});var k=Qre(t,x.tickCoord,function(){return v},h,m);k&&(m=x.tickCoord-t*(v/2+i),c[a-1]=qd(qd({},x),{},{isShow:!0}))}for(var C=o?a-1:a,S=function(A){var D=c[A],$,F=function(){return $===void 0&&($=n(D,A)),$};if(A===0){var q=t*(D.coordinate-t*F()/2-h);c[A]=D=qd(qd({},D),{},{tickCoord:q<0?D.coordinate-q*t:D.coordinate})}else c[A]=D=qd(qd({},D),{},{tickCoord:D.coordinate});var W=Qre(t,D.tickCoord,F,h,m);W&&(h=D.tickCoord+t*(F()/2+i),c[A]=qd(qd({},D),{},{isShow:!0}))},T=0;T=2?Nu(i[1].coordinate-i[0].coordinate):1,I=AUt(o,T,k);return h==="equidistantPreserveStart"?IUt(T,I,S,i,c):(h==="preserveStart"||h==="preserveStartEnd"?w=RUt(T,I,S,i,c,h==="preserveStartEnd"):w=DUt(T,I,S,i,c),w.filter(function(A){return A.isShow}))}var FUt=["viewBox"],zUt=["viewBox"],BUt=["ticks"];function OC(t){"@babel/helpers - typeof";return OC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},OC(t)}function IS(){return IS=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function $Ut(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function UUt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $5e(t,e){for(var n=0;n0?h(this.props):h(k)),c<=0||a<=0||!C||!C.length?null:lt.createElement(vo,{className:ra("recharts-cartesian-axis",m),ref:function(T){s.layerReference=T}},o&&this.renderAxisLine(),this.renderTicks(C,this.state.fontSize,this.state.letterSpacing),rd.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,i,o){var c,a=ra(i.className,"recharts-cartesian-axis-tick-value");return lt.isValidElement(s)?c=lt.cloneElement(s,Tc(Tc({},i),{},{className:a})):Oi(s)?c=s(Tc(Tc({},i),{},{className:a})):c=lt.createElement(Uj,IS({},i,{className:"recharts-cartesian-axis-tick-value"}),o),c}}])}(P.Component);x0e(b5,"displayName","CartesianAxis");x0e(b5,"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 ZUt=["x1","y1","x2","y2","key"],YUt=["offset"];function Hj(t){"@babel/helpers - typeof";return Hj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hj(t)}function U5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,s)}return n}function Hd(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function eqt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var tqt=function(e){var n=e.fill;if(!n||n==="none")return null;var s=e.fillOpacity,i=e.x,o=e.y,c=e.width,a=e.height,h=e.ry;return lt.createElement("rect",{x:i,y:o,ry:h,width:c,height:a,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function U9e(t,e){var n;if(lt.isValidElement(t))n=lt.cloneElement(t,e);else if(Oi(t))n=t(e);else{var s=e.x1,i=e.y1,o=e.x2,c=e.y2,a=e.key,h=q5e(e,ZUt),m=Ni(h,!1);m.offset;var x=q5e(m,YUt);n=lt.createElement("line",Iw({},x,{x1:s,y1:i,x2:o,y2:c,fill:"none",key:a}))}return n}function rqt(t){var e=t.x,n=t.width,s=t.horizontal,i=s===void 0?!0:s,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var c=o.map(function(a,h){var m=Hd(Hd({},t),{},{x1:e,y1:a,x2:e+n,y2:a,key:"line-".concat(h),index:h});return U9e(i,m)});return lt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function nqt(t){var e=t.y,n=t.height,s=t.vertical,i=s===void 0?!0:s,o=t.verticalPoints;if(!i||!o||!o.length)return null;var c=o.map(function(a,h){var m=Hd(Hd({},t),{},{x1:a,y1:e,x2:a,y2:e+n,key:"line-".concat(h),index:h});return U9e(i,m)});return lt.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function sqt(t){var e=t.horizontalFill,n=t.fillOpacity,s=t.x,i=t.y,o=t.width,c=t.height,a=t.horizontalPoints,h=t.horizontal,m=h===void 0?!0:h;if(!m||!e||!e.length)return null;var x=a.map(function(w){return Math.round(w+i-i)}).sort(function(w,k){return w-k});i!==x[0]&&x.unshift(0);var v=x.map(function(w,k){var C=!x[k+1],S=C?i+c-w:x[k+1]-w;if(S<=0)return null;var T=k%e.length;return lt.createElement("rect",{key:"react-".concat(k),y:w,x:s,height:S,width:o,stroke:"none",fill:e[T],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},v)}function iqt(t){var e=t.vertical,n=e===void 0?!0:e,s=t.verticalFill,i=t.fillOpacity,o=t.x,c=t.y,a=t.width,h=t.height,m=t.verticalPoints;if(!n||!s||!s.length)return null;var x=m.map(function(w){return Math.round(w+o-o)}).sort(function(w,k){return w-k});o!==x[0]&&x.unshift(0);var v=x.map(function(w,k){var C=!x[k+1],S=C?o+a-w:x[k+1]-w;if(S<=0)return null;var T=k%s.length;return lt.createElement("rect",{key:"react-".concat(k),x:w,y:c,width:S,height:h,stroke:"none",fill:s[T],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},v)}var aqt=function(e,n){var s=e.xAxis,i=e.width,o=e.height,c=e.offset;return zBe(g0e(Hd(Hd(Hd({},b5.defaultProps),s),{},{ticks:Tx(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),c.left,c.left+c.width,n)},oqt=function(e,n){var s=e.yAxis,i=e.width,o=e.height,c=e.offset;return zBe(g0e(Hd(Hd(Hd({},b5.defaultProps),s),{},{ticks:Tx(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),c.top,c.top+c.height,n)},sS={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function q9e(t){var e,n,s,i,o,c,a=h0e(),h=f0e(),m=K$t(),x=Hd(Hd({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:sS.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:sS.fill,horizontal:(s=t.horizontal)!==null&&s!==void 0?s:sS.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:sS.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:sS.vertical,verticalFill:(c=t.verticalFill)!==null&&c!==void 0?c:sS.verticalFill,x:On(t.x)?t.x:m.left,y:On(t.y)?t.y:m.top,width:On(t.width)?t.width:m.width,height:On(t.height)?t.height:m.height}),v=x.x,w=x.y,k=x.width,C=x.height,S=x.syncWithTicks,T=x.horizontalValues,I=x.verticalValues,A=H$t(),D=W$t();if(!On(k)||k<=0||!On(C)||C<=0||!On(v)||v!==+v||!On(w)||w!==+w)return null;var $=x.verticalCoordinatesGenerator||aqt,F=x.horizontalCoordinatesGenerator||oqt,q=x.horizontalPoints,W=x.verticalPoints;if((!q||!q.length)&&Oi(F)){var K=T&&T.length,Z=F({yAxis:D?Hd(Hd({},D),{},{ticks:K?T:D.ticks}):void 0,width:a,height:h,offset:m},K?!0:S);um(Array.isArray(Z),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Hj(Z),"]")),Array.isArray(Z)&&(q=Z)}if((!W||!W.length)&&Oi($)){var re=I&&I.length,he=$({xAxis:A?Hd(Hd({},A),{},{ticks:re?I:A.ticks}):void 0,width:a,height:h,offset:m},re?!0:S);um(Array.isArray(he),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Hj(he),"]")),Array.isArray(he)&&(W=he)}return lt.createElement("g",{className:"recharts-cartesian-grid"},lt.createElement(tqt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),lt.createElement(rqt,Iw({},x,{offset:m,horizontalPoints:q,xAxis:A,yAxis:D})),lt.createElement(nqt,Iw({},x,{offset:m,verticalPoints:W,xAxis:A,yAxis:D})),lt.createElement(sqt,Iw({},x,{horizontalPoints:q})),lt.createElement(iqt,Iw({},x,{verticalPoints:W})))}q9e.displayName="CartesianGrid";function DC(t){"@babel/helpers - typeof";return DC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DC(t)}function lqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cqt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function Zqt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function Yqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xqt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n0?c:e&&e.length&&On(i)&&On(o)?e.slice(i,o+1):[]};function n$e(t){return t==="number"?[0,"auto"]:void 0}var Cpe=function(e,n,s,i){var o=e.graphicalItems,c=e.tooltipAxis,a=Pie(n,e);return s<0||!o||!o.length||s>=a.length?null:o.reduce(function(h,m){var x,v=(x=m.props.data)!==null&&x!==void 0?x:n;v&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=s&&(v=v.slice(e.dataStartIndex,e.dataEndIndex+1));var w;if(c.dataKey&&!c.allowDuplicatedCategory){var k=v===void 0?a:v;w=efe(k,c.dataKey,i)}else w=v&&v[s]||a[s];return w?[].concat(zC(h),[VBe(m,w)]):h},[])},Z5e=function(e,n,s,i){var o=i||{x:e.chartX,y:e.chartY},c=cVt(o,s),a=e.orderedTooltipTicks,h=e.tooltipAxis,m=e.tooltipTicks,x=VDt(c,a,m,h);if(x>=0&&m){var v=m[x]&&m[x].value,w=Cpe(e,n,x,v),k=dVt(s,a,x,o);return{activeTooltipIndex:x,activeLabel:v,activePayload:w,activeCoordinate:k}}return null},uVt=function(e,n){var s=n.axes,i=n.graphicalItems,o=n.axisType,c=n.axisIdKey,a=n.stackGroups,h=n.dataStartIndex,m=n.dataEndIndex,x=e.layout,v=e.children,w=e.stackOffset,k=FBe(x,o);return s.reduce(function(C,S){var T,I=S.type.defaultProps!==void 0?Wr(Wr({},S.type.defaultProps),S.props):S.props,A=I.type,D=I.dataKey,$=I.allowDataOverflow,F=I.allowDuplicatedCategory,q=I.scale,W=I.ticks,K=I.includeHidden,Z=I[c];if(C[Z])return C;var re=Pie(e.data,{graphicalItems:i.filter(function(oe){var ae,Ne=c in oe.props?oe.props[c]:(ae=oe.type.defaultProps)===null||ae===void 0?void 0:ae[c];return Ne===Z}),dataStartIndex:h,dataEndIndex:m}),he=re.length,ue,je,ne;Rqt(I.domain,$,A)&&(ue=Ufe(I.domain,null,$),k&&(A==="number"||q!=="auto")&&(ne=hA(re,D,"category")));var ye=n$e(A);if(!ue||ue.length===0){var ie,me=(ie=I.domain)!==null&&ie!==void 0?ie:ye;if(D){if(ue=hA(re,D,A),A==="category"&&k){var fe=LSt(ue);F&&fe?(je=ue,ue=Vre(0,he)):F||(ue=_Ce(me,ue,S).reduce(function(oe,ae){return oe.indexOf(ae)>=0?oe:[].concat(zC(oe),[ae])},[]))}else if(A==="category")F?ue=ue.filter(function(oe){return oe!==""&&!xa(oe)}):ue=_Ce(me,ue,S).reduce(function(oe,ae){return oe.indexOf(ae)>=0||ae===""||xa(ae)?oe:[].concat(zC(oe),[ae])},[]);else if(A==="number"){var ve=ZDt(re,i.filter(function(oe){var ae,Ne,Te=c in oe.props?oe.props[c]:(ae=oe.type.defaultProps)===null||ae===void 0?void 0:ae[c],Be="hide"in oe.props?oe.props.hide:(Ne=oe.type.defaultProps)===null||Ne===void 0?void 0:Ne.hide;return Te===Z&&(K||!Be)}),D,o,x);ve&&(ue=ve)}k&&(A==="number"||q!=="auto")&&(ne=hA(re,D,"category"))}else k?ue=Vre(0,he):a&&a[Z]&&a[Z].hasStack&&A==="number"?ue=w==="expand"?[0,1]:qBe(a[Z].stackGroups,h,m):ue=RBe(re,i.filter(function(oe){var ae=c in oe.props?oe.props[c]:oe.type.defaultProps[c],Ne="hide"in oe.props?oe.props.hide:oe.type.defaultProps.hide;return ae===Z&&(K||!Ne)}),A,x,!0);if(A==="number")ue=kpe(v,ue,Z,o,W),me&&(ue=Ufe(me,ue,$));else if(A==="category"&&me){var Ie=me,Se=ue.every(function(oe){return Ie.indexOf(oe)>=0});Se&&(ue=Ie)}}return Wr(Wr({},C),{},xi({},Z,Wr(Wr({},I),{},{axisType:o,domain:ue,categoricalDomain:ne,duplicateDomain:je,originalDomain:(T=I.domain)!==null&&T!==void 0?T:ye,isCategorical:k,layout:x})))},{})},hVt=function(e,n){var s=n.graphicalItems,i=n.Axis,o=n.axisType,c=n.axisIdKey,a=n.stackGroups,h=n.dataStartIndex,m=n.dataEndIndex,x=e.layout,v=e.children,w=Pie(e.data,{graphicalItems:s,dataStartIndex:h,dataEndIndex:m}),k=w.length,C=FBe(x,o),S=-1;return s.reduce(function(T,I){var A=I.type.defaultProps!==void 0?Wr(Wr({},I.type.defaultProps),I.props):I.props,D=A[c],$=n$e("number");if(!T[D]){S++;var F;return C?F=Vre(0,k):a&&a[D]&&a[D].hasStack?(F=qBe(a[D].stackGroups,h,m),F=kpe(v,F,D,o)):(F=Ufe($,RBe(w,s.filter(function(q){var W,K,Z=c in q.props?q.props[c]:(W=q.type.defaultProps)===null||W===void 0?void 0:W[c],re="hide"in q.props?q.props.hide:(K=q.type.defaultProps)===null||K===void 0?void 0:K.hide;return Z===D&&!re}),"number",x),i.defaultProps.allowDataOverflow),F=kpe(v,F,D,o)),Wr(Wr({},T),{},xi({},D,Wr(Wr({axisType:o},i.defaultProps),{},{hide:!0,orientation:Kh(oVt,"".concat(o,".").concat(S%2),null),domain:F,originalDomain:$,isCategorical:C,layout:x})))}return T},{})},fVt=function(e,n){var s=n.axisType,i=s===void 0?"xAxis":s,o=n.AxisComp,c=n.graphicalItems,a=n.stackGroups,h=n.dataStartIndex,m=n.dataEndIndex,x=e.children,v="".concat(i,"Id"),w=Gf(x,o),k={};return w&&w.length?k=uVt(e,{axes:w,graphicalItems:c,axisType:i,axisIdKey:v,stackGroups:a,dataStartIndex:h,dataEndIndex:m}):c&&c.length&&(k=hVt(e,{Axis:o,graphicalItems:c,axisType:i,axisIdKey:v,stackGroups:a,dataStartIndex:h,dataEndIndex:m})),k},pVt=function(e){var n=v0(e),s=Tx(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:Lye(s,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Ire(n,s)}},Y5e=function(e){var n=e.children,s=e.defaultShowTooltip,i=Ih(n,AC),o=0,c=0;return e.data&&e.data.length!==0&&(c=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(c=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:c,activeTooltipIndex:-1,isTooltipActive:!!s}},mVt=function(e){return!e||!e.length?!1:e.some(function(n){var s=$x(n&&n.type);return s&&s.indexOf("Bar")>=0})},X5e=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},gVt=function(e,n){var s=e.props,i=e.graphicalItems,o=e.xAxisMap,c=o===void 0?{}:o,a=e.yAxisMap,h=a===void 0?{}:a,m=s.width,x=s.height,v=s.children,w=s.margin||{},k=Ih(v,AC),C=Ih(v,C4),S=Object.keys(h).reduce(function(F,q){var W=h[q],K=W.orientation;return!W.mirror&&!W.hide?Wr(Wr({},F),{},xi({},K,F[K]+W.width)):F},{left:w.left||0,right:w.right||0}),T=Object.keys(c).reduce(function(F,q){var W=c[q],K=W.orientation;return!W.mirror&&!W.hide?Wr(Wr({},F),{},xi({},K,Kh(F,"".concat(K))+W.height)):F},{top:w.top||0,bottom:w.bottom||0}),I=Wr(Wr({},T),S),A=I.bottom;k&&(I.bottom+=k.props.height||AC.defaultProps.height),C&&n&&(I=GDt(I,i,s,n));var D=m-I.left-I.right,$=x-I.top-I.bottom;return Wr(Wr({brushBottom:A},I),{},{width:Math.max(D,0),height:Math.max($,0)})},xVt=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},s$e=function(e){var n=e.chartName,s=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,c=e.validateTooltipEventTypes,a=c===void 0?["axis"]:c,h=e.axisComponents,m=e.legendContent,x=e.formatAxisMap,v=e.defaultProps,w=function(I,A){var D=A.graphicalItems,$=A.stackGroups,F=A.offset,q=A.updateId,W=A.dataStartIndex,K=A.dataEndIndex,Z=I.barSize,re=I.layout,he=I.barGap,ue=I.barCategoryGap,je=I.maxBarSize,ne=X5e(re),ye=ne.numericAxisName,ie=ne.cateAxisName,me=mVt(D),fe=[];return D.forEach(function(ve,Ie){var Se=Pie(I.data,{graphicalItems:[ve],dataStartIndex:W,dataEndIndex:K}),oe=ve.type.defaultProps!==void 0?Wr(Wr({},ve.type.defaultProps),ve.props):ve.props,ae=oe.dataKey,Ne=oe.maxBarSize,Te=oe["".concat(ye,"Id")],Be=oe["".concat(ie,"Id")],Le={},Qe=h.reduce(function(Ge,tt){var Et=A["".concat(tt.axisType,"Map")],Lt=oe["".concat(tt.axisType,"Id")];Et&&Et[Lt]||tt.axisType==="zAxis"||Vj();var Ot=Et[Lt];return Wr(Wr({},Ge),{},xi(xi({},tt.axisType,Ot),"".concat(tt.axisType,"Ticks"),Tx(Ot)))},Le),Fe=Qe[ie],Ce=Qe["".concat(ie,"Ticks")],Je=$&&$[Te]&&$[Te].hasStack&&sRt(ve,$[Te].stackGroups),Ae=$x(ve.type).indexOf("Bar")>=0,Ye=Ire(Fe,Ce),ge=[],ft=me&&HDt({barSize:Z,stackGroups:$,totalSize:xVt(Qe,ie)});if(Ae){var nt,Ve,Me=xa(Ne)?je:Ne,rt=(nt=(Ve=Ire(Fe,Ce,!0))!==null&&Ve!==void 0?Ve:Me)!==null&&nt!==void 0?nt:0;ge=WDt({barGap:he,barCategoryGap:ue,bandSize:rt!==Ye?rt:Ye,sizeList:ft[Be],maxBarSize:Me}),rt!==Ye&&(ge=ge.map(function(Ge){return Wr(Wr({},Ge),{},{position:Wr(Wr({},Ge.position),{},{offset:Ge.position.offset-rt/2})})}))}var Re=ve&&ve.type&&ve.type.getComposedData;Re&&fe.push({props:Wr(Wr({},Re(Wr(Wr({},Qe),{},{displayedData:Se,props:I,dataKey:ae,item:ve,bandSize:Ye,barPosition:ge,offset:F,stackedData:Je,layout:re,dataStartIndex:W,dataEndIndex:K}))),{},xi(xi(xi({key:ve.key||"item-".concat(Ie)},ye,Qe[ye]),ie,Qe[ie]),"animationId",q)),childIndex:WSt(ve,I.children),item:ve})}),fe},k=function(I,A){var D=I.props,$=I.dataStartIndex,F=I.dataEndIndex,q=I.updateId;if(!pSe({props:D}))return null;var W=D.children,K=D.layout,Z=D.stackOffset,re=D.data,he=D.reverseStackOrder,ue=X5e(K),je=ue.numericAxisName,ne=ue.cateAxisName,ye=Gf(W,s),ie=rRt(re,ye,"".concat(je,"Id"),"".concat(ne,"Id"),Z,he),me=h.reduce(function(oe,ae){var Ne="".concat(ae.axisType,"Map");return Wr(Wr({},oe),{},xi({},Ne,fVt(D,Wr(Wr({},ae),{},{graphicalItems:ye,stackGroups:ae.axisType===je&&ie,dataStartIndex:$,dataEndIndex:F}))))},{}),fe=gVt(Wr(Wr({},me),{},{props:D,graphicalItems:ye}),A==null?void 0:A.legendBBox);Object.keys(me).forEach(function(oe){me[oe]=x(D,me[oe],fe,oe.replace("Map",""),n)});var ve=me["".concat(ne,"Map")],Ie=pVt(ve),Se=w(D,Wr(Wr({},me),{},{dataStartIndex:$,dataEndIndex:F,updateId:q,graphicalItems:ye,stackGroups:ie,offset:fe}));return Wr(Wr({formattedGraphicalItems:Se,graphicalItems:ye,offset:fe,stackGroups:ie},Ie),me)},C=function(T){function I(A){var D,$,F;return Yqt(this,I),F=Jqt(this,I,[A]),xi(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),xi(F,"accessibilityManager",new Dqt),xi(F,"handleLegendBBoxUpdate",function(q){if(q){var W=F.state,K=W.dataStartIndex,Z=W.dataEndIndex,re=W.updateId;F.setState(Wr({legendBBox:q},k({props:F.props,dataStartIndex:K,dataEndIndex:Z,updateId:re},Wr(Wr({},F.state),{},{legendBBox:q}))))}}),xi(F,"handleReceiveSyncEvent",function(q,W,K){if(F.props.syncId===q){if(K===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(W)}}),xi(F,"handleBrushChange",function(q){var W=q.startIndex,K=q.endIndex;if(W!==F.state.dataStartIndex||K!==F.state.dataEndIndex){var Z=F.state.updateId;F.setState(function(){return Wr({dataStartIndex:W,dataEndIndex:K},k({props:F.props,dataStartIndex:W,dataEndIndex:K,updateId:Z},F.state))}),F.triggerSyncEvent({dataStartIndex:W,dataEndIndex:K})}}),xi(F,"handleMouseEnter",function(q){var W=F.getMouseInfo(q);if(W){var K=Wr(Wr({},W),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseEnter;Oi(Z)&&Z(K,q)}}),xi(F,"triggeredAfterMouseMove",function(q){var W=F.getMouseInfo(q),K=W?Wr(Wr({},W),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseMove;Oi(Z)&&Z(K,q)}),xi(F,"handleItemMouseEnter",function(q){F.setState(function(){return{isTooltipActive:!0,activeItem:q,activePayload:q.tooltipPayload,activeCoordinate:q.tooltipPosition||{x:q.cx,y:q.cy}}})}),xi(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),xi(F,"handleMouseMove",function(q){q.persist(),F.throttleTriggeredAfterMouseMove(q)}),xi(F,"handleMouseLeave",function(q){F.throttleTriggeredAfterMouseMove.cancel();var W={isTooltipActive:!1};F.setState(W),F.triggerSyncEvent(W);var K=F.props.onMouseLeave;Oi(K)&&K(W,q)}),xi(F,"handleOuterEvent",function(q){var W=HSt(q),K=Kh(F.props,"".concat(W));if(W&&Oi(K)){var Z,re;/.*touch.*/i.test(W)?re=F.getMouseInfo(q.changedTouches[0]):re=F.getMouseInfo(q),K((Z=re)!==null&&Z!==void 0?Z:{},q)}}),xi(F,"handleClick",function(q){var W=F.getMouseInfo(q);if(W){var K=Wr(Wr({},W),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onClick;Oi(Z)&&Z(K,q)}}),xi(F,"handleMouseDown",function(q){var W=F.props.onMouseDown;if(Oi(W)){var K=F.getMouseInfo(q);W(K,q)}}),xi(F,"handleMouseUp",function(q){var W=F.props.onMouseUp;if(Oi(W)){var K=F.getMouseInfo(q);W(K,q)}}),xi(F,"handleTouchMove",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(q.changedTouches[0])}),xi(F,"handleTouchStart",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseDown(q.changedTouches[0])}),xi(F,"handleTouchEnd",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseUp(q.changedTouches[0])}),xi(F,"handleDoubleClick",function(q){var W=F.props.onDoubleClick;if(Oi(W)){var K=F.getMouseInfo(q);W(K,q)}}),xi(F,"handleContextMenu",function(q){var W=F.props.onContextMenu;if(Oi(W)){var K=F.getMouseInfo(q);W(K,q)}}),xi(F,"triggerSyncEvent",function(q){F.props.syncId!==void 0&&Jce.emit(ede,F.props.syncId,q,F.eventEmitterSymbol)}),xi(F,"applySyncEvent",function(q){var W=F.props,K=W.layout,Z=W.syncMethod,re=F.state.updateId,he=q.dataStartIndex,ue=q.dataEndIndex;if(q.dataStartIndex!==void 0||q.dataEndIndex!==void 0)F.setState(Wr({dataStartIndex:he,dataEndIndex:ue},k({props:F.props,dataStartIndex:he,dataEndIndex:ue,updateId:re},F.state)));else if(q.activeTooltipIndex!==void 0){var je=q.chartX,ne=q.chartY,ye=q.activeTooltipIndex,ie=F.state,me=ie.offset,fe=ie.tooltipTicks;if(!me)return;if(typeof Z=="function")ye=Z(fe,q);else if(Z==="value"){ye=-1;for(var ve=0;ve=0){var Je,Ae;if(je.dataKey&&!je.allowDuplicatedCategory){var Ye=typeof je.dataKey=="function"?Ce:"payload.".concat(je.dataKey.toString());Je=efe(ve,Ye,ye),Ae=Ie&&Se&&efe(Se,Ye,ye)}else Je=ve==null?void 0:ve[ne],Ae=Ie&&Se&&Se[ne];if(Be||Te){var ge=q.props.activeIndex!==void 0?q.props.activeIndex:ne;return[P.cloneElement(q,Wr(Wr(Wr({},Z.props),Qe),{},{activeIndex:ge})),null,null]}if(!xa(Je))return[Fe].concat(zC(F.renderActivePoints({item:Z,activePoint:Je,basePoint:Ae,childIndex:ne,isRange:Ie})))}else{var ft,nt=(ft=F.getItemByXY(F.state.activeCoordinate))!==null&&ft!==void 0?ft:{graphicalItem:Fe},Ve=nt.graphicalItem,Me=Ve.item,rt=Me===void 0?q:Me,Re=Ve.childIndex,Ge=Wr(Wr(Wr({},Z.props),Qe),{},{activeIndex:Re});return[P.cloneElement(rt,Ge),null,null]}return Ie?[Fe,null,null]:[Fe,null]}),xi(F,"renderCustomized",function(q,W,K){return P.cloneElement(q,Wr(Wr({key:"recharts-customized-".concat(K)},F.props),F.state))}),xi(F,"renderMap",{CartesianGrid:{handler:qL,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:qL},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:qL},YAxis:{handler:qL},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((D=A.id)!==null&&D!==void 0?D:TI("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=L7e(F.triggeredAfterMouseMove,($=A.throttleDelay)!==null&&$!==void 0?$:1e3/60),F.state={},F}return rVt(I,T),Qqt(I,[{key:"componentDidMount",value:function(){var D,$;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(D=this.props.margin.left)!==null&&D!==void 0?D:0,top:($=this.props.margin.top)!==null&&$!==void 0?$:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var D=this.props,$=D.children,F=D.data,q=D.height,W=D.layout,K=Ih($,Hp);if(K){var Z=K.props.defaultIndex;if(!(typeof Z!="number"||Z<0||Z>this.state.tooltipTicks.length-1)){var re=this.state.tooltipTicks[Z]&&this.state.tooltipTicks[Z].value,he=Cpe(this.state,F,Z,re),ue=this.state.tooltipTicks[Z].coordinate,je=(this.state.offset.top+q)/2,ne=W==="horizontal",ye=ne?{x:ue,y:je}:{y:ue,x:je},ie=this.state.formattedGraphicalItems.find(function(fe){var ve=fe.item;return ve.type.name==="Scatter"});ie&&(ye=Wr(Wr({},ye),ie.props.points[Z].tooltipPosition),he=ie.props.points[Z].tooltipPayload);var me={activeTooltipIndex:Z,isTooltipActive:!0,activeLabel:re,activePayload:he,activeCoordinate:ye};this.setState(me),this.renderCursor(K),this.accessibilityManager.setIndex(Z)}}}},{key:"getSnapshotBeforeUpdate",value:function(D,$){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==$.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==D.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==D.margin){var F,q;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(q=this.props.margin.top)!==null&&q!==void 0?q:0}})}return null}},{key:"componentDidUpdate",value:function(D){rfe([Ih(D.children,Hp)],[Ih(this.props.children,Hp)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var D=Ih(this.props.children,Hp);if(D&&typeof D.props.shared=="boolean"){var $=D.props.shared?"axis":"item";return a.indexOf($)>=0?$:o}return o}},{key:"getMouseInfo",value:function(D){if(!this.container)return null;var $=this.container,F=$.getBoundingClientRect(),q=y6t(F),W={chartX:Math.round(D.pageX-q.left),chartY:Math.round(D.pageY-q.top)},K=F.width/$.offsetWidth||1,Z=this.inRange(W.chartX,W.chartY,K);if(!Z)return null;var re=this.state,he=re.xAxisMap,ue=re.yAxisMap,je=this.getTooltipEventType(),ne=Z5e(this.state,this.props.data,this.props.layout,Z);if(je!=="axis"&&he&&ue){var ye=v0(he).scale,ie=v0(ue).scale,me=ye&&ye.invert?ye.invert(W.chartX):null,fe=ie&&ie.invert?ie.invert(W.chartY):null;return Wr(Wr({},W),{},{xValue:me,yValue:fe},ne)}return ne?Wr(Wr({},W),ne):null}},{key:"inRange",value:function(D,$){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=this.props.layout,W=D/F,K=$/F;if(q==="horizontal"||q==="vertical"){var Z=this.state.offset,re=W>=Z.left&&W<=Z.left+Z.width&&K>=Z.top&&K<=Z.top+Z.height;return re?{x:W,y:K}:null}var he=this.state,ue=he.angleAxisMap,je=he.radiusAxisMap;if(ue&&je){var ne=v0(ue);return jCe({x:W,y:K},ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var D=this.props.children,$=this.getTooltipEventType(),F=Ih(D,Hp),q={};F&&$==="axis"&&(F.props.trigger==="click"?q={onClick:this.handleClick}:q={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var W=ire(this.props,this.handleOuterEvent);return Wr(Wr({},W),q)}},{key:"addListener",value:function(){Jce.on(ede,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Jce.removeListener(ede,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(D,$,F){for(var q=this.state.formattedGraphicalItems,W=0,K=q.length;W");return t}const o$e=P.forwardRef(({id:t,className:e,children:n,config:s,...i},o)=>{const c=P.useId(),a=`chart-${t||c.replace(/:/g,"")}`;return r.jsx(i$e.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":a,ref:o,className:$t("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...i,children:[r.jsx(bVt,{id:a,config:s}),r.jsx(Nfe,{children:n})]})})});o$e.displayName="Chart";const bVt=({id:t,config:e})=>{const n=Object.entries(e).filter(([s,i])=>i.theme||i.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(_Vt).map(([s,i])=>` ${i} [data-chart=${t}] { ${n.map(([o,c])=>{var h;const a=((h=c.theme)==null?void 0:h[s])||c.color;return a?` --color-${o}: ${a};`:null}).join(` `)} } `).join(` `)}}):null},l$e=P.forwardRef(({active:t,payload:e,className:n,indicator:s="dot",hideLabel:i=!1,hideIndicator:o=!1,label:c,labelFormatter:a,labelClassName:h,formatter:m,color:x,nameKey:v,labelKey:w},k)=>{const{config:C}=a$e(),S=P.useMemo(()=>{var F;if(i||!(e!=null&&e.length))return null;const[I]=e,A=`${w||I.dataKey||I.name||"value"}`,D=Mpe(C,I,A),$=!w&&typeof c=="string"?((F=C[c])==null?void 0:F.label)||c:D==null?void 0:D.label;return a?r.jsx("div",{className:$t("font-medium",h),children:a($,e)}):$?r.jsx("div",{className:$t("font-medium",h),children:$}):null},[c,a,e,i,h,C,w]);if(!t||!(e!=null&&e.length))return null;const T=e.length===1&&s!=="dot";return r.jsxs("div",{ref:k,className:$t("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[T?null:S,r.jsx("div",{className:"grid gap-1.5",children:e.map((I,A)=>{const D=`${v||I.name||I.dataKey||"value"}`,$=Mpe(C,I,D),F=x||I.payload.fill||I.color;return r.jsx("div",{className:$t("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",s==="dot"&&"items-center"),children:m&&(I==null?void 0:I.value)!==void 0&&I.name?m(I.value,I.name,I,A,I.payload):r.jsxs(r.Fragment,{children:[$!=null&&$.icon?r.jsx($.icon,{}):!o&&r.jsx("div",{className:$t("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":s==="dot","w-1":s==="line","w-0 border-[1.5px] border-dashed bg-transparent":s==="dashed","my-0.5":T&&s==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),r.jsxs("div",{className:$t("flex flex-1 justify-between leading-none",T?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[T?S:null,r.jsx("span",{className:"text-muted-foreground",children:($==null?void 0:$.label)||I.name})]}),I.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:I.value.toLocaleString()})]})]})},I.dataKey)})})]})});l$e.displayName="ChartTooltip";const wVt=P.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:s="bottom",nameKey:i},o)=>{const{config:c}=a$e();return n!=null&&n.length?r.jsx("div",{ref:o,className:$t("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",t),children:n.map(a=>{const h=`${i||a.dataKey||"value"}`,m=Mpe(c,a,h);return r.jsxs("div",{className:$t("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[m!=null&&m.icon&&!e?r.jsx(m.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:a.color}}),m==null?void 0:m.label]},a.value)})}):null});wVt.displayName="ChartLegend";function Mpe(t,e,n){if(typeof e!="object"||e===null)return;const s="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let i=n;return n in e&&typeof e[n]=="string"?i=e[n]:s&&n in s&&typeof s[n]=="string"&&(i=s[n]),i in t?t[i]:t[n]}const VL=["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 c$e({stats:t,year:e}){const n=t.transactionsByMonth.some(i=>i.count>0),s=t.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(Ze,{children:r.jsx(et,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[n&&r.jsxs(Ze,{className:"overflow-hidden",children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(et,{className:"overflow-hidden",children:r.jsx(o$e,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Nfe,{width:"100%",height:"100%",children:r.jsxs(yVt,{data:t.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(q9e,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Eie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Iie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(Hp,{content:r.jsx(l$e,{})}),r.jsx(nk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(et,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Nfe,{width:"100%",height:"100%",children:r.jsxs(vVt,{children:[r.jsx(cy,{data:t.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:i,percent:o})=>o>.05?`${i} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:t.leadSourceBreakdown.map((i,o)=>r.jsx(aie,{fill:VL[o%VL.length]},`cell-${o}`))}),r.jsx(Hp,{formatter:(i,o)=>[`${i} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:t.leadSourceBreakdown.slice(0,6).map((i,o)=>r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:VL[o%VL.length]}}),r.jsx("span",{className:"text-muted-foreground",children:i.name})]},i.name))})]})]})]})}function jVt(t){if(!t||!t.trim())return null;const e=t.trim(),n=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const s of n)try{const i=Qge(e,s,new Date);if(uhe(i))return un(i,"yyyy-MM-dd")}catch{}try{const s=new Date(e);if(uhe(s))return un(s,"yyyy-MM-dd")}catch{}return null}const kVt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function NVt({open:t,onOpenChange:e}){const[n,s]=P.useState([]),[i,o]=P.useState(!1),[c,a]=P.useState(0),{data:h}=hse(),{data:m}=Ig(),x=fse(),v=()=>{const I=kVt.join(","),A=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),D=`${I} ${A}`,$=new Blob([D],{type:"text/csv"}),F=URL.createObjectURL($),q=document.createElement("a");q.href=F,q.download="transaction-import-template.csv",q.click(),URL.revokeObjectURL(F)},w=I=>{const A=I.split(` `).filter($=>$.trim());if(A.length<2)return[];const D=A[0].split(",").map($=>$.trim().toLowerCase().replace(/['"]/g,""));return A.slice(1).map(($,F)=>{var me,fe,ve,Ie;const q=[];let W="",K=!1;for(const Se of $)Se==='"'?K=!K:Se===","&&!K?(q.push(W.trim()),W=""):W+=Se;q.push(W.trim());const Z=Se=>{var ae;const oe=D.indexOf(Se);return oe>=0?(ae=q[oe])==null?void 0:ae.replace(/^["']|["']$/g,"").trim():""},re=(me=Z("transaction_type"))==null?void 0:me.toLowerCase(),he=(fe=Z("sale_price"))==null?void 0:fe.replace(/[$,]/g,""),ue=(ve=Z("commission_amount"))==null?void 0:ve.replace(/[$,]/g,""),je=(Ie=Z("is_win"))==null?void 0:Ie.toLowerCase(),ne=Z("close_date"),ye=jVt(ne);let ie;return Z("property_address")?["buyer","seller"].includes(re)?ye?(!he||isNaN(Number(he)))&&(ie="Invalid sale price"):ie=`Invalid date format: "${ne}" - use MM/DD/YYYY or YYYY-MM-DD`:ie='Transaction type must be "buyer" or "seller"':ie="Missing property address",{property_address:Z("property_address"),city:Z("city"),state:Z("state"),zip:Z("zip"),transaction_type:re==="seller"?"seller":"buyer",close_date:ye||"",sale_price:Number(he)||0,commission_amount:ue?Number(ue):null,lead_source_name:Z("lead_source"),client_type_name:Z("client_type"),is_win:["yes","true","1"].includes(je),notes:Z("notes"),error:ie}})},k=I=>{var $;const A=($=I.target.files)==null?void 0:$[0];if(!A)return;const D=new FileReader;D.onload=F=>{var K;const q=(K=F.target)==null?void 0:K.result,W=w(q);s(W)},D.readAsText(A)},C=async()=>{const I=n.filter($=>!$.error);if(I.length===0){He.error("No valid transactions to import");return}o(!0),a(0);let A=0,D=0;for(let $=0;$K.name.toLowerCase()===F.lead_source_name.toLowerCase()),W=m==null?void 0:m.find(K=>K.name.toLowerCase()===F.client_type_name.toLowerCase());await x.mutateAsync({property_address:F.property_address,city:F.city||null,state:F.state||null,zip:F.zip||null,transaction_type:F.transaction_type,close_date:F.close_date,sale_price:F.sale_price,commission_amount:F.commission_amount,lead_source_id:(q==null?void 0:q.id)||null,client_type_id:(W==null?void 0:W.id)||null,contact_id:null,notes:F.notes||null,is_win:F.is_win}),A++}catch(q){D++,console.error("Failed to import transaction:",q)}a(Math.round(($+1)/I.length*100))}o(!1),A>0&&He.success(`Imported ${A} transaction${A>1?"s":""}`),D>0&&He.error(`Failed to import ${D} transaction${D>1?"s":""}`),s([]),e(!1)},S=n.filter(I=>!I.error).length,T=n.filter(I=>I.error).length;return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Import Transactions"}),r.jsx(us,{children:"Upload a CSV file with your past transactions"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Download Template"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),r.jsxs(te,{variant:"outline",onClick:v,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(xt,{id:"csv-file",type:"file",accept:".csv",onChange:k})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ft,{variant:"outline",children:[n.length," rows found"]}),S>0&&r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx($a,{className:"h-3 w-3 mr-1"}),S," valid"]}),T>0&&r.jsxs(Ft,{variant:"destructive",children:[r.jsx(Ul,{className:"h-3 w-3 mr-1"}),T," errors"]})]}),r.jsx(_l,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((I,A)=>r.jsxs("div",{className:`p-2 rounded text-sm ${I.error?"bg-destructive/10":"bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:I.property_address||"(no address)"}),r.jsx(Ft,{variant:I.transaction_type==="buyer"?"default":"secondary",children:I.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[I.close_date," • $",I.sale_price.toLocaleString()]}),I.error&&r.jsx(bxe,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(wxe,{className:"text-xs",children:I.error})})]},A)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),i&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${c}%`}})}),r.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",c,"%"]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{onClick:C,disabled:S===0||i,children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Import ",S," Transaction",S!==1?"s":""]})]})]})]})})}const SVt=s5({transactions_goal:YT().min(0).optional(),volume_goal:YT().min(0).optional(),gci_goal:YT().min(0).optional()});function CVt({open:t,onOpenChange:e,year:n,existingGoals:s}){const i=aft(),{data:o}=pse(),c=(o==null?void 0:o.show_commission)??!0,a=ese({resolver:tse(SVt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});P.useEffect(()=>{s?a.reset({transactions_goal:s.transactions_goal??void 0,volume_goal:s.volume_goal?Number(s.volume_goal):void 0,gci_goal:s.gci_goal?Number(s.gci_goal):void 0}):a.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,a,t]);const h=async m=>{await i.mutateAsync({year:n,transactions_goal:m.transactions_goal??null,volume_goal:m.volume_goal??null,gci_goal:c?m.gci_goal??null:null}),e(!1)};return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-md",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:[n," Goals"]}),r.jsx(us,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(rse,{...a,children:r.jsxs("form",{onSubmit:a.handleSubmit(h),className:"space-y-4",children:[r.jsx(kl,{control:a.control,name:"transactions_goal",render:({field:m})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Transactions Goal"}),r.jsx(gl,{children:r.jsx(xt,{type:"number",placeholder:"e.g., 24",...m,value:m.value??"",onChange:x=>m.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(tee,{children:"Total number of deals you want to close"}),r.jsx(yu,{})]})}),r.jsx(kl,{control:a.control,name:"volume_goal",render:({field:m})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"Volume Goal ($)"}),r.jsx(gl,{children:r.jsx(xt,{type:"number",placeholder:"e.g., 5000000",...m,value:m.value??"",onChange:x=>m.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(tee,{children:"Total sales volume you want to achieve"}),r.jsx(yu,{})]})}),c&&r.jsx(kl,{control:a.control,name:"gci_goal",render:({field:m})=>r.jsxs(pl,{children:[r.jsx(ml,{children:"GCI Goal ($)"}),r.jsx(gl,{children:r.jsx(xt,{type:"number",placeholder:"e.g., 150000",...m,value:m.value??"",onChange:x=>m.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(tee,{children:"Gross commission income target"}),r.jsx(yu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(te,{type:"submit",disabled:i.isPending,children:"Save Goals"})]})]})})]})})}const d$e=new Date().getFullYear(),MVt=Array.from({length:10},(t,e)=>d$e-e);function TVt(){var F;const[t,e]=P.useState(d$e),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[c,a]=P.useState(!1),[h,m]=P.useState(!1),{data:x,isLoading:v}=cxe(t),{yearStats:w,lifetimeStats:k,showCommission:C}=p8e(t),{data:S,isLoading:T}=f8e(t),{data:I}=pse(),A=oft(),D=()=>{if(!x||x.length===0)return;const q=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...C?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],W=x.map(ue=>{var je,ne;return[ue.property_address,ue.city||"",ue.state||"",ue.zip||"",ue.transaction_type,ue.close_date,ue.sale_price,...C?[ue.commission_amount||""]:[],((je=ue.lead_source)==null?void 0:je.name)||"",((ne=ue.client_type)==null?void 0:ne.name)||"",ue.contact?`${ue.contact.first_name} ${ue.contact.last_name||""}`.trim():"",ue.is_win?"Yes":"No",ue.notes||""]}),K=[q,...W].map(ue=>ue.map(je=>`"${String(je).replace(/"/g,'""')}"`).join(",")).join(` `),Z=new Blob([K],{type:"text/csv"}),re=URL.createObjectURL(Z),he=document.createElement("a");he.href=re,he.download=`transactions-${t}.csv`,he.click(),URL.revokeObjectURL(re)},$=!x||x.length===0;return r.jsxs(Dr,{title:"Scorecard",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Scorecard"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Business Scorecard"}),r.jsx("p",{className:"text-muted-foreground",children:"Track your transactions, goals, and performance"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(_n,{value:String(t),onValueChange:q=>e(Number(q)),children:[r.jsx(yn,{className:"w-[120px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:MVt.map(q=>r.jsx(tr,{value:String(q),children:q},q))})]}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(!h),children:r.jsx(od,{className:"h-4 w-4"})})]})]}),h&&r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsx(Xt,{className:"text-lg",children:"Settings"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Xe,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Js,{checked:(I==null?void 0:I.show_commission)??!0,onCheckedChange:q=>A.mutate({show_commission:q})})]})})]}),$&&!v?r.jsx(Ze,{className:"py-12",children:r.jsxs(et,{className:"text-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(nc,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mt-1",children:"Add your past transactions to see your performance metrics, track your goals, and celebrate your wins."})]}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(te,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),r.jsxs("div",{className:"pt-4 border-t mt-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),r.jsx(te,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(te,{onClick:()=>s(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(te,{variant:"outline",onClick:()=>a(!0),children:[r.jsx(Rx,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(te,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(te,{variant:"outline",onClick:D,disabled:$,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(te,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"CSV Template"]})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ui,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:w.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.totalTransactions," lifetime"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[w.buyerCount,"/",w.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ad,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Nd(w.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Nd(k.totalVolume,!0)," lifetime"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Nd(w.averagePrice,!0)})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ml,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((F=w.topLeadSource)==null?void 0:F.name)||"-"}),w.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.topLeadSource.count," deals"]})]})}),C&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ad,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Nd(w.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Nd(k.totalCommission,!0)," lifetime"]})]})})]}),S&&r.jsx(vze,{goals:S,stats:w,year:t,showCommission:C}),r.jsxs(Oa,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"transactions",children:"Transactions"}),r.jsx(xn,{value:"charts",children:"Charts"})]}),r.jsx(Un,{value:"transactions",children:r.jsx(yze,{transactions:x||[],showCommission:C,isLoading:v})}),r.jsx(Un,{value:"charts",children:r.jsx(c$e,{stats:w,year:t})})]})]})]}),r.jsx(xze,{open:n,onOpenChange:s}),r.jsx(NVt,{open:i,onOpenChange:o}),r.jsx(CVt,{open:c,onOpenChange:a,year:t,existingGoals:S})]})}function u$e({open:t,onOpenChange:e,listingId:n,listingSlug:s,listingTitle:i}){const{user:o}=zr(),[c,a]=P.useState(null),[h,m]=P.useState(!1),[x,v]=P.useState(!1);P.useEffect(()=>{(async()=>{if(!(!t||!o)){m(!0);try{const{data:T,error:I}=await ee.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",n).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(I)throw I;if(T&&T.share_token)a(T);else if(T&&!T.share_token){const{data:A,error:D}=await ee.from("listing_shares").update({share_type:"referral_link"}).eq("id",T.id).select("id, share_token, click_count, lead_count").single();if(D)throw D;a(A)}else{const{data:A,error:D}=await ee.from("listing_shares").insert({listing_id:n,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(D)throw D;a(A)}}catch(T){console.error("Error creating share link:",T),He.error("Failed to generate share link")}finally{m(!1)}}})()},[t,o,n]);const w=c!=null&&c.share_token?`https://listings.relevelup.com/${s||n}?ref=${c.share_token}`:"",k=async()=>{try{await navigator.clipboard.writeText(w),v(!0),He.success("Link copied to clipboard!"),setTimeout(()=>v(!1),2e3)}catch{He.error("Failed to copy link")}},C=S=>{const T=encodeURIComponent(w),I=encodeURIComponent(`Check out this listing: ${i}`);switch(S){case"email":window.open(`mailto:?subject=${I}&body=${T}`);break;case"text":window.open(`sms:?body=${I}%20${T}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${T}`,"_blank");break}};return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(As,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(us,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:r.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[r.jsx("strong",{children:"How it works:"})," The listing still shows the original agent's info, but any leads from your unique link go directly to you!"]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:h?"Generating...":w,readOnly:!0,className:"font-mono text-sm"}),r.jsx(te,{onClick:k,disabled:h||!w,variant:x?"default":"outline",children:x?r.jsx($a,{className:"h-4 w-4"}):r.jsx(Vl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>C("email"),disabled:h,children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>C("text"),disabled:h,children:[r.jsx(vl,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(te,{variant:"outline",className:"flex-1",onClick:()=>C("facebook"),disabled:h,children:[r.jsx(Td,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),c&&(c.click_count>0||c.lead_count>0)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx(Xe,{className:"mb-2 block",children:"Your Share Performance"}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[r.jsx(Al,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Clicks"})]}),r.jsx("p",{className:"text-2xl font-bold",children:c.click_count})]}),r.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-primary mb-1",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Leads"})]}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:c.lead_count})]})]})]})]})]})})}const AVt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},EVt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},IVt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function rde({listing:t,onClick:e,onEdit:n,onDelete:s,showActions:i}){var S,T;const{user:o}=zr(),{data:c}=o8e(t.id),a=a8e(),[h,m]=P.useState(!1),x=I=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(I),v=((S=t.photos)==null?void 0:S.find(I=>I.is_primary))||((T=t.photos)==null?void 0:T[0]),w=(o==null?void 0:o.id)===t.agent_id,k=async I=>{I.stopPropagation();try{const A=await a.mutateAsync(t.id);He.success(A.saved?"Listing saved!":"Listing removed from saved")}catch{He.error("Failed to save listing")}},C=I=>{if(I.stopPropagation(),o)m(!0);else{const A=`https://listings.relevelup.com/${t.slug||t.id}`;navigator.clipboard.writeText(A),He.success("Link copied to clipboard!")}};return r.jsxs(Ze,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:e,children:[r.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[v?r.jsx("img",{src:v.photo_url,alt:t.property_address||t.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(cm,{className:"h-12 w-12"})}),r.jsx(Ft,{className:`absolute top-2 left-2 ${AVt[t.status]} text-white border-0`,children:EVt[t.status]}),t.is_featured&&r.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:r.jsx(Bs,{className:"h-4 w-4 text-white fill-white"})}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(te,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:k,children:r.jsx(oa,{className:`h-4 w-4 ${c?"fill-pink-500 text-pink-500":""}`})}),r.jsx(te,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:C,title:w?"Copy link":"Share & earn leads",children:w?r.jsx(Xd,{className:"h-4 w-4"}):r.jsx(As,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(u$e,{open:h,onOpenChange:m,listingId:t.id,listingSlug:t.slug||null,listingTitle:t.property_address||`${t.city}, ${t.state}`}),r.jsxs(et,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:x(t.price)}),t.open_to_referrals&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:[r.jsx(fs,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),r.jsxs("div",{children:[t.property_address&&r.jsx("p",{className:"font-medium truncate",children:t.property_address}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(cl,{className:"h-3 w-3"}),t.city,", ",t.state,t.neighborhood&&` • ${t.neighborhood}`]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[t.bedrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zf,{className:"h-4 w-4"}),t.bedrooms," bd"]}),t.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ff,{className:"h-4 w-4"}),t.bathrooms," ba"]}),t.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(cm,{className:"h-4 w-4"}),t.square_footage.toLocaleString()," sqft"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsx(Ft,{variant:"secondary",className:"text-xs",children:IVt[t.property_type]}),t.agent&&r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:t.agent.name})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Al,{className:"h-3 w-3"}),t.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Xd,{className:"h-3 w-3"}),t.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-3 w-3"}),t.save_count]})]}),i&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(te,{variant:"outline",size:"sm",className:"flex-1",onClick:I=>{I.stopPropagation(),n()},children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(te,{variant:"destructive",size:"sm",onClick:I=>{I.stopPropagation(),s()},children:r.jsx(es,{className:"h-4 w-4"})})]})]})]})}const PVt=[{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"}],LVt=[{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 OVt({filters:t,onFiltersChange:e,onClose:n}){const s=()=>{e({sortBy:"newest"})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Xt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Es,{className:"h-4 w-4"})})]})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Status"}),r.jsxs(_n,{value:t.status||"all",onValueChange:i=>e({...t,status:i==="all"?void 0:i}),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"All statuses"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Statuses"}),PVt.map(i=>r.jsx(tr,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Property Type"}),r.jsxs(_n,{value:t.propertyType||"all",onValueChange:i=>e({...t,propertyType:i==="all"?void 0:i}),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"All types"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"all",children:"All Types"}),LVt.map(i=>r.jsx(tr,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Min Price"}),r.jsx(xt,{type:"number",placeholder:"No minimum",value:t.minPrice||"",onChange:i=>e({...t,minPrice:i.target.value?Number(i.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Max Price"}),r.jsx(xt,{type:"number",placeholder:"No maximum",value:t.maxPrice||"",onChange:i=>e({...t,maxPrice:i.target.value?Number(i.target.value):void 0})})]})]}),r.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Js,{checked:t.openToReferrals||!1,onCheckedChange:i=>e({...t,openToReferrals:i||void 0})})]})]})]})}function DVt({leaderboard:t}){const e=s=>{switch(s){case 0:return r.jsx(qa,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(Ox,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Ml,{className:"h-5 w-5 text-amber-700"});default:return r.jsx("span",{className:"text-sm font-medium text-muted-foreground w-5 text-center",children:s+1})}},n=(s,i)=>!s||s.length===0?r.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"No data yet. Start sharing to climb the leaderboard!"}):r.jsx("div",{className:"space-y-2",children:s.map((o,c)=>r.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${c===0?"bg-gradient-to-r from-amber-500/10 to-amber-500/5 border border-amber-500/20":"bg-muted/50"}`,children:[r.jsx("div",{className:"flex items-center justify-center w-8",children:e(c)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Ft,{variant:c===0?"default":"secondary",children:[o.count," ",i]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(et,{children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-emerald-500/10 to-emerald-500/5 border border-emerald-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:r.jsx(Xd,{className:"h-6 w-6 text-emerald-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Listing Amplifier"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Share 10+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-sky-500/10 to-sky-500/5 border border-sky-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-sky-500/20 flex items-center justify-center",children:r.jsx(ui,{className:"h-6 w-6 text-sky-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Top Contributor"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add 5+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-purple-500/10 to-purple-500/5 border border-purple-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-purple-500/20 flex items-center justify-center",children:r.jsx(Ox,{className:"h-6 w-6 text-purple-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Referral Connector"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Send 3+ referrals"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-amber-500/10 to-amber-500/5 border border-amber-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-amber-500/20 flex items-center justify-center",children:r.jsx(qa,{className:"h-6 w-6 text-amber-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Community MVP"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Top performer"})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Community Leaderboard"})}),r.jsx(et,{children:r.jsxs(Oa,{defaultValue:"sharers",children:[r.jsxs(Ta,{className:"w-full",children:[r.jsxs(xn,{value:"sharers",className:"flex-1",children:[r.jsx(Xd,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(xn,{value:"listers",className:"flex-1",children:[r.jsx(ui,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(Un,{value:"sharers",className:"mt-4",children:n(t==null?void 0:t.topSharers,"shares")}),r.jsx(Un,{value:"listers",className:"mt-4",children:n(t==null?void 0:t.topListers,"listings")})]})})]})]})}function RVt(){var q,W,K,Z,re,he,ue,je;const t=ts(),{data:e,isLoading:n}=r8e(),[s,i]=P.useState("feed"),[o,c]=P.useState(!1),[a,h]=P.useState(""),[m,x]=P.useState({sortBy:"newest"}),{data:v,isLoading:w}=n8e({...m,city:a||m.city}),{data:k,isLoading:C}=Vht(),{data:S,isLoading:T}=lxe(),{data:I,isLoading:A}=Kht(),{data:D}=Yht(),$=i8e(),F=async ne=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await $.mutateAsync(ne),He.success("Listing deleted successfully")}catch{He.error("Failed to delete listing")}};return n?r.jsx(Dr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):e?r.jsx(Dr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(ui,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(v==null?void 0:v.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(oa,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(k==null?void 0:k.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(HS,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(S==null?void 0:S.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(fs,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((q=I==null?void 0:I.sent)==null?void 0:q.length)||0)+(((W=I==null?void 0:I.received)==null?void 0:W.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(Oa,{value:s,onValueChange:i,children:[r.jsxs(Ta,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(xn,{value:"feed",children:"Community Feed"}),r.jsx(xn,{value:"my-listings",children:"My Listings"}),r.jsx(xn,{value:"saved",children:"Saved"}),r.jsx(xn,{value:"referrals",children:"Referrals"}),r.jsx(xn,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(Un,{value:"feed",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by city or neighborhood...",value:a,onChange:ne=>h(ne.target.value),className:"pl-9"})]}),r.jsxs(_n,{value:m.sortBy,onValueChange:ne=>x({...m,sortBy:ne}),children:[r.jsx(yn,{className:"w-[180px]",children:r.jsx(bn,{placeholder:"Sort by"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"newest",children:"Newest First"}),r.jsx(tr,{value:"updated",children:"Recently Updated"}),r.jsx(tr,{value:"price_asc",children:"Price: Low to High"}),r.jsx(tr,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(te,{variant:"outline",onClick:()=>c(!o),children:[r.jsx(Jw,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),o&&r.jsx(OVt,{filters:m,onFiltersChange:x,onClose:()=>c(!1)}),w?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((ne,ye)=>r.jsxs(Ze,{children:[r.jsx(Kr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Kr,{className:"h-5 w-3/4"}),r.jsx(Kr,{className:"h-4 w-1/2"}),r.jsx(Kr,{className:"h-4 w-1/4"})]})]},ye))}):(v==null?void 0:v.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(ui,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),r.jsxs(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:v==null?void 0:v.map(ne=>r.jsx(rde,{listing:ne,onClick:()=>t(`/mission-control/listings/${ne.id}`)},ne.id))})]}),r.jsx(Un,{value:"my-listings",className:"space-y-4",children:T?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((ne,ye)=>r.jsxs(Ze,{children:[r.jsx(Kr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Kr,{className:"h-5 w-3/4"}),r.jsx(Kr,{className:"h-4 w-1/2"})]})]},ye))}):(S==null?void 0:S.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(HS,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),r.jsxs(te,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Your First Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:S==null?void 0:S.map(ne=>r.jsx(rde,{listing:ne,showActions:!0,onClick:()=>t(`/mission-control/listings/${ne.id}`),onEdit:()=>t(`/mission-control/listings/${ne.id}/edit`),onDelete:()=>F(ne.id)},ne.id))})}),r.jsx(Un,{value:"saved",className:"space-y-4",children:C?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((ne,ye)=>r.jsxs(Ze,{children:[r.jsx(Kr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Kr,{className:"h-5 w-3/4"}),r.jsx(Kr,{className:"h-4 w-1/2"})]})]},ye))}):(k==null?void 0:k.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(oa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),r.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:k==null?void 0:k.map(ne=>r.jsx(rde,{listing:ne.listing,onClick:()=>t(`/mission-control/listings/${ne.listing.id}`)},ne.id))})}),r.jsx(Un,{value:"referrals",className:"space-y-6",children:r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Xd,{className:"h-4 w-4"}),"Referrals Sent (",((K=I==null?void 0:I.sent)==null?void 0:K.length)||0,")"]}),((Z=I==null?void 0:I.sent)==null?void 0:Z.length)===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(re=I==null?void 0:I.sent)==null?void 0:re.map(ne=>{var ye,ie;return r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:ne.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((ye=ne.listing)==null?void 0:ye.property_address)||((ie=ne.listing)==null?void 0:ie.city)})]}),r.jsx(Ft,{variant:ne.status==="closed"?"default":"secondary",children:ne.status.replace("_"," ")})]})})},ne.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(fs,{className:"h-4 w-4"}),"Referrals Received (",((he=I==null?void 0:I.received)==null?void 0:he.length)||0,")"]}),((ue=I==null?void 0:I.received)==null?void 0:ue.length)===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(je=I==null?void 0:I.received)==null?void 0:je.map(ne=>{var ye;return r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:ne.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(ye=ne.sender)==null?void 0:ye.name]})]}),r.jsx(Ft,{variant:ne.status==="closed"?"default":"secondary",children:ne.status.replace("_"," ")})]}),r.jsx(te,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>t(`/mission-control/listings/${ne.listing_id}`),children:"View Listing"})]})},ne.id)})})]})]})}),r.jsx(Un,{value:"leaderboard",children:r.jsx(DVt,{leaderboard:D})})]})]})}):r.jsx(Dr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(ui,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Coming Soon"}),r.jsx("p",{className:"text-muted-foreground",children:"Listing Exchange is currently in development. Check back soon!"})]})})})}function y0e(){const{user:t}=zr();return rr({queryKey:["deal-pipeline-stages",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await ee.from("deal_pipeline_stages").select("*").eq("owner_user_id",t.id).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function h$e(){const{user:t}=zr(),e=Qr();return dr({mutationFn:async()=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{error:n}=await ee.rpc("initialize_deal_pipeline_stages",{p_user_id:t.id});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function f$e(){const{user:t}=zr();return rr({queryKey:["deal-pipeline-deals",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await ee.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status) `).eq("owner_user_id",t.id).order("updated_at",{ascending:!1});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function p$e(){const{user:t}=zr(),e=Qr();return dr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:i}=await ee.from("deal_pipeline").insert({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||null,contact_id:n.contact_id||null,listing_id:n.listing_id||null,property_address:n.property_address||null,city:n.city||null,state:n.state||null,zip_code:n.zip_code||null,expected_price:n.expected_price||null,expected_commission:n.expected_commission||null,commission_percentage:n.commission_percentage||3,target_close_date:n.target_close_date||null,contract_date:n.contract_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:t.id}).select().single();if(i)throw i;return await ee.from("deal_activities").insert([{deal_id:s.id,activity_type:"system",title:"Deal created",description:`Deal "${n.deal_name}" was created`}]),s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function m$e(){const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function FVt(){const t=Qr();return dr({mutationFn:async({dealId:e,stageId:n,stageName:s})=>{const{data:i,error:o}=await ee.from("deal_pipeline").update({stage_id:n}).eq("id",e).select().single();if(o)throw o;return await ee.from("deal_activities").insert({deal_id:e,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),i},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-activities"]})}})}function zVt(){const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("deal_pipeline").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function BVt(t){return rr({queryKey:["deal-activities",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("deal_activities").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function $Vt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("deal_activities").insert([{deal_id:e.deal_id,activity_type:e.activity_type,title:e.title,description:e.description||null}]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-activities",n.deal_id]})}})}function UVt(t){return rr({queryKey:["deal-checklist",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("deal_checklist_items").select("*").eq("deal_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function qVt(){const t=Qr();return dr({mutationFn:async({id:e,is_completed:n,deal_id:s})=>{const{data:i,error:o}=await ee.from("deal_checklist_items").update({is_completed:n,completed_at:n?new Date().toISOString():null}).eq("id",e).select().single();if(o)throw o;return i},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function VVt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("deal_checklist_items").insert([{deal_id:e.deal_id,title:e.title,description:e.description||null,due_date:e.due_date||null,sort_order:e.sort_order||0}]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function HVt(){const{user:t}=zr();return rr({queryKey:["deal-pipeline-stats",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await ee.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",t.id);if(n)throw n;const s=(e==null?void 0:e.filter(o=>{var c,a;return!((c=o.deal_pipeline_stages)!=null&&c.is_won_stage)&&!((a=o.deal_pipeline_stages)!=null&&a.is_lost_stage)}))||[],i=(e==null?void 0:e.filter(o=>{var c;return(c=o.deal_pipeline_stages)==null?void 0:c.is_won_stage}))||[];return{totalDeals:(e==null?void 0:e.length)||0,activeDeals:s.length,wonDeals:i.length,pipelineValue:s.reduce((o,c)=>o+(c.expected_price||0),0),expectedCommission:s.reduce((o,c)=>o+(c.expected_commission||0),0),wonValue:i.reduce((o,c)=>o+(c.expected_price||0),0)}},enabled:!!(t!=null&&t.id)})}function WVt(t){const{user:e}=zr();return rr({queryKey:["deal-by-listing",t,e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id)||!t)return null;const{data:n,error:s}=await ee.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",e.id).eq("listing_id",t).maybeSingle();if(s)throw s;return n},enabled:!!(e!=null&&e.id)&&!!t})}function GVt(){const t=Qr();return dr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update({listing_id:n}).eq("id",e).select().single();if(i)throw i;return await ee.from("deal_activities").insert({deal_id:e,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:n}}),s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",n.listingId]})}})}function KVt(){const t=Qr();return dr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:i}=await ee.from("deal_pipeline").update({listing_id:null}).eq("id",e).select().single();if(i)throw i;return{data:s,listingId:n}},onSuccess:e=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",e.listingId]})}})}function ZVt({listing:t}){const e=ts(),[n,s]=P.useState(""),[i,o]=P.useState(!1),{data:c,isLoading:a}=WVt(t.id),{data:h,isLoading:m}=y0e(),{data:x,isLoading:v}=f$e(),w=h$e(),k=GVt(),C=KVt(),S=p$e(),T=(x==null?void 0:x.filter(F=>!F.listing_id))||[],I=F=>{if(!(h!=null&&h.length))return null;switch(F){case"coming_soon":case"active":case"price_improvement":return h.find(q=>q.name==="Active");case"under_contract":return h.find(q=>q.name==="Under Contract");case"sold":return h.find(q=>q.is_won_stage);default:return h.find(q=>q.name==="Active")}},A=async()=>{o(!0);try{h!=null&&h.length||await w.mutateAsync();const F=I(t.status);await S.mutateAsync({deal_name:t.property_address?`${t.property_address}, ${t.city}`:`${t.city}, ${t.state}`,deal_type:"seller",stage_id:(F==null?void 0:F.id)||null,listing_id:t.id,property_address:t.property_address,city:t.city,state:t.state,expected_price:t.price,expected_commission:t.price*.03,commission_percentage:3,priority:"medium",probability:50}),He.success("Deal created and linked to listing!")}catch(F){console.error("Failed to create deal:",F),He.error("Failed to create deal")}finally{o(!1)}},D=async()=>{if(!n){He.error("Please select a deal");return}try{await k.mutateAsync({dealId:n,listingId:t.id}),He.success("Listing linked to deal!"),s("")}catch{He.error("Failed to link listing")}},$=async()=>{if(c)try{await C.mutateAsync({dealId:c.id,listingId:t.id}),He.success("Listing unlinked from deal")}catch{He.error("Failed to unlink listing")}};return a||m?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2 text-base",children:[r.jsx(t1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(sn,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):c?r.jsxs(Ze,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"flex items-center gap-2 text-base",children:[r.jsx(Bf,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:c.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:c.deal_pipeline_stages&&r.jsx(Ft,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${c.deal_pipeline_stages.color}20`,color:c.deal_pipeline_stages.color},children:c.deal_pipeline_stages.name})})]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes sync automatically between the listing and pipeline."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>e("/mission-control/pipeline"),children:["View Pipeline",r.jsx(Ho,{className:"h-3 w-3 ml-1"})]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:$,disabled:C.isPending,children:C.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(qT,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Xt,{className:"flex items-center gap-2 text-base",children:[r.jsx(t1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(te,{onClick:A,disabled:i||S.isPending,className:"w-full",size:"sm",children:[i||S.isPending?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),T.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(_n,{value:n,onValueChange:s,children:[r.jsx(yn,{className:"flex-1 text-sm",children:r.jsx(bn,{placeholder:"Link to existing deal..."})}),r.jsx(vn,{children:T.map(F=>r.jsx(tr,{value:F.id,children:F.deal_name},F.id))})]}),r.jsx(te,{variant:"secondary",size:"icon",onClick:D,disabled:!n||k.isPending,children:k.isPending?r.jsx(sn,{className:"h-4 w-4 animate-spin"}):r.jsx(Bf,{className:"h-4 w-4"})})]})]})]})]})}const YVt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},XVt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Q5e={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function QVt(){var je,ne,ye,ie,me,fe,ve,Ie,Se;const{listingId:t}=hd(),e=ts(),{user:n}=zr(),{data:s,isLoading:i}=s8e(t||""),{data:o}=o8e(t||""),{data:c}=Wht(t||""),a=a8e(),h=Hht(),m=Ght(),x=i8e(),v=Zht(),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState({buyerName:"",buyerType:"",notes:""}),q=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),W=oe=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(oe),K=async oe=>{const ae=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,Ne=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;m.mutate({listingId:s.id,shareType:oe});try{switch(oe){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ae)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(ae),He.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${Ne} ${ae}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(Ne)}&body=${encodeURIComponent(`Check out this listing: ${ae}`)}`);break}}catch(Te){console.error("Share error:",Te),He.error("Failed to share")}},Z=async()=>{try{await x.mutateAsync(s.id),He.success("Listing deleted"),e("/mission-control/listings")}catch{He.error("Failed to delete listing")}},re=async()=>{if(!$.buyerName.trim()){He.error("Please enter buyer name");return}try{await v.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:$.buyerName,buyerType:$.buyerType||void 0,notes:$.notes||void 0}),He.success("Referral sent successfully!"),S(!1),F({buyerName:"",buyerType:"",notes:""})}catch{He.error("Failed to send referral")}},he=oe=>{var Fe,Ce;const ae=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,Ne=W((s==null?void 0:s.price)||0),Te=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Be=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Le=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Qe=[Te,Be,Le].filter(Boolean).join(" | ");switch(oe){case"just_listed":return`🏡 JUST LISTED! ${ae} ${Ne} ${Qe} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Fe=s==null?void 0:s.city)==null?void 0:Fe.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${ae} Now ${Ne}! ${Qe} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${Q5e[(s==null?void 0:s.property_type)||"single_family"].toLowerCase()} in ${s==null?void 0:s.city}? 👀 I've got just the one for you! ${Qe} DM me for details! 📩 #ComingSoon #RealEstate #${(Ce=s==null?void 0:s.city)==null?void 0:Ce.replace(/\s/g,"")}`;default:return""}};if(i)return r.jsx(Dr,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-10 w-32"}),r.jsx(Kr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Kr,{className:"h-48"}),r.jsx(Kr,{className:"h-48"}),r.jsx(Kr,{className:"h-48"})]})]})});if(!s)return r.jsx(Dr,{title:"Listing Not Found",description:"",children:r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(te,{onClick:()=>e("/mission-control/listings"),children:"Back to Listings"})]})})});const ue=((je=s.photos)==null?void 0:je.find(oe=>oe.is_primary))||((ne=s.photos)==null?void 0:ne[0]);return r.jsxs(Dr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(te,{variant:"ghost",onClick:()=>e("/mission-control/listings"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>ue&&D(ue.photo_url),children:ue?r.jsx("img",{src:ue.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:(ye=s.photos)==null?void 0:ye.slice(1,5).map((oe,ae)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>D(oe.photo_url),children:r.jsx("img",{src:oe.photo_url,alt:`Photo ${ae+2}`,className:"w-full h-full object-cover"})},oe.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{className:`${YVt[s.status]} text-white border-0`,children:XVt[s.status]}),s.is_featured&&r.jsxs(Ft,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Ft,{variant:"outline",children:[r.jsx(fs,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:W(s.price)}),s.property_address&&r.jsx("p",{className:"text-xl font-medium",children:s.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(cl,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>a.mutate(s.id),children:r.jsx(oa,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>h.mutate(s.id),children:c?r.jsx(Ww,{className:"h-4 w-4"}):r.jsx(dg,{className:"h-4 w-4"})}),!q&&r.jsxs(te,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>I(!0),children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsxs(te,{variant:"outline",children:[r.jsx(Xd,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(ep,{children:[r.jsxs(co,{onClick:()=>K("copy"),children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(co,{onClick:()=>K("facebook"),children:[r.jsx(Td,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(co,{onClick:()=>K("text"),children:[r.jsx(vl,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(co,{onClick:()=>K("email"),children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),q&&r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"outline",onClick:()=>e(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(Jl,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(te,{variant:"destructive",size:"icon",onClick:()=>k(!0),children:r.jsx(es,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[s.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(zf,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bedrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Beds"})]}),s.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ff,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bathrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Baths"})]}),s.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(cm,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.square_footage.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Sq Ft"})]}),s.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(li,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.year_built}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"pt-4 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ft,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),Q5e[s.property_type]]}),s.lot_size&&r.jsxs(Ft,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Ft,{variant:"secondary",children:"HOA"})]}),s.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&r.jsx(te,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]}),r.jsxs("div",{className:"flex items-center gap-4 pt-4 mt-4 border-t text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Al,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Xd,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Share Content"})}),r.jsx(et,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(oe=>r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("p",{className:"font-medium text-sm capitalize",children:[oe.replace("_"," ")," Caption"]}),r.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(he(oe)),He.success("Caption copied!")},children:r.jsx(Vl,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:he(oe)})]},oe))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((me=(ie=s.agent)==null?void 0:ie.name)==null?void 0:me.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((fe=s.agent)==null?void 0:fe.name)||"Unknown"}),((Ie=(ve=s.agent)==null?void 0:ve.brokerage)==null?void 0:Ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!q&&r.jsx("div",{className:"space-y-2",children:((Se=s.agent)==null?void 0:Se.email)&&r.jsx(te,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),q&&r.jsx(ZVt,{listing:s}),!q&&s.open_to_referrals&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"text-lg flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(te,{className:"w-full",onClick:()=>S(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Ur,{open:!!A,onOpenChange:()=>D(null),children:r.jsx(Br,{className:"max-w-4xl",children:r.jsx("img",{src:A||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Ur,{open:w,onOpenChange:k,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Delete Listing"}),r.jsx(us,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:Z,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Ur,{open:C,onOpenChange:S,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Send Buyer Referral"}),r.jsx(us,{children:"Submit buyer information to the listing agent"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Buyer Name *"}),r.jsx(xt,{value:$.buyerName,onChange:oe=>F({...$,buyerName:oe.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Buyer Type"}),r.jsxs(_n,{value:$.buyerType,onValueChange:oe=>F({...$,buyerType:oe}),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select type"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"first_time",children:"First-Time Buyer"}),r.jsx(tr,{value:"investor",children:"Investor"}),r.jsx(tr,{value:"relocating",children:"Relocating"}),r.jsx(tr,{value:"upgrade",children:"Upgrading"}),r.jsx(tr,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Notes"}),r.jsx(gs,{value:$.notes,onChange:oe=>F({...$,notes:oe.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(te,{onClick:re,disabled:v.isPending,children:v.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(u$e,{open:T,onOpenChange:I,listingId:(s==null?void 0:s.id)||"",listingSlug:(s==null?void 0:s.slug)||null,listingTitle:(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`})]})}function JVt({selectedVideoId:t,onVideoSelect:e,listingId:n}){const s=ts(),{user:i}=zr(),[o,c]=P.useState(!1),[a,h]=P.useState([]),[m,x]=P.useState(!1),[v,w]=P.useState(null),[k,C]=P.useState({});P.useEffect(()=>{t&&i?S():w(null)},[t,i]);const S=async()=>{if(!t)return;const{data:Z,error:re}=await ee.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();!re&&Z&&(w(Z),T(Z))},T=async Z=>{try{const{data:re,error:he}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Z.bunny_video_id,isAgentVideo:!0}});!he&&(re!=null&&re.thumbnailUrl)&&C(ue=>({...ue,[Z.id]:{thumbnailUrl:re.thumbnailUrl}}))}catch(re){console.warn("Failed to get signed URL",re)}},I=async()=>{if(i){x(!0);try{const{data:Z,error:re}=await ee.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",i.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(re)throw re;h(Z||[]),Z!=null&&Z.length&&A(Z)}catch(Z){console.error("Error fetching videos:",Z),He.error("Failed to load videos")}finally{x(!1)}}},A=async Z=>{const re=await Promise.allSettled(Z.map(async ue=>{const{data:je,error:ne}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:ue.bunny_video_id,isAgentVideo:!0}});if(ne)throw ne;return{id:ue.id,thumbnailUrl:je==null?void 0:je.thumbnailUrl}})),he={};for(const ue of re)ue.status==="fulfilled"&&ue.value.thumbnailUrl&&(he[ue.value.id]={thumbnailUrl:ue.value.thumbnailUrl});C(ue=>({...ue,...he}))},D=()=>{c(!0),I()},$=Z=>{e(Z.id),w(Z),c(!1),He.success("Video selected")},F=()=>{e(null),w(null)},q=()=>{const Z=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(Z)}`)},W=Z=>{if(!Z)return"0:00";const re=Math.floor(Z/60),he=Z%60;return`${re}:${he.toString().padStart(2,"0")}`},K=Z=>{var re;return((re=k[Z.id])==null?void 0:re.thumbnailUrl)||Z.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[v?r.jsx(Ze,{className:"overflow-hidden",children:r.jsx(et,{className:"p-0",children:r.jsxs("div",{className:"flex items-start gap-4 p-4",children:[r.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[K(v)?r.jsx("img",{src:K(v),alt:v.title||"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Wi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center",children:r.jsx(wc,{className:"h-6 w-6 text-white fill-white"})}),v.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:W(v.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:v.title||"Untitled Video"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:D,children:"Change"}),r.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:F,className:"text-destructive hover:text-destructive",children:r.jsx(Es,{className:"h-4 w-4"})})]})]})})}):r.jsx(Ze,{className:"border-dashed",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Wi,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[r.jsxs(te,{type:"button",variant:"outline",onClick:D,className:"gap-2",children:[r.jsx(JS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(te,{type:"button",variant:"outline",onClick:q,className:"gap-2",children:[r.jsx(Kw,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Ur,{open:o,onOpenChange:c,children:r.jsxs(Br,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(Yr,{children:r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(JS,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:m?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(sn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),r.jsxs(te,{onClick:q,className:"gap-2",children:[r.jsx(Kw,{className:"h-4 w-4"}),"Record Your First Video"]})]}):r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 p-1",children:a.map(Z=>r.jsxs("button",{type:"button",onClick:()=>$(Z),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${t===Z.id?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[K(Z)?r.jsx("img",{src:K(Z),alt:Z.title||"Video",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Wi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:r.jsx(wc,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),Z.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:W(Z.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:Z.title||"Untitled Video"})})]},Z.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(te,{type:"button",variant:"ghost",onClick:q,className:"gap-2",children:[r.jsx(Kw,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(te,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const eHt=[{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"}],tHt=[{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 J5e(){var ye;const{listingId:t}=hd(),[e]=Pd(),n=e.get("brokerage"),s=ts(),{user:i}=zr(),o=!!t&&t!=="new",c=!!n&&!o,{data:a,isLoading:h}=s8e(o?t:""),m=zht(),x=Bht(),v=$ht(),w=Uht(),k=qht(),{data:C=[]}=rr({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:ie,error:me}=await ee.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(me)throw me;return ie||[]},enabled:c}),[S,T]=P.useState(""),[I,A]=P.useState(!1),[D,$]=P.useState([]),[F,q]=P.useState([]),[W,K]=P.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});P.useEffect(()=>{var ie,me,fe,ve,Ie;a&&o&&K({property_address:a.property_address||"",city:a.city||"",state:a.state||"",neighborhood:a.neighborhood||"",price:((ie=a.price)==null?void 0:ie.toString())||"",property_type:a.property_type,status:a.status,bedrooms:((me=a.bedrooms)==null?void 0:me.toString())||"",bathrooms:((fe=a.bathrooms)==null?void 0:fe.toString())||"",square_footage:((ve=a.square_footage)==null?void 0:ve.toString())||"",lot_size:a.lot_size||"",year_built:((Ie=a.year_built)==null?void 0:Ie.toString())||"",has_hoa:a.has_hoa,description:a.description||"",agent_notes:a.agent_notes||"",agent_notes_public:a.agent_notes_public,mls_link:a.mls_link||"",video_link:a.video_link||"",video_id:a.video_id||null,allow_sharing:a.allow_sharing,open_to_referrals:a.open_to_referrals,open_to_social_promotion:a.open_to_social_promotion,share_with_brokerage:a.share_with_brokerage??!1,is_public:a.is_public})},[a,o]);const Z=ie=>{if(!ie)return;const me=Array.from(ie);$(ve=>[...ve,...me]);const fe=me.map(ve=>URL.createObjectURL(ve));q(ve=>[...ve,...fe])},re=ie=>{URL.revokeObjectURL(F[ie]),$(me=>me.filter((fe,ve)=>ve!==ie)),q(me=>me.filter((fe,ve)=>ve!==ie))},he=async ie=>{var me;if(!(!ie||!a)){A(!0);try{for(const fe of Array.from(ie)){const ve=fe.name.split(".").pop(),Ie=`${i==null?void 0:i.id}/${a.id}/${Date.now()}.${ve}`,{error:Se}=await ee.storage.from("listing-photos").upload(Ie,fe);if(Se)throw Se;const{data:{publicUrl:oe}}=ee.storage.from("listing-photos").getPublicUrl(Ie);await w.mutateAsync({listingId:a.id,photoUrl:oe,isPrimary:!((me=a.photos)!=null&&me.length)})}He.success("Photos uploaded!")}catch(fe){console.error("Upload error:",fe),He.error("Failed to upload photos")}finally{A(!1)}}},ue=async ie=>{for(let me=0;me{if(a)try{await k.mutateAsync({photoId:ie,listingId:a.id}),He.success("Photo removed")}catch{He.error("Failed to remove photo")}},ne=async ie=>{if(ie.preventDefault(),!W.city.trim()||!W.state.trim()||!W.price){He.error("Please fill in required fields (City, State, Price)");return}if(c&&!S){He.error("Please select an agent to assign this listing to");return}try{const me={property_address:W.property_address||null,city:W.city,state:W.state,neighborhood:W.neighborhood||null,price:Number(W.price),property_type:W.property_type,status:W.status,bedrooms:W.bedrooms?Number(W.bedrooms):null,bathrooms:W.bathrooms?Number(W.bathrooms):null,square_footage:W.square_footage?Number(W.square_footage):null,lot_size:W.lot_size||null,year_built:W.year_built?Number(W.year_built):null,has_hoa:W.has_hoa,description:W.description||null,agent_notes:W.agent_notes||null,agent_notes_public:W.agent_notes_public,mls_link:W.mls_link||null,video_link:W.video_link||null,video_id:W.video_id||null,allow_sharing:W.allow_sharing,open_to_referrals:W.open_to_referrals,open_to_social_promotion:W.open_to_social_promotion,share_with_brokerage:W.share_with_brokerage,is_public:W.is_public};if(o)await v.mutateAsync({id:t,...me}),He.success("Listing updated!"),s(`/mission-control/listings/${t}`);else{A(!0);let fe;if(c&&S?fe=await x.mutateAsync({agentId:S,...me}):fe=await m.mutateAsync(me),D.length>0)try{await ue(fe.id),F.forEach(ve=>URL.revokeObjectURL(ve)),$([]),q([])}catch(ve){console.error("Photo upload error:",ve),He.error("Listing created but some photos failed to upload")}A(!1),He.success("Listing created!"),s(c?"/my-brokerage":`/mission-control/listings/${fe.id}`)}}catch(me){console.error("Save error:",me),He.error("Failed to save listing"),A(!1)}};return o&&h?r.jsx(Dr,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-10 w-32"}),r.jsx(Kr,{className:"h-[600px] w-full"})]})}):r.jsx(Dr,{title:o?"Edit Listing":c?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:ne,className:"space-y-6",children:[r.jsxs(te,{type:"button",variant:"ghost",onClick:()=>s(c?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),c?"Back to Brokerage":"Back to Listings"]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[c&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Assign to Agent *"})}),r.jsxs(et,{children:[r.jsxs(_n,{value:S,onValueChange:T,children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select an agent..."})}),r.jsx(vn,{children:C.map(ie=>r.jsx(tr,{value:ie.id,children:ie.name||ie.email},ie.id))})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Property Details"})}),r.jsx(et,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(Xe,{children:"Property Address"}),r.jsx(xt,{value:W.property_address,onChange:ie=>K({...W,property_address:ie.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"City *"}),r.jsx(xt,{value:W.city,onChange:ie=>K({...W,city:ie.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"State *"}),r.jsx(xt,{value:W.state,onChange:ie=>K({...W,state:ie.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Neighborhood"}),r.jsx(xt,{value:W.neighborhood,onChange:ie=>K({...W,neighborhood:ie.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Price *"}),r.jsx(xt,{type:"number",value:W.price,onChange:ie=>K({...W,price:ie.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Property Type"}),r.jsxs(_n,{value:W.property_type,onValueChange:ie=>K({...W,property_type:ie}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:tHt.map(ie=>r.jsx(tr,{value:ie.value,children:ie.label},ie.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Status"}),r.jsxs(_n,{value:W.status,onValueChange:ie=>K({...W,status:ie}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:eHt.map(ie=>r.jsx(tr,{value:ie.value,children:ie.label},ie.value))})]})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Property Specs (Optional)"})}),r.jsx(et,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Bedrooms"}),r.jsx(xt,{type:"number",value:W.bedrooms,onChange:ie=>K({...W,bedrooms:ie.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Bathrooms"}),r.jsx(xt,{type:"number",step:"0.5",value:W.bathrooms,onChange:ie=>K({...W,bathrooms:ie.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Sq Ft"}),r.jsx(xt,{type:"number",value:W.square_footage,onChange:ie=>K({...W,square_footage:ie.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Lot Size"}),r.jsx(xt,{value:W.lot_size,onChange:ie=>K({...W,lot_size:ie.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Year Built"}),r.jsx(xt,{type:"number",value:W.year_built,onChange:ie=>K({...W,year_built:ie.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Js,{checked:W.has_hoa,onCheckedChange:ie=>K({...W,has_hoa:ie})}),r.jsx(Xe,{children:"Has HOA"})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Description & Links"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Description"}),r.jsx(gs,{value:W.description,onChange:ie=>K({...W,description:ie.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Agent Notes"}),r.jsx(gs,{value:W.agent_notes,onChange:ie=>K({...W,agent_notes:ie.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{checked:W.agent_notes_public,onCheckedChange:ie=>K({...W,agent_notes_public:ie})}),r.jsx(Xe,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"MLS Link"}),r.jsx(xt,{value:W.mls_link,onChange:ie=>K({...W,mls_link:ie.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Video Link"}),r.jsx(xt,{value:W.video_link,onChange:ie=>K({...W,video_link:ie.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Wi,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(et,{children:r.jsx(JVt,{selectedVideoId:W.video_id,onVideoSelect:ie=>K({...W,video_id:ie}),listingId:o?t:void 0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Photos"})}),r.jsxs(et,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((ye=a==null?void 0:a.photos)==null?void 0:ye.map(ie=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>je(ie.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(Es,{className:"h-3 w-3"})}),ie.is_primary&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},ie.id))),!o&&F.map((ie,me)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>re(me),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(Es,{className:"h-3 w-3"})}),me===0&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},me)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[I?r.jsx(sn,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-8 w-8"}),r.jsx("span",{className:"text-xs",children:"Upload"})]}),r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ie=>o?he(ie.target.files):Z(ie.target.files),disabled:I})]})]}),!o&&D.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[D.length," photo",D.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Sharing & Collaboration"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Js,{checked:W.allow_sharing,onCheckedChange:ie=>K({...W,allow_sharing:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Js,{checked:W.open_to_referrals,onCheckedChange:ie=>K({...W,open_to_referrals:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Js,{checked:W.open_to_social_promotion,onCheckedChange:ie=>K({...W,open_to_social_promotion:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Js,{checked:W.share_with_brokerage,onCheckedChange:ie=>K({...W,share_with_brokerage:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Js,{checked:W.is_public,onCheckedChange:ie=>K({...W,is_public:ie})})]})]})]}),r.jsx(te,{type:"submit",className:"w-full",size:"lg",disabled:m.isPending||v.isPending,children:m.isPending||v.isPending?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function rHt({maxDurationSeconds:t=30,onRecordingComplete:e,onError:n,onRecordingStateChange:s,className:i,teleprompterContent:o}){const c=P.useRef(null),a=P.useRef(null),h=P.useRef(null),m=P.useRef([]),x=P.useRef(null),v=P.useRef(null),w=P.useRef(null),k=P.useRef(null),C=SI(),[S,T]=P.useState(!0),[I,A]=P.useState(!0),[D,$]=P.useState(null),[F,q]=P.useState(!1),[W,K]=P.useState(!1),[Z,re]=P.useState(null),[he,ue]=P.useState(null),[je,ne]=P.useState(0),[ye,ie]=P.useState("user"),[me,fe]=P.useState(0),[ve,Ie]=P.useState(!1),[Se,oe]=P.useState(!0),[ae,Ne]=P.useState(null),[Te,Be]=P.useState(!1),Le=P.useCallback(Ge=>{T(Ge)},[]),Qe=P.useRef(S),Fe=P.useCallback(async()=>{var tt;A(!0),Ne(null);const Ge=C&&S;console.log("[VideoRecorder] initCamera start",{isMobile:C,usePortraitMode:S,shouldBePortrait:Ge,facingMode:ye});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");h.current&&(console.log("[VideoRecorder] stopping existing stream"),h.current.getTracks().forEach(kt=>kt.stop()));const Et=C&&Ge?{facingMode:{ideal:ye},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:ye},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",Et);const Lt=await navigator.mediaDevices.getUserMedia({video:Et,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),Lt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");h.current=Lt,$(!0);const Dt=Lt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Dt.width,"x",Dt.height),c.current){const kt=c.current;kt.srcObject=Lt,kt.muted=!0,kt.playsInline=!0,kt.autoplay=!0,kt.setAttribute("muted",""),kt.setAttribute("playsinline",""),kt.setAttribute("autoplay","");try{(tt=kt.load)==null||tt.call(kt)}catch(Pr){console.warn("[VideoRecorder] videoEl.load failed",Pr)}const sr=async()=>{try{return await kt.play(),console.log("[VideoRecorder] preview play ok"),Be(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:kt.readyState,videoWidth:kt.videoWidth,videoHeight:kt.videoHeight})},300),!0}catch(Pr){return console.warn("[VideoRecorder] preview play blocked",Pr),Be(!0),!1}};await new Promise(Pr=>{let wn=!1;const kn=()=>{wn||(wn=!0,Pr())},pn=()=>{sr().finally(kn)};kt.onloadedmetadata=pn,kt.onloadeddata=pn,setTimeout(kn,1500)})}try{v.current=new AudioContext;const kt=v.current.createMediaStreamSource(Lt);w.current=v.current.createAnalyser(),w.current.fftSize=256,kt.connect(w.current);const sr=()=>{if(w.current){const Pr=new Uint8Array(w.current.frequencyBinCount);w.current.getByteFrequencyData(Pr);const wn=Pr.reduce((kn,pn)=>kn+pn)/Pr.length;fe(Math.min(100,wn/128*100))}k.current=requestAnimationFrame(sr)};sr()}catch(kt){console.warn("Audio context not available:",kt)}}catch(Et){console.error("Camera initialization error:",Et),$(!1);let Lt="Failed to access camera or microphone.";Et.name==="NotAllowedError"?Lt="Camera permission denied. Please allow camera access in your browser settings.":Et.name==="NotFoundError"?Lt="No camera found. Please connect a camera and try again.":Et.name==="NotReadableError"?Lt="Camera is in use by another application. Please close other apps using the camera.":Et.message&&(Lt=Et.message),Ne(Lt),n==null||n(Lt)}finally{A(!1)}},[ye,n,C,S]);P.useEffect(()=>{Qe.current!==S&&D&&!F&&!he&&(Qe.current=S,Fe())},[S,D,F,he,Fe]),P.useEffect(()=>(Fe(),()=>{h.current&&h.current.getTracks().forEach(Ge=>Ge.stop()),x.current&&clearInterval(x.current),k.current&&cancelAnimationFrame(k.current),v.current&&v.current.close(),he&&URL.revokeObjectURL(he)}),[Fe,he]),P.useEffect(()=>{if(I||D!==!0||he)return;const Ge=h.current,tt=c.current;!Ge||!tt||(tt.srcObject!==Ge&&(tt.srcObject=Ge,tt.muted=!0,tt.playsInline=!0,tt.autoplay=!0,tt.setAttribute("muted",""),tt.setAttribute("playsinline",""),tt.setAttribute("autoplay","")),tt.play().then(()=>Be(!1)).catch(Et=>{Be(!0),console.warn("Live preview play blocked on mount:",Et)}))},[D,I,he]),P.useEffect(()=>{s==null||s(F)},[F,s]);const Ce=P.useCallback(async()=>{if(he)return;const Ge=c.current;if(Ge)try{await Ge.play(),Be(!1)}catch(tt){Be(!0),console.warn("Live preview still blocked (needs user gesture):",tt)}},[he]),Je=P.useCallback(()=>{a.current&&a.current.state!=="inactive"&&a.current.stop(),x.current&&(clearInterval(x.current),x.current=null),q(!1),K(!1)},[]),Ae=P.useCallback(()=>{if(!h.current)return;Ce(),m.current=[],ne(0);const tt=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(Lt=>MediaRecorder.isTypeSupported(Lt)),Et=new MediaRecorder(h.current,tt?{mimeType:tt,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});Et.ondataavailable=Lt=>{Lt.data.size>0&&m.current.push(Lt.data)},Et.onstop=()=>{var kt;const Lt=Et.mimeType||tt||((kt=m.current[0])==null?void 0:kt.type)||"video/webm",Ot=new Blob(m.current,{type:Lt});re(Ot);const Dt=URL.createObjectURL(Ot);ue(Dt)},a.current=Et,Et.start(100),q(!0),x.current=setInterval(()=>{ne(Lt=>Lt>=t-1?(Je(),t):Lt+1)},1e3)},[Ce,t,Je]),Ye=P.useCallback(()=>{a.current&&a.current.state==="recording"&&(a.current.pause(),K(!0),x.current&&clearInterval(x.current))},[]),ge=P.useCallback(()=>{a.current&&a.current.state==="paused"&&(a.current.resume(),K(!1),x.current=setInterval(()=>{ne(Ge=>Ge>=t-1?(Je(),t):Ge+1)},1e3))},[t,Je]),ft=P.useCallback(()=>{he&&URL.revokeObjectURL(he),re(null),ue(null),ne(0),Ie(!1),oe(!0),c.current&&h.current&&(c.current.srcObject=h.current,c.current.muted=!0,Ce())},[Ce,he]),nt=P.useCallback(()=>{ie(Ge=>Ge==="user"?"environment":"user")},[]),Ve=P.useCallback(()=>{Z&&e(Z,je)},[Z,je,e]),Me=P.useCallback(()=>{c.current&&he&&(ve?c.current.pause():(oe(!1),c.current.muted=!1,c.current.play()),Ie(!ve))},[he,ve]);P.useEffect(()=>{if(!he)return;const Ge=c.current;if(!Ge)return;oe(!1),Ge.pause(),Ge.removeAttribute("src"),Ge.srcObject=null,Ge.load(),Ge.src=he,Ge.currentTime=0,Ge.playsInline=!0,Ge.muted=!1,Ge.onended=()=>Ie(!1);const tt=()=>{const Et=Ge.error,Lt=Et?`Recorded video failed to play (code ${Et.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",Et),n==null||n(Lt)};return Ge.addEventListener("error",tt),Ge.load(),()=>{Ge.removeEventListener("error",tt)}},[n,he]);const rt=Ge=>{const tt=Math.floor(Ge/60),Et=Ge%60;return`${tt}:${Et.toString().padStart(2,"0")}`},Re=C&&S?"aspect-[9/16]":"aspect-video";return I?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",Re,i),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(sn,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):D===!1?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",Re,i),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(Ul,{className:"h-12 w-12 mx-auto mb-4 text-destructive"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Camera Access Required"}),r.jsx("p",{className:"text-gray-400 mb-4 text-sm",children:ae||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(te,{onClick:()=>Fe(),variant:"secondary",className:"w-full",children:[r.jsx(Fl,{className:"h-4 w-4 mr-2"}),"Try Again"]}),r.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"💡 Tip: If you're viewing this in an embedded preview, try opening the app in a new browser tab for full camera access."})]})]})}):r.jsxs("div",{className:$t("flex flex-col gap-2",i),children:[C&&!F&&!he&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(i4,{className:$t("h-4 w-4",S?"text-muted-foreground":"text-primary")}),r.jsx(Xe,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Js,{id:"orientation-toggle",checked:S,onCheckedChange:Le}),r.jsx(Xe,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(a1,{className:$t("h-4 w-4",S?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:$t("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{Ce()},children:[r.jsx("video",{ref:c,src:he??void 0,className:$t("w-full bg-black",S&&!he?"object-contain":"object-cover",Re,ye==="user"&&!he&&"scale-x-[-1]"),playsInline:!0,controls:!!he,muted:he?Se:!0,autoPlay:!he},he??"live"),!he&&Te&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(te,{type:"button",variant:"secondary",onClick:()=>void Ce(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!he&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),F&&r.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx("div",{className:$t("w-3 h-3 rounded-full",W?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[rt(je)," / ",rt(t)]})]}),F&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Bc,{value:je/t*100,className:"h-1 rounded-none"})}),!he&&r.jsxs("div",{className:"absolute bottom-20 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx(ET,{className:"h-4 w-4 text-white"}),r.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${me}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:he?r.jsxs(r.Fragment,{children:[r.jsxs(te,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:ft,children:[r.jsx(Fl,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(te,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Me,children:ve?r.jsx(Hh,{className:"h-5 w-5"}):r.jsx(wc,{className:"h-5 w-5"})}),r.jsxs(te,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:Ve,children:[r.jsx($a,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:nt,disabled:F,children:r.jsx(l4,{className:"h-5 w-5"})}),F?r.jsxs(r.Fragment,{children:[r.jsx(te,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:W?ge:Ye,children:W?r.jsx(wc,{className:"h-5 w-5"}):r.jsx(Hh,{className:"h-5 w-5"})}),r.jsx(te,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Je,children:r.jsx(cm,{className:"h-6 w-6 fill-current"})})]}):r.jsx(te,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Ae,children:r.jsx(Wi,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function nHt({text:t,isVisible:e,onToggleVisibility:n,isRecording:s=!1,className:i}){const o=P.useRef(null),c=P.useRef(null),a=P.useRef(0),h=P.useRef(0),[m,x]=P.useState(!1),[v,w]=P.useState(30),[k,C]=P.useState(24),[S,T]=P.useState(1.6),[I,A]=P.useState(.85),[D,$]=P.useState("top"),[F,q]=P.useState(!1),W=P.useCallback(he=>{if(!o.current)return;a.current===0&&(a.current=he);const ue=he-a.current;a.current=he,h.current+=v*ue/1e3;const je=Math.floor(h.current);je>0&&(o.current.scrollTop+=je,h.current-=je);const{scrollTop:ne,scrollHeight:ye,clientHeight:ie}=o.current;if(ne+ie>=ye){x(!1);return}c.current=requestAnimationFrame(W)},[v]);P.useEffect(()=>(m?(a.current=0,h.current=0,c.current=requestAnimationFrame(W)):c.current&&cancelAnimationFrame(c.current),()=>{c.current&&cancelAnimationFrame(c.current)}),[m,W]),P.useEffect(()=>{s&&e?(o.current&&(o.current.scrollTop=0),setTimeout(()=>{x(!0)},100)):s||x(!1)},[s,e]);const K=P.useCallback(()=>{o.current&&(o.current.scrollTop=0),x(!1)},[]),Z=P.useCallback(()=>{x(he=>!he)},[]);if(!e)return r.jsx("div",{className:$t("absolute top-4 right-4 pointer-events-auto z-10",i),children:r.jsxs(te,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const re={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:$t("absolute inset-0 pointer-events-none",i),children:[r.jsx("div",{className:$t("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",re[D]),style:{opacity:I},children:r.jsxs("div",{ref:o,className:$t("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",F&&"scale-x-[-1]"),style:{maskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)",WebkitMaskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"},children:[r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${k}px`,lineHeight:S,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:t}),r.jsx("div",{className:"h-32"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsx(te,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(od,{className:"h-4 w-4"})})}),r.jsx(gh,{className:"w-72",side:"left",align:"start",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-xs",children:"Scroll Speed"}),r.jsx(kw,{value:[v],onValueChange:([he])=>w(he),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-xs",children:"Font Size"}),r.jsx(kw,{value:[k],onValueChange:([he])=>C(he),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-xs",children:"Line Spacing"}),r.jsx(kw,{value:[S*10],onValueChange:([he])=>T(he/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-xs",children:"Opacity"}),r.jsx(kw,{value:[I*100],onValueChange:([he])=>A(he/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(te,{variant:D==="top"?"default":"outline",size:"sm",onClick:()=>$("top"),children:r.jsx(K0,{className:"h-4 w-4"})}),r.jsx(te,{variant:D==="center"?"default":"outline",size:"sm",onClick:()=>$("center"),children:r.jsx(s1,{className:"h-4 w-4"})}),r.jsx(te,{variant:D==="bottom"?"default":"outline",size:"sm",onClick:()=>$("bottom"),children:r.jsx(Tu,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Xe,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Js,{checked:F,onCheckedChange:q})]})]})})]}),r.jsx(te,{variant:"secondary",size:"icon",onClick:Z,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:m?r.jsx(Hh,{className:"h-4 w-4"}):r.jsx(wc,{className:"h-4 w-4"})}),r.jsx(te,{variant:"secondary",size:"icon",onClick:K,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(l4,{className:"h-4 w-4"})}),r.jsxs(te,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Qw,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function sHt({onSelectScript:t,onCreateNew:e,selectedScriptId:n,className:s}){const{toast:i}=ua(),[o,c]=P.useState(""),[a,h]=P.useState(null),[m,x]=P.useState("levelup"),{data:v,isLoading:w}=Lwt(),{data:k,isLoading:C}=Owt(),{data:S,isLoading:T}=Dwt(),I=Rwt(),A=P.useMemo(()=>k?k.filter(W=>{const K=!o||W.title.toLowerCase().includes(o.toLowerCase())||W.script_text.toLowerCase().includes(o.toLowerCase())||W.tags.some(re=>re.toLowerCase().includes(o.toLowerCase())),Z=!a||W.category_id===a;return K&&Z}):[],[k,o,a]),D=P.useMemo(()=>S?S.filter(W=>!o||W.title.toLowerCase().includes(o.toLowerCase())||W.script_text.toLowerCase().includes(o.toLowerCase())):[],[S,o]),$=W=>{t({title:W.title,text:W.script_text})},F=async W=>{try{await I.mutateAsync(W),i({title:"Script saved to My Scripts"})}catch{i({title:"Failed to save script",variant:"destructive"})}},q=w||C||T;return r.jsxs("div",{className:$t("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search scripts...",value:o,onChange:W=>c(W.target.value),className:"pl-9"})]})}),r.jsxs(Oa,{value:m,onValueChange:W=>x(W),className:"flex-1 flex flex-col",children:[r.jsxs(Ta,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(xn,{value:"levelup",children:[r.jsx(Si,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(xn,{value:"my-scripts",children:[r.jsx(nm,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(Un,{value:"levelup",className:"flex-1 flex flex-col mt-0 p-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[r.jsx(Ft,{variant:a?"outline":"default",className:"cursor-pointer",onClick:()=>h(null),children:"All"}),v==null?void 0:v.map(W=>r.jsx(Ft,{variant:a===W.id?"default":"outline",className:"cursor-pointer",onClick:()=>h(W.id),children:W.name},W.id))]}),r.jsx(_l,{className:"flex-1 max-h-[50vh]",children:q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Si,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:A.map(W=>r.jsxs(Ze,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===W.id&&"ring-2 ring-primary"),onClick:()=>$(W),children:[r.jsx(Wt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Xt,{className:"text-sm font-medium truncate",children:W.title}),W.category&&r.jsx(Ft,{variant:"secondary",className:"mt-1 text-xs",children:W.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:K=>{K.stopPropagation(),F(W)},children:r.jsx(nm,{className:"h-4 w-4"})}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(et,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:W.script_text})})]},W.id))})})]}),r.jsxs(Un,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[e&&r.jsxs(te,{variant:"outline",className:"mb-4",onClick:e,children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(_l,{className:"flex-1 max-h-[50vh]",children:T?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(sn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):D.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(nm,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No saved scripts"}),r.jsx("p",{className:"text-sm mt-1",children:"Save LevelUp scripts or create your own"})]}):r.jsx("div",{className:"space-y-2",children:D.map(W=>r.jsxs(Ze,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===W.id&&"ring-2 ring-primary"),onClick:()=>$(W),children:[r.jsx(Wt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Xt,{className:"text-sm font-medium truncate",children:W.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:W.is_custom?r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Ft,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(et,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:W.script_text})})]},W.id))})})]})]})]})}function iHt({selectedTemplate:t,onSelect:e,contactName:n,saving:s=!1}){const[i,o]=P.useState(()=>{const a=b4(t);return new Set([a.category])}),c=a=>{o(h=>{const m=new Set(h);return m.has(a)?m.delete(a):m.add(a),m})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xe,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(sn,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:sht.map(a=>{const h=iht(a.id),m=i.has(a.id),x=h.some(v=>v.id===t);return r.jsxs(y4,{open:m,onOpenChange:()=>c(a.id),children:[r.jsxs(v4,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:a.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.length,")"]}),x&&!m&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Tu,{className:$t("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),r.jsx(_4,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:h.map(v=>{const w=t===v.id;return r.jsxs("button",{type:"button",onClick:()=>e(v.id),disabled:s,className:$t("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",w?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[w&&r.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx($a,{className:"h-2.5 w-2.5 text-primary-foreground"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"opacity-70 shrink-0",children:v.icon}),r.jsx("span",{className:"text-sm font-medium truncate",children:v.name})]})]},v.id)})})})]},a.id)})}),n&&t!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',b4(t).headerText(n),'"']})]})}function g$e({open:t,onOpenChange:e,video:n,contactName:s,onTemplateUpdated:i}){const[o,c]=P.useState(n.page_template||"default"),[a,h]=P.useState(!1),[m,x]=P.useState(!1),[v,w]=P.useState(n.page_template||"default"),[k,C]=P.useState([]),[S,T]=P.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[I,A]=P.useState(!1),[D,$]=P.useState(!1),F=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";P.useEffect(()=>{t&&k.length===0&&q()},[t]);const q=async()=>{$(!0);try{const{data:ye,error:ie}=await ee.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ie)throw ie;const me=(ye||[]).map(fe=>({id:fe.id,name:[fe.first_name,fe.last_name].filter(Boolean).join(" ")||"Unnamed",email:fe.email||null}));C(me)}catch(ye){console.error("Failed to fetch contacts:",ye)}finally{$(!1)}},W=async ye=>{T(ye),A(!1),h(!0);try{const{error:ie}=await ee.from("agent_videos").update({contact_id:(ye==null?void 0:ye.id)||null,recipient_name:(ye==null?void 0:ye.name)||null}).eq("id",n.id);if(ie)throw ie;He.success(ye?`Assigned to ${ye.name}`:"Contact removed"),i==null||i()}catch(ie){console.error("Failed to update contact:",ie),He.error("Failed to update contact")}finally{h(!1)}},K=async ye=>{c(ye),h(!0);try{const{error:ie}=await ee.from("agent_videos").update({page_template:ye}).eq("id",n.id);if(ie)throw ie;w(ye),He.success("Template saved!"),i==null||i()}catch(ie){console.error("Failed to save template:",ie),He.error("Failed to save template"),c(v)}finally{h(!1)}},Z=(S==null?void 0:S.name)||null,re=()=>{const ye=n.title||"Video Message",ie=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},he=async()=>{if(!n.thumbnail_url){He.error("Video thumbnail not available yet");return}const ye=re(),ie=`Watch: ${n.title||"Video Message"} ${F}`;try{const me=new Blob([ye],{type:"text/html"}),fe=new Blob([ie],{type:"text/plain"}),ve=new ClipboardItem({"text/html":me,"text/plain":fe});await navigator.clipboard.write([ve]),He.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ie+` `+ye),He.success("Copied! Paste into your email.")}},ue=async()=>{await navigator.clipboard.writeText(F),x(!0),He.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},je=()=>{const ie=b4(o).headerText(Z),me=o==="default"?`Check out this video: ${F}`:`${ie} Check out this special video: ${F}`;window.open(`sms:?body=${encodeURIComponent(me)}`,"_self")},ne=()=>{const ye=b4(o),ie=ye.headerText(Z),me=o==="default"?n.title||"Video Message":ie,fe=`${ye.subText} Watch the video: ${F}`,ve=S!=null&&S.email?encodeURIComponent(S.email):"";window.open(`mailto:${ve}?subject=${encodeURIComponent(me)}&body=${encodeURIComponent(fe)}`,"_self")};return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(bo,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(us,{children:"Choose a themed page template and share your video"})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Jh,{open:I,onOpenChange:A,children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":I,className:"flex-1 justify-between",disabled:a,children:[S?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),S.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(Zw,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(gh,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Mj,{children:[r.jsx(Tj,{placeholder:"Search contacts..."}),r.jsxs(Aj,{children:[r.jsx(Ej,{children:D?"Loading...":"No contacts found."}),r.jsx(Ij,{children:k.map(ye=>r.jsxs(Pj,{value:ye.name,onSelect:()=>W(ye),children:[r.jsx($a,{className:$t("mr-2 h-4 w-4",(S==null?void 0:S.id)===ye.id?"opacity-100":"opacity-0")}),ye.name]},ye.id))})]})]})})]}),S&&r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>W(null),disabled:a,className:"shrink-0",children:r.jsx(Es,{className:"h-4 w-4"})})]}),S&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',b4(o).headerText(S.name),'"']})]}),r.jsx(iHt,{selectedTemplate:o,onSelect:K,contactName:Z,saving:a}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:F,readOnly:!0,className:"font-mono text-sm"}),r.jsx(te,{onClick:ue,variant:m?"default":"outline",className:"shrink-0 gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx($a,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Vl,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Share for Email"}),r.jsxs(te,{variant:"outline",className:"w-full gap-2",onClick:he,children:[r.jsx(Wo,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{variant:"outline",className:"flex-1 gap-2",onClick:je,children:[r.jsx(vl,{className:"h-4 w-4"}),"Text"]}),r.jsxs(te,{variant:"outline",className:"flex-1 gap-2",onClick:ne,children:[r.jsx(oi,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(ai,{children:r.jsx(te,{variant:"outline",onClick:()=>e(!1),children:"Done"})})]})})}function aHt(){var Ve;const t=ts(),[e]=Pd(),{toast:n}=ua(),s=e.get("contact_id"),i=e.get("task_id"),{canRecord:o,remainingMb:c,usagePercent:a,isNearLimit:h}=$wt(),{data:m}=vm(),x=pze(),v=Hwt(),[w,k]=P.useState("record"),[C,S]=P.useState(""),[T,I]=P.useState(!1),[A,D]=P.useState(!1),[$,F]=P.useState(!1),[q,W]=P.useState(null),[K,Z]=P.useState(0),[re,he]=P.useState(0),[ue,je]=P.useState(null),[ne,ye]=P.useState(null),[ie,me]=P.useState(s||""),[fe,ve]=P.useState(""),[Ie,Se]=P.useState(""),[oe,ae]=P.useState(null),[Ne,Te]=P.useState(null),[Be,Le]=P.useState(null),[Qe,Fe]=P.useState(!1),Ce=P.useCallback(async(Me,rt)=>{W(Me),k("uploading");try{const{videoId:Re,uploadUrl:Ge}=await Uwt(fe||"Quick Video Touch");je(Re);const{apiKey:tt}=await qwt(Re),Et=new XMLHttpRequest;Et.upload.onprogress=Ot=>{Ot.lengthComputable&&Z(Ot.loaded/Ot.total*100)},await new Promise((Ot,Dt)=>{Et.onload=()=>{Et.status>=200&&Et.status<300?Ot():Dt(new Error(`Upload failed: ${Et.status}`))},Et.onerror=()=>Dt(new Error("Upload failed")),Et.open("PUT",Ge),Et.setRequestHeader("AccessKey",tt),Et.send(Me)}),k("processing");let Lt=0;for(;Lt<4;){await new Promise(Dt=>setTimeout(Dt,2e3));const Ot=await Vwt(Re);if(Lt=Ot.status,he(Ot.encodeProgress||0),Lt===4)ye({playbackUrl:Ot.directPlayUrl,thumbnailUrl:Ot.thumbnailUrl,previewUrl:Ot.previewUrl||null,duration:Ot.length||rt,fileSizeMb:(Ot.storageSize||Me.size)/(1024*1024)});else if(Lt===5||Lt===6)throw new Error("Video processing failed")}k("details")}catch(Re){console.error("Upload error:",Re),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),k("record")}},[fe,n]),Je=async()=>{if(!(!ue||!ne))try{const Me=ie&&ie!=="none"?ie:null,rt=await x.mutateAsync({bunny_video_id:ue,contact_id:Me,playback_url:ne.playbackUrl,thumbnail_url:ne.thumbnailUrl,preview_url:ne.previewUrl,duration_seconds:ne.duration,file_size_mb:ne.fileSizeMb,title:fe||"Quick Video Touch",notes:Ie,task_id:i||null,status:"ready"});ae(rt.id),Te(rt.share_token||null),Me&&await v.mutateAsync({contactId:Me,videoId:rt.id,notes:Ie}),n({title:"Video saved successfully!"}),k("share")}catch(Me){console.error("Save video error:",Me),n({title:"Failed to save video",description:(Me==null?void 0:Me.message)||"Please try again.",variant:"destructive"})}},Ae=(Me,rt)=>{navigator.clipboard.writeText(rt),Le(Me),setTimeout(()=>Le(null),2e3),n({title:"Copied to clipboard!"})},Ye=()=>Ne?`https://video.relevelup.com/${Ne}`:(ne==null?void 0:ne.playbackUrl)||"",ge=()=>{const Me=m==null?void 0:m.find(Et=>Et.id===ie),rt=Me?`${Me.first_name}`:"",Re=(Me==null?void 0:Me.phone)||"",Ge=(Me==null?void 0:Me.email)||"",tt=Ye();return{text:`Hey${rt?` ${rt}`:""}! I recorded a quick video for you: ${tt}`,link:tt,contactPhone:Re,contactEmail:Ge}},ft=()=>{const{text:Me,contactPhone:rt}=ge(),Re=rt?`sms:${rt}?body=${encodeURIComponent(Me)}`:`sms:?body=${encodeURIComponent(Me)}`;window.open(Re,"_self")},nt=()=>{const{link:Me,contactEmail:rt}=ge(),Re="Check out this video",Ge=`I recorded a quick video for you: ${Me}`,tt=rt?`mailto:${rt}?subject=${encodeURIComponent(Re)}&body=${encodeURIComponent(Ge)}`:`mailto:?subject=${encodeURIComponent(Re)}&body=${encodeURIComponent(Ge)}`;window.open(tt,"_self")};return o?r.jsx(Dr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:r.jsx(Ga,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),r.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),h&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",a.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.toFixed(0)," MB remaining"]})]})]}),w==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(rHt,{maxDurationSeconds:30,onRecordingComplete:Ce,onRecordingStateChange:F,className:"w-full",teleprompterContent:T&&C&&r.jsx(nHt,{text:C,isVisible:T,onToggleVisibility:()=>I(!1),isRecording:$})}),!T&&C&&r.jsxs(te,{variant:"outline",className:"mt-4",onClick:()=>I(!0),children:[r.jsx(Si,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ze,{className:"lg:col-span-1",children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Xt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(gs,{placeholder:"Type or paste your script here...",value:C,onChange:Me=>S(Me.target.value),rows:6}),r.jsxs(qne,{open:A,onOpenChange:D,children:[r.jsx(vge,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:"w-full",children:[r.jsx(Si,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(uI,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(Vne,{className:"p-4 border-b",children:r.jsx(Hne,{children:"Select a Script"})}),r.jsx(sHt,{onSelectScript:Me=>{S(Me.text),D(!1),I(!0)},className:"h-[calc(100vh-80px)]"})]})]}),C&&r.jsx(te,{className:"w-full",onClick:()=>I(!0),children:"Use Script"})]})]})]}),w==="uploading"&&r.jsx(Ze,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center",children:[r.jsx(Ao,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-pulse"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Uploading Video..."}),r.jsx(Bc,{value:K,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[K.toFixed(0),"%"]})]})}),w==="processing"&&r.jsx(Ze,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center",children:[r.jsx(sn,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-spin"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing Video..."}),r.jsx(Bc,{value:re,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[re.toFixed(0),"%"]})]})}),w==="details"&&r.jsxs(Ze,{className:"max-w-lg mx-auto",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Video Details"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Title"}),r.jsx(xt,{value:fe,onChange:Me=>ve(Me.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Attach to Contact (Optional)"}),r.jsxs(_n,{value:ie,onValueChange:me,children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"No contact - use anywhere"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(bo,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),m==null?void 0:m.map(Me=>r.jsx(tr,{value:Me.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jc,{className:"h-4 w-4"}),Me.first_name," ",Me.last_name]})},Me.id))]})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Notes"}),r.jsx(gs,{value:Ie,onChange:Me=>Se(Me.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(te,{className:"w-full",onClick:Je,disabled:x.isPending,children:[x.isPending&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),w==="share"&&r.jsxs(Ze,{className:"max-w-lg mx-auto",children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx($a,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(te,{variant:"outline",className:"justify-start",onClick:ft,children:[r.jsx(vl,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:nt,children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:()=>Ae("link",ge().link),children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Be==="link"&&r.jsx($a,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(te,{variant:"outline",className:"justify-start",onClick:()=>Fe(!0),children:[r.jsx(Yd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(te,{variant:"outline",onClick:()=>t("/mission-control/video-library"),children:"View Library"}),r.jsx(te,{onClick:()=>{k("record"),W(null),je(null),ye(null)},children:"Record Another"})]})]})]}),oe&&Ne&&r.jsx(g$e,{open:Qe,onOpenChange:Fe,video:{id:oe,share_token:Ne,title:fe||null,contact_id:ie||null,thumbnail_url:(ne==null?void 0:ne.thumbnailUrl)||null},contactName:((Ve=m==null?void 0:m.find(Me=>Me.id===ie))==null?void 0:Ve.first_name)||null})]})}):r.jsx(Dr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Lh,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),r.jsx(te,{onClick:()=>t("/mission-control/video-library"),children:"Open Video Library"})]})})}function oHt({open:t,onOpenChange:e}){const{data:n}=vm(),{data:s}=dye(),i=pze(),o=P.useRef(null),[c,a]=P.useState(null),[h,m]=P.useState(""),[x,v]=P.useState(""),[w,k]=P.useState(""),[C,S]=P.useState(!1),[T,I]=P.useState(0),[A,D]=P.useState("idle"),$=(s==null?void 0:s.total_storage_mb)||0,q=((s==null?void 0:s.max_storage_mb)||1024)-$,W=he=>{var ne;const ue=(ne=he.target.files)==null?void 0:ne[0];if(!ue)return;if(!ue.type.startsWith("video/")){He.error("Please select a video file");return}const je=ue.size/(1024*1024);if(je>500){He.error("Video file must be less than 500MB");return}if(je>q){He.error(`Not enough storage. You have ${q.toFixed(1)} MB remaining.`);return}a(ue),h||m(ue.name.replace(/\.[^/.]+$/,""))},K=async()=>{if(!c){He.error("Please select a video file");return}S(!0),I(0),D("creating");try{const{data:he,error:ue}=await ee.functions.invoke("bunny-upload",{body:{action:"create",title:h||c.name,isAgentVideo:!0}});if(ue)throw new Error(ue.message);const{videoId:je,libraryId:ne}=he;D("uploading");const{data:ye,error:ie}=await ee.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:je,isAgentVideo:!0}});if(ie)throw new Error(ie.message);await new Promise((ve,Ie)=>{const Se=new XMLHttpRequest;Se.upload.addEventListener("progress",oe=>{if(oe.lengthComputable){const ae=Math.round(oe.loaded/oe.total*100);I(ae)}}),Se.addEventListener("load",()=>{Se.status>=200&&Se.status<300?ve():Ie(new Error(`Upload failed with status ${Se.status}`))}),Se.addEventListener("error",()=>Ie(new Error("Upload failed"))),Se.open("PUT",ye.uploadUrl),Se.setRequestHeader("AccessKey",ye.apiKey),Se.send(c)}),D("processing");const me=c.size/(1024*1024),fe=`https://iframe.mediadelivery.net/embed/${ne}/${je}`;await i.mutateAsync({bunny_video_id:je,playback_url:fe,file_size_mb:me,title:h||c.name,notes:x||void 0,contact_id:w||void 0,status:"processing",touch_type:"video_upload"}),He.success("Video uploaded successfully! Processing may take a few minutes."),Z()}catch(he){console.error("Upload error:",he),He.error(he instanceof Error?he.message:"Failed to upload video")}finally{S(!1),D("idle")}},Z=()=>{C||(a(null),m(""),v(""),k(""),I(0),D("idle"),e(!1))},re=()=>{switch(A){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${T}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Ur,{open:t,onOpenChange:Z,children:r.jsxs(Br,{className:"sm:max-w-md",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Upload Video"}),r.jsx(us,{children:"Upload a video file from your device to your video library."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Video File"}),c?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Wi,{className:"h-8 w-8 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:c.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(c.size/(1024*1024)).toFixed(1)," MB"]})]}),!C&&r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:he=>{he.stopPropagation(),a(null)},children:r.jsx(Es,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>{var he;return(he=o.current)==null?void 0:he.click()},children:[r.jsx(Ao,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),r.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:W,disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"title",children:"Title"}),r.jsx(xt,{id:"title",value:h,onChange:he=>m(he.target.value),placeholder:"Enter video title",disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Associate with Contact (optional)"}),r.jsxs(_n,{value:w||"__none__",onValueChange:he=>k(he==="__none__"?"":he),disabled:C,children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select a contact"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(he=>r.jsxs(tr,{value:he.id,children:[he.first_name," ",he.last_name||""]},he.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(gs,{id:"notes",value:x,onChange:he=>v(he.target.value),placeholder:"Add any notes about this video",rows:2,disabled:C})]}),C&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(sn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:re()})]}),r.jsx(Bc,{value:A==="uploading"?T:A==="processing"?100:10})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:Z,disabled:C,children:"Cancel"}),r.jsx(te,{onClick:K,disabled:!c||C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function lHt({previewSrc:t,thumbnailSrc:e,alt:n,isHovered:s}){const[i,o]=P.useState(!1),[c,a]=P.useState(!1),h=s&&t&&!i,m=e&&!c;return!m&&!h?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Wi,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[m&&r.jsx("img",{src:e,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${h?"opacity-0":"opacity-100"}`,onError:()=>a(!0)}),h&&r.jsx("img",{src:t,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function cHt({video:t,previewSrc:e,thumbnailSrc:n,onOpen:s,onDelete:i,onNavigateToContact:o,onGetEmbedCode:c,onCopyEmailHtml:a,onShareWithTemplate:h,getContactName:m,getShareUrl:x,copyToClipboard:v,formatDuration:w}){const[k,C]=P.useState(!1);return r.jsxs(Ze,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(lHt,{previewSrc:e,thumbnailSrc:n,alt:t.title||"Video preview",isHovered:k}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:r.jsx(wc,{className:"h-6 w-6 text-primary ml-1"})})}),r.jsx("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:w(t.duration_seconds)}),t.status!=="ready"&&r.jsx(Ft,{variant:t.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:t.status})]}),r.jsx(et,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"font-medium truncate",children:t.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(jc,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:m(t.contact_id)})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Gi,{className:"h-3 w-3"}),r.jsx("span",{children:un(new Date(t.created_at),"MMM d, yyyy")})]}),(t.view_count??0)>0&&r.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[r.jsx(Al,{className:"h-3 w-3"}),r.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]})]}),r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:S=>S.stopPropagation(),children:r.jsx(yx,{className:"h-4 w-4"})})}),r.jsxs(ep,{align:"end",className:"bg-popover",children:[r.jsxs(co,{onClick:S=>{S.stopPropagation(),s()},children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(oC,{}),r.jsxs(co,{onClick:S=>{S.stopPropagation(),h()},children:[r.jsx(Yd,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(co,{onClick:S=>{S.stopPropagation(),v(x(t),"Share link")},children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(co,{onClick:S=>{S.stopPropagation(),c()},children:[r.jsx(Yw,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(co,{onClick:S=>{S.stopPropagation(),a()},children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsx(oC,{}),t.contact_id&&r.jsxs(co,{onClick:S=>{S.stopPropagation(),o()},children:[r.jsx(jc,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(co,{onClick:S=>{S.stopPropagation(),i()},className:"text-destructive",children:[r.jsx(es,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function dHt(){const t=ts(),{data:e,isLoading:n}=Fwt(),{data:s}=dye(),{data:i}=vm(),o=Bwt(),[c,a]=P.useState(""),[h,m]=P.useState(null),[x,v]=P.useState(!1),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(!1),[$,F]=P.useState({}),q=ae=>{if(!ae)return"Unassigned";const Ne=i==null?void 0:i.find(Te=>Te.id===ae);return Ne?`${Ne.first_name} ${Ne.last_name||""}`.trim():"Unknown"},W=ae=>{if(!ae)return"0:00";const Ne=Math.floor(ae/60),Te=ae%60;return`${Ne}:${Te.toString().padStart(2,"0")}`},K=e==null?void 0:e.filter(ae=>{if(!c)return!0;const Ne=q(ae.contact_id).toLowerCase(),Te=(ae.title||"").toLowerCase(),Be=(ae.notes||"").toLowerCase();return Ne.includes(c.toLowerCase())||Te.includes(c.toLowerCase())||Be.includes(c.toLowerCase())});P.useEffect(()=>{(async()=>{if(!(e!=null&&e.length))return;const Ne=e.filter(Be=>(Be==null?void 0:Be.bunny_video_id)&&!$[Be.id]);if(!Ne.length)return;const Te=await Promise.allSettled(Ne.map(async Be=>{const{data:Le,error:Qe}=await ee.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Be.bunny_video_id,isAgentVideo:!0}});if(Qe)throw Qe;return{id:Be.id,previewUrl:Le==null?void 0:Le.previewUrl,thumbnailUrl:Le==null?void 0:Le.thumbnailUrl}}));F(Be=>{const Le={...Be};for(const Qe of Te)Qe.status==="fulfilled"&&(Le[Qe.value.id]={previewUrl:Qe.value.previewUrl,thumbnailUrl:Qe.value.thumbnailUrl});return Le})})().catch(Ne=>console.warn("Failed to load signed Bunny asset URLs",Ne))},[e,$]);const Z=(s==null?void 0:s.total_storage_mb)||0,re=(s==null?void 0:s.max_storage_mb)||1024,he=Z/re*100,ue=he>=80,je=he>=100,ne=async(ae,Ne)=>{await navigator.clipboard.writeText(ae),He.success(`${Ne} copied to clipboard`)},ye=ae=>ae.share_token?`https://video.relevelup.com/${ae.share_token}`:ae.playback_url||"",ie=ae=>{const Ne=ye(ae),Te=i==null?void 0:i.find(Je=>Je.id===ae.contact_id),Be=q(ae.contact_id),Le=Be!=="Unassigned"?Be.split(" ")[0]:"",Qe=(Te==null?void 0:Te.phone)||"",Fe=`Hey${Le?` ${Le}`:""}! I recorded a quick video message for you. Check it out: ${Ne}`,Ce=Qe?`sms:${Qe}?body=${encodeURIComponent(Fe)}`:`sms:?body=${encodeURIComponent(Fe)}`;window.open(Ce,"_self")},me=ae=>{const Ne=i==null?void 0:i.find(Ce=>Ce.id===ae.contact_id),Te=(Ne==null?void 0:Ne.email)||"",Be=ye(ae),Le="Check out this video",Qe=`I recorded a quick video for you: ${Be}`,Fe=Te?`mailto:${Te}?subject=${encodeURIComponent(Le)}&body=${encodeURIComponent(Qe)}`:`mailto:?subject=${encodeURIComponent(Le)}&body=${encodeURIComponent(Qe)}`;window.open(Fe,"_self")},fe=ae=>{var Le;const Ne=ye(ae),Te=ae.title||"Video Message",Be=ae.share_token?`https://video.relevelup.com/thumb/${ae.share_token}`:((Le=$[ae.id])==null?void 0:Le.thumbnailUrl)||ae.thumbnail_url||"";return``},ve=async ae=>{if(!ae.thumbnail_url&&!ae.share_token){He.error("Video thumbnail not available yet");return}const Ne=fe(ae),Te=ye(ae),Be=`Watch: ${ae.title||"Video Message"} ${Te}`;try{const Le=new Blob([Ne],{type:"text/html"}),Qe=new Blob([Be],{type:"text/plain"}),Fe=new ClipboardItem({"text/html":Le,"text/plain":Qe});await navigator.clipboard.write([Fe]),He.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(Be+` `+Ne),He.success("Copied! Paste into your email.")}},Ie=async ae=>{try{He.loading("Preparing download...",{id:"download"});const{data:Ne,error:Te}=await ee.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:ae.bunny_video_id,isAgentVideo:!0}});if(Te||!(Ne!=null&&Ne.downloadUrl))throw new Error((Te==null?void 0:Te.message)||"Failed to get download URL");const Le=`${((ae.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,Qe=await fetch(Ne.downloadUrl);if(!Qe.ok)throw new Error("Failed to fetch video file");const Fe=await Qe.blob(),Ce=URL.createObjectURL(Fe),Je=document.createElement("a");Je.href=Ce,Je.download=Le,Je.rel="noreferrer",document.body.appendChild(Je),Je.click(),Je.remove(),URL.revokeObjectURL(Ce),He.success("Download started",{id:"download"})}catch(Ne){console.error("Download error:",Ne),He.error("Could not force download (your browser may block it).",{id:"download"})}},Se=ae=>{m(ae),v(!0)},oe=async()=>{if(h)try{await o.mutateAsync({id:h.id,bunnyVideoId:h.bunny_video_id,hardDelete:!0}),k(!1),m(null),He.success("Video deleted successfully")}catch{He.error("Failed to delete video")}};return r.jsx(Dr,{title:"Video Library",description:"Manage your video touches",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Video Library"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage and share your video touches"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>S(!0),children:[r.jsx(Ao,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(te,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ze,{className:ue?"border-amber-500":je?"border-destructive":"",children:r.jsxs(et,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(kT,{className:`h-5 w-5 ${je?"text-destructive":ue?"text-amber-500":"text-muted-foreground"}`}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-sm font-medium",children:"Storage Used"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[Z.toFixed(1)," MB / ",re>=1024?`${(re/1024).toFixed(0)} GB`:`${re} MB`]})]}),r.jsx(Bc,{value:Math.min(he,100),className:`h-2 ${je?"[&>div]:bg-destructive":ue?"[&>div]:bg-amber-500":""}`})]}),ue&&!je&&r.jsxs(Ft,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(Ul,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),je&&r.jsxs(Ft,{variant:"destructive",children:[r.jsx(Ul,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),je&&r.jsx("p",{className:"text-sm text-destructive mt-2",children:"You've reached your storage limit. Delete videos to record more."})]})}),r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search videos by contact, title, or notes...",value:c,onChange:ae=>a(ae.target.value),className:"pl-10"})]}),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):(K==null?void 0:K.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Wi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No videos yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),r.jsxs(te,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Record Video"]})]})}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:K==null?void 0:K.map(ae=>{var Ne,Te;return r.jsx(cHt,{video:ae,previewSrc:(Ne=$[ae.id])==null?void 0:Ne.previewUrl,thumbnailSrc:(Te=$[ae.id])==null?void 0:Te.thumbnailUrl,onOpen:()=>Se(ae),onDelete:()=>{m(ae),k(!0)},onNavigateToContact:()=>t(`/mission-control/contacts/${ae.contact_id}`),onGetEmbedCode:()=>{m(ae),I(!0)},onCopyEmailHtml:()=>ve(ae),onShareWithTemplate:()=>{m(ae),D(!0)},getContactName:q,getShareUrl:ye,copyToClipboard:ne,formatDuration:W},ae.id)})}),r.jsx(Ur,{open:x,onOpenChange:v,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:(h==null?void 0:h.title)||"Video Preview"}),r.jsx(us,{children:(h==null?void 0:h.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(jc,{className:"h-3 w-3"}),q(h.contact_id)]})})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:h.playback_url?(()=>{let ae=h.playback_url;return ae.includes("iframe.mediadelivery.net/play/")&&(ae=ae.replace("/play/","/embed/"),ae+=(ae.includes("?")?"&":"?")+"autoplay=false&responsive=true"),ae.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:ae,title:h.title||"Video preview",className:"absolute top-0 left-0 w-full h-full rounded-lg",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:h.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:h.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>He.error("Video preview failed to load")},h.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Wi,{className:"h-12 w-12 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(te,{variant:"outline",onClick:()=>ie(h),children:[r.jsx(vl,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>me(h),children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>ne(ye(h),"Share link"),children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(te,{variant:"outline",onClick:()=>ve(h),children:[r.jsx(oi,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(te,{variant:"outline",onClick:()=>Ie(h),children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(te,{variant:"outline",onClick:()=>{v(!1),D(!0)},children:[r.jsx(Yd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(te,{variant:"destructive",onClick:()=>{v(!1),k(!0)},children:[r.jsx(es,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Ur,{open:w,onOpenChange:k,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Delete Video"}),r.jsx(us,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(te,{variant:"destructive",onClick:oe,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(oHt,{open:C,onOpenChange:S}),r.jsx(Ur,{open:T,onOpenChange:I,children:r.jsxs(Br,{className:"sm:max-w-lg",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Embed Video"}),r.jsx(us,{children:"Copy this code to embed the video on your website."})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Embed Code"}),r.jsx(gs,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(te,{className:"flex-1",onClick:()=>{const ae=``;ne(ae,"Embed code")},children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Copy Embed Code"]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this code into your website's HTML where you want the video to appear. The video will automatically resize to fit its container."})]})]})}),h&&r.jsx(g$e,{open:A,onOpenChange:D,video:h,contactName:q(h.contact_id)})]})})}function x$e({stages:t,currentStageId:e,onStageSelect:n,disabled:s}){const[i,o]=P.useState(!1),c=t.find(h=>h.id===e),a=h=>{h.id!==e&&n(h.id,h.name),o(!1)};return r.jsxs(xm,{open:i,onOpenChange:o,children:[r.jsx(ym,{asChild:!0,children:r.jsxs(te,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:h=>h.stopPropagation(),children:[c&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:c.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(c==null?void 0:c.name)||"Move"}),r.jsx(Ka,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(ep,{align:"end",className:"w-48 z-50 bg-popover",onClick:h=>h.stopPropagation(),children:t.map(h=>{const m=h.icon&&uAe[h.icon]||Au,x=h.id===e;return r.jsxs(co,{onClick:()=>a(h),className:$t("flex items-center gap-2 cursor-pointer",x&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${h.color}20`},children:r.jsx(m,{className:"h-3 w-3",style:{color:h.color}})}),r.jsx("span",{className:"flex-1",children:h.name}),x&&r.jsx($a,{className:"h-4 w-4 text-primary"})]},h.id)})})]})}const uHt={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"}},hHt={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 y$e({deal:t,onClick:e,isDragging:n,stages:s,onStageChange:i,showStagePicker:o=!1,isWonStage:c=!1}){var T,I;const a=SI(),h=uHt[t.deal_type],m=hHt[t.priority],x=P.useMemo(()=>t.target_close_date?cC(new Date(t.target_close_date),new Date):null,[t.target_close_date]),v=x!==null&&x<0,w=x!==null&&x<=7&&x>=0,k=c&&!t.scorecard_transaction_id,C=!!t.scorecard_transaction_id,S=A=>A?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(A):null;return r.jsx(Ze,{className:$t("cursor-pointer transition-all duration-200 hover:shadow-md hover:border-primary/30 group",n&&"opacity-50 rotate-2 shadow-xl",v&&"border-red-200 bg-red-50/30",k&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:e,children:r.jsxs(et,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:t.deal_name})}),r.jsx(Ft,{variant:"outline",className:$t("text-[10px] px-1.5 py-0 shrink-0",h.color),children:h.label})]}),t.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Di,{className:"h-5 w-5",children:r.jsxs(Ri,{className:"text-[10px] bg-primary/10 text-primary",children:[(T=t.contact.first_name)==null?void 0:T[0],(I=t.contact.last_name)==null?void 0:I[0]]})}),r.jsxs("span",{className:"truncate",children:[t.contact.first_name," ",t.contact.last_name]})]}),t.listing&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(Bf,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),k&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[r.jsx(qa,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),C&&c&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[r.jsx(Ha,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),!t.listing&&(t.property_address||t.city)&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(ui,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:t.property_address||`${t.city}, ${t.state}`})]}),t.expected_price&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(ad,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:S(t.expected_price)}),t.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",S(t.expected_commission)," GCI"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:$t("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",m.color),children:[r.jsx("div",{className:$t("w-1.5 h-1.5 rounded-full",m.dot)}),r.jsx("span",{className:"capitalize",children:t.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.probability,"%"]})]}),o&&a&&s&&i?r.jsx(x$e,{stages:s,currentStageId:t.stage_id||"",onStageSelect:(A,D)=>i(t.id,A,D)}):t.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-[10px]",v&&"text-red-600",w&&!v&&"text-amber-600",!v&&!w&&"text-muted-foreground"),children:[v?r.jsx(Ul,{className:"h-3 w-3"}):r.jsx(li,{className:"h-3 w-3"}),r.jsx("span",{children:v?`${Math.abs(x)}d overdue`:w?`${x}d left`:un(new Date(t.target_close_date),"MMM d")})]}):null]})]})})}function fHt({stage:t,deals:e,onDealClick:n,onAddDeal:s,onDragStart:i,onDragOver:o,onDrop:c,isDragOver:a,isWonStage:h=!1}){const m=P.useRef(null),x=e.reduce((C,S)=>C+(S.expected_price||0),0),v=e.reduce((C,S)=>C+(S.expected_commission||0),0),w=C=>C>=1e6?`$${(C/1e6).toFixed(1)}M`:C>=1e3?`$${(C/1e3).toFixed(0)}K`:`$${C.toFixed(0)}`,k=t.icon&&uAe[t.icon]||Au;return r.jsxs("div",{ref:m,className:$t("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",a&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:C=>o(C,t.id),onDrop:C=>c(C,t.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:t.color,borderTopWidth:3},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}20`},children:r.jsx(k,{className:"h-4 w-4",style:{color:t.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:t.name})})]}),r.jsx(Ft,{variant:"secondary",className:"text-xs font-medium px-2",children:e.length})]}),x>0&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:w(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[w(v)," GCI"]})]})]}),r.jsx(_l,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[e.map(C=>r.jsx("div",{draggable:!0,onDragStart:S=>{S.dataTransfer.effectAllowed="move",i(C.id,t.id)},children:r.jsx(y$e,{deal:C,onClick:()=>n(C),isWonStage:h})},C.id)),e.length===0&&r.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[r.jsx("p",{className:"mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),r.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:r.jsxs(te,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(t.id),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function pHt({stats:t,isLoading:e}){const n=i=>i>=1e6?`$${(i/1e6).toFixed(1)}M`:i>=1e3?`$${(i/1e3).toFixed(0)}K`:`$${i.toLocaleString()}`,s=[{label:"Active Deals",value:(t==null?void 0:t.activeDeals)||0,icon:Rx,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((t==null?void 0:t.pipelineValue)||0),icon:nc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((t==null?void 0:t.expectedCommission)||0),icon:ad,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(t==null?void 0:t.wonDeals)||0,icon:qa,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return e?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(i=>r.jsx(Ze,{className:"animate-pulse",children:r.jsx(et,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},i))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(i=>r.jsx(Ze,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:$t("p-2 rounded-lg",i.bgColor),children:r.jsx(i.icon,{className:$t("h-5 w-5",i.color)})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:i.label}),r.jsx("p",{className:"text-xl font-bold",children:i.value})]})]})})},i.label))})}const mHt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],gHt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function xHt({open:t,onOpenChange:e,deal:n,defaultStageId:s}){const{data:i}=y0e(),{data:o}=vm(),{data:c}=lxe(),a=p$e(),h=m$e(),[m,x]=P.useState(""),[v,w]=P.useState(!1),k=(c==null?void 0:c.filter($=>((n==null?void 0:n.listing_id)===$.id,!0)))||[],[C,S]=P.useState({deal_name:"",deal_type:"buyer",stage_id:"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""});P.useEffect(()=>{var $,F,q;t&&(n?(S({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||"",contact_id:n.contact_id||"",listing_id:n.listing_id||"",property_address:n.property_address||"",city:n.city||"",state:n.state||"",zip_code:n.zip_code||"",expected_price:(($=n.expected_price)==null?void 0:$.toString())||"",commission_percentage:((F=n.commission_percentage)==null?void 0:F.toString())||"3",target_close_date:n.target_close_date?new Date(n.target_close_date):void 0,contract_date:n.contract_date?new Date(n.contract_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(S({deal_name:"",deal_type:"buyer",stage_id:s||((q=i==null?void 0:i[0])==null?void 0:q.id)||"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[t,n,s,i]);const T=o==null?void 0:o.filter($=>{var q,W,K;const F=m.toLowerCase();return((q=$.first_name)==null?void 0:q.toLowerCase().includes(F))||((W=$.last_name)==null?void 0:W.toLowerCase().includes(F))||((K=$.email)==null?void 0:K.toLowerCase().includes(F))}).slice(0,5),I=()=>{const $=parseFloat(C.expected_price)||0,F=parseFloat(C.commission_percentage)||0;return $*(F/100)},A=async $=>{var F,q;if($.preventDefault(),!C.deal_name.trim()){He.error("Please enter a deal name");return}try{const W={deal_name:C.deal_name,deal_type:C.deal_type,stage_id:C.stage_id||null,contact_id:C.contact_id||null,listing_id:C.listing_id||null,property_address:C.property_address||null,city:C.city||null,state:C.state||null,zip_code:C.zip_code||null,expected_price:C.expected_price?parseFloat(C.expected_price):null,expected_commission:I()||null,commission_percentage:C.commission_percentage?parseFloat(C.commission_percentage):3,target_close_date:((F=C.target_close_date)==null?void 0:F.toISOString().split("T")[0])||null,contract_date:((q=C.contract_date)==null?void 0:q.toISOString().split("T")[0])||null,priority:C.priority,probability:parseInt(C.probability)||50,notes:C.notes||null};n?(await h.mutateAsync({id:n.id,...W}),He.success("Deal updated successfully")):(await a.mutateAsync(W),He.success("Deal created successfully")),e(!1)}catch{He.error("Failed to save deal")}},D=a.isPending||h.isPending;return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(us,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:A,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Xe,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(xt,{id:"deal_name",value:C.deal_name,onChange:$=>S(F=>({...F,deal_name:$.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Deal Type"}),r.jsxs(_n,{value:C.deal_type,onValueChange:$=>S(F=>({...F,deal_type:$})),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:mHt.map($=>r.jsx(tr,{value:$.value,children:$.label},$.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Stage"}),r.jsxs(_n,{value:C.stage_id,onValueChange:$=>S(F=>({...F,stage_id:$})),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select stage"})}),r.jsx(vn,{children:i==null?void 0:i.map($=>r.jsx(tr,{value:$.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:$.color}}),$.name]})},$.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{value:m,onChange:$=>{x($.target.value),w(!0),$.target.value||S(F=>({...F,contact_id:""}))},onFocus:()=>w(!0),placeholder:"Search contacts...",className:"pl-9"}),v&&m&&T&&T.length>0&&r.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:T.map($=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{S(F=>({...F,contact_id:$.id})),x(`${$.first_name} ${$.last_name}`),w(!1)},children:[r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[$.first_name," ",$.last_name]}),$.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:$.email})]},$.id))})]})]}),k.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{className:"flex items-center gap-2",children:[r.jsx(Bf,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(_n,{value:C.listing_id,onValueChange:$=>{const F=k.find(q=>q.id===$);S(F?q=>{var W;return{...q,listing_id:$,deal_type:"seller",property_address:F.property_address||q.property_address,city:F.city||q.city,state:F.state||q.state,expected_price:((W=F.price)==null?void 0:W.toString())||q.expected_price}}:q=>({...q,listing_id:$}))},children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"",children:"None"}),k.map($=>r.jsx(tr,{value:$.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:$.property_address||`${$.city}, ${$.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",($.price/1e3).toFixed(0),"K"]})]})},$.id))]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Xe,{htmlFor:"property_address",children:"Address"}),r.jsx(xt,{id:"property_address",value:C.property_address,onChange:$=>S(F=>({...F,property_address:$.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"city",children:"City"}),r.jsx(xt,{id:"city",value:C.city,onChange:$=>S(F=>({...F,city:$.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"state",children:"State"}),r.jsx(xt,{id:"state",value:C.state,onChange:$=>S(F=>({...F,state:$.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(xt,{id:"zip_code",value:C.zip_code,onChange:$=>S(F=>({...F,zip_code:$.target.value}))})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Financial Details"}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"expected_price",children:"Expected Price"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(xt,{id:"expected_price",type:"number",value:C.expected_price,onChange:$=>S(F=>({...F,expected_price:$.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(xt,{id:"commission_percentage",type:"number",step:"0.1",value:C.commission_percentage,onChange:$=>S(F=>({...F,commission_percentage:$.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Expected GCI"}),r.jsx(xt,{value:I()?`$${I().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Target Close Date"}),r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!C.target_close_date&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),C.target_close_date?un(C.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(gh,{className:"w-auto p-0",align:"start",children:r.jsx(Lj,{mode:"single",selected:C.target_close_date,onSelect:$=>S(F=>({...F,target_close_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Contract Date"}),r.jsxs(Jh,{children:[r.jsx(ef,{asChild:!0,children:r.jsxs(te,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!C.contract_date&&"text-muted-foreground"),children:[r.jsx(li,{className:"mr-2 h-4 w-4"}),C.contract_date?un(C.contract_date,"PPP"):"Pick a date"]})}),r.jsx(gh,{className:"w-auto p-0",align:"start",children:r.jsx(Lj,{mode:"single",selected:C.contract_date,onSelect:$=>S(F=>({...F,contract_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Priority"}),r.jsxs(_n,{value:C.priority,onValueChange:$=>S(F=>({...F,priority:$})),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:gHt.map($=>r.jsx(tr,{value:$.value,children:$.label},$.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(xt,{type:"number",min:"0",max:"100",value:C.probability,onChange:$=>S(F=>({...F,probability:$.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"notes",children:"Notes"}),r.jsx(gs,{id:"notes",value:C.notes,onChange:$=>S(F=>({...F,notes:$.target.value})),placeholder:"Add any additional notes about this deal...",rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(te,{type:"submit",disabled:D,children:[D&&r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const yHt={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"}},vHt={note:vl,call:Ma,email:oi,meeting:li,stage_change:$s,task_completed:Ha,document:ui,system:Gi};function _Ht({deal:t,open:e,onOpenChange:n,onEdit:s,onAddToScorecard:i,isWonStage:o}){var ue,je;const{data:c,isLoading:a}=BVt((t==null?void 0:t.id)||""),{data:h,isLoading:m}=UVt((t==null?void 0:t.id)||""),x=$Vt(),v=VVt(),w=qVt(),k=zVt(),[C,S]=P.useState(""),[T,I]=P.useState(""),[A,D]=P.useState(!1);if(!t)return null;const $=yHt[t.deal_type],F=ne=>ne?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ne):"-",q=async()=>{if(C.trim())try{await x.mutateAsync({deal_id:t.id,activity_type:"note",title:"Note added",description:C}),S(""),He.success("Note added")}catch{He.error("Failed to add note")}},W=async()=>{if(T.trim())try{await v.mutateAsync({deal_id:t.id,title:T,sort_order:((h==null?void 0:h.length)||0)+1}),I(""),He.success("Task added")}catch{He.error("Failed to add task")}},K=async(ne,ye)=>{try{await w.mutateAsync({id:ne,is_completed:ye,deal_id:t.id})}catch{He.error("Failed to update task")}},Z=async()=>{try{await k.mutateAsync(t.id),He.success("Deal deleted"),n(!1)}catch{He.error("Failed to delete deal")}},re=(h==null?void 0:h.filter(ne=>ne.is_completed).length)||0,he=(h==null?void 0:h.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(qne,{open:e,onOpenChange:n,children:r.jsxs(uI,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(Vne,{className:"p-6 pb-4 border-b shrink-0",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{variant:"outline",className:$t("text-xs",$.color),children:$.label}),r.jsxs(Ft,{variant:"secondary",className:"text-xs capitalize",children:[t.priority," priority"]})]}),r.jsx(Hne,{className:"text-xl",children:t.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>s(t),children:r.jsx(Jl,{className:"h-4 w-4"})}),r.jsx(te,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>D(!0),children:r.jsx(es,{className:"h-4 w-4"})})]})]})}),r.jsx(_l,{className:"flex-1",children:r.jsxs("div",{className:"p-6 space-y-6",children:[t.contact&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Di,{className:"h-10 w-10",children:r.jsxs(Ri,{className:"bg-primary/10 text-primary",children:[(ue=t.contact.first_name)==null?void 0:ue[0],(je=t.contact.last_name)==null?void 0:je[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[t.contact.first_name," ",t.contact.last_name]}),t.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[t.contact.phone&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${t.contact.phone}`,children:r.jsx(Ma,{className:"h-4 w-4"})})}),t.contact.email&&r.jsx(te,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${t.contact.email}`,children:r.jsx(oi,{className:"h-4 w-4"})})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(t.property_address||t.city)&&r.jsxs("div",{className:"col-span-2 flex items-start gap-2 text-sm",children:[r.jsx(ui,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:t.property_address||"Address TBD"}),r.jsx("p",{className:"text-muted-foreground",children:[t.city,t.state,t.zip_code].filter(Boolean).join(", ")})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),r.jsx("p",{className:"text-lg font-bold",children:F(t.expected_price)})]}),r.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),r.jsx("p",{className:"text-lg font-bold text-emerald-600",children:F(t.expected_commission)})]}),o&&!t.scorecard_transaction_id&&i&&r.jsxs(te,{onClick:()=>i(t),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(qa,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),t.scorecard_transaction_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-lg p-3",children:[r.jsx(Ha,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),t.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",un(new Date(t.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(ad,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[t.probability,"% probability"]})]})]}),t.notes&&r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium mb-1",children:"Notes"}),r.jsx("p",{className:"text-muted-foreground",children:t.notes})]}),r.jsxs(Oa,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(Ta,{className:"w-full grid grid-cols-2",children:[r.jsxs(xn,{value:"tasks",className:"gap-1",children:[r.jsx(Ha,{className:"h-4 w-4"}),"Tasks ",he>0&&`(${re}/${he})`]}),r.jsxs(xn,{value:"activity",className:"gap-1",children:[r.jsx(Gi,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(Un,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{placeholder:"Add a new task...",value:T,onChange:ne=>I(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&W()}),r.jsx(te,{onClick:W,disabled:!T.trim(),children:r.jsx(Mn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[h==null?void 0:h.map(ne=>r.jsxs("div",{className:$t("flex items-center gap-3 p-3 rounded-lg border transition-colors",ne.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(vc,{checked:ne.is_completed,onCheckedChange:ye=>K(ne.id,!!ye)}),r.jsx("span",{className:$t("flex-1 text-sm",ne.is_completed&&"line-through text-muted-foreground"),children:ne.title}),ne.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:un(new Date(ne.due_date),"MMM d")})]},ne.id)),(h==null?void 0:h.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(Un,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(gs,{placeholder:"Add a note...",value:C,onChange:ne=>S(ne.target.value),rows:2}),r.jsxs(te,{onClick:q,disabled:!C.trim(),size:"sm",className:"w-full",children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[c==null?void 0:c.map(ne=>{const ye=vHt[ne.activity_type]||Gi;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:r.jsx(ye,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:ne.title}),ne.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:ne.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Qd(new Date(ne.created_at),{addSuffix:!0})})]})]},ne.id)}),(c==null?void 0:c.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),r.jsx(oh,{open:A,onOpenChange:D,children:r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Delete Deal?"}),r.jsxs(ju,{children:['This will permanently delete "',t.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function bHt({open:t,onOpenChange:e,deal:n,onComplete:s}){const i=fse(),o=m$e(),{data:c}=hse(),{data:a}=Ig(),[h,m]=P.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:un(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});P.useEffect(()=>{if(n&&t){const w=n.deal_type==="seller"?"seller":"buyer",k=n.expected_price||0,C=n.commission_percentage||3,S=n.expected_commission||k*C/100;m({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:w,close_date:n.actual_close_date||n.target_close_date||un(new Date,"yyyy-MM-dd"),sale_price:k,commission_amount:S,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,t]);const x=async w=>{if(w.preventDefault(),!!n)try{const k=await i.mutateAsync({property_address:h.property_address,city:h.city||null,state:h.state||null,zip:h.zip||null,transaction_type:h.transaction_type,close_date:h.close_date,sale_price:h.sale_price,commission_amount:h.commission_amount||null,lead_source_id:h.lead_source_id||null,client_type_id:h.client_type_id||null,contact_id:n.contact_id||null,notes:h.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:k.id,actual_close_date:h.close_date}),He.success("Deal added to Scorecard! 🎉"),e(!1),s==null||s()}catch(k){console.error("Error syncing to scorecard:",k),He.error("Failed to add to scorecard")}},v=w=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(w);return r.jsx(Ur,{open:t,onOpenChange:e,children:r.jsxs(Br,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{className:"space-y-3",children:[r.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20",children:r.jsx(qa,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(Zr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(us,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),r.jsxs("form",{onSubmit:x,className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(xt,{id:"property_address",value:h.property_address,onChange:w=>m(k=>({...k,property_address:w.target.value})),placeholder:"123 Main St",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"city",children:"City"}),r.jsx(xt,{id:"city",value:h.city,onChange:w=>m(k=>({...k,city:w.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"state",children:"State"}),r.jsx(xt,{id:"state",value:h.state,onChange:w=>m(k=>({...k,state:w.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"zip",children:"Zip"}),r.jsx(xt,{id:"zip",value:h.zip,onChange:w=>m(k=>({...k,zip:w.target.value})),placeholder:"75001"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Transaction Type *"}),r.jsxs(_n,{value:h.transaction_type,onValueChange:w=>m(k=>({...k,transaction_type:w})),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"buyer",children:"Buyer"}),r.jsx(tr,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(xt,{id:"close_date",type:"date",value:h.close_date,onChange:w=>m(k=>({...k,close_date:w.target.value})),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(ad,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(xt,{id:"sale_price",type:"number",value:h.sale_price||"",onChange:w=>m(k=>({...k,sale_price:Number(w.target.value)})),placeholder:"450000",required:!0,min:0}),h.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:v(h.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Xe,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(a4,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(xt,{id:"commission_amount",type:"number",value:h.commission_amount||"",onChange:w=>m(k=>({...k,commission_amount:Number(w.target.value)})),placeholder:"13500",min:0}),h.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:v(h.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Lead Source"}),r.jsxs(_n,{value:h.lead_source_id,onValueChange:w=>m(k=>({...k,lead_source_id:w})),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select source"})}),r.jsx(vn,{children:c==null?void 0:c.map(w=>r.jsx(tr,{value:w.id,children:w.name},w.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Client Type"}),r.jsxs(_n,{value:h.client_type_id,onValueChange:w=>m(k=>({...k,client_type_id:w})),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select type"})}),r.jsx(vn,{children:a==null?void 0:a.map(w=>r.jsx(tr,{value:w.id,children:w.name},w.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"notes",children:"Notes"}),r.jsx(gs,{id:"notes",value:h.notes,onChange:w=>m(k=>({...k,notes:w.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(ai,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(te,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Skip for now"}),r.jsx(te,{type:"submit",disabled:i.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:i.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(Ho,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const wHt={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"}},e3e={urgent:0,high:1,medium:2,low:3};function jHt({deals:t,stages:e,onDealClick:n,onStageChange:s}){const[i,o]=P.useState("target_close_date"),[c,a]=P.useState("asc"),h=k=>{i===k?a(C=>C==="asc"?"desc":"asc"):(o(k),a("asc"))},m=P.useMemo(()=>[...t].sort((k,C)=>{var T,I;let S=0;switch(i){case"deal_name":S=k.deal_name.localeCompare(C.deal_name);break;case"stage":{const A=((T=e.find($=>$.id===k.stage_id))==null?void 0:T.sort_order)||0,D=((I=e.find($=>$.id===C.stage_id))==null?void 0:I.sort_order)||0;S=A-D;break}case"expected_price":S=(k.expected_price||0)-(C.expected_price||0);break;case"expected_commission":S=(k.expected_commission||0)-(C.expected_commission||0);break;case"target_close_date":{const A=k.target_close_date?new Date(k.target_close_date).getTime():1/0,D=C.target_close_date?new Date(C.target_close_date).getTime():1/0;S=A-D;break}case"priority":S=e3e[k.priority]-e3e[C.priority];break}return c==="asc"?S:-S}),[t,e,i,c]),x=k=>k?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(k):"—",v=k=>k?e.find(C=>C.id===k):null,w=({field:k,children:C})=>r.jsxs(te,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>h(k),children:[C,i===k?c==="asc"?r.jsx(Ix,{className:"ml-2 h-4 w-4"}):r.jsx(Hw,{className:"ml-2 h-4 w-4"}):r.jsx(Ex,{className:"ml-2 h-4 w-4 opacity-50"})]});return t.length===0?r.jsx("div",{className:"text-center py-16",children:r.jsx("p",{className:"text-muted-foreground",children:"No deals to display"})}):r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{className:"bg-muted/50",children:[r.jsx(Mt,{className:"w-[250px]",children:r.jsx(w,{field:"deal_name",children:"Deal Name"})}),r.jsx(Mt,{className:"w-[150px]",children:r.jsx(w,{field:"stage",children:"Stage"})}),r.jsx(Mt,{className:"w-[100px]",children:"Type"}),r.jsx(Mt,{className:"w-[120px]",children:r.jsx(w,{field:"expected_price",children:"Price"})}),r.jsx(Mt,{className:"w-[120px]",children:r.jsx(w,{field:"expected_commission",children:"GCI"})}),r.jsx(Mt,{className:"w-[130px]",children:r.jsx(w,{field:"target_close_date",children:"Close Date"})}),r.jsx(Mt,{className:"w-[100px]",children:r.jsx(w,{field:"priority",children:"Priority"})})]})}),r.jsx(Vs,{children:m.map(k=>{v(k.stage_id);const C=wHt[k.deal_type],S=k.target_close_date?cC(new Date(k.target_close_date),new Date):null,T=S!==null&&S<0,I=S!==null&&S<=7&&S>=0;return r.jsxs(Er,{className:$t("cursor-pointer hover:bg-muted/50 transition-colors",T&&"bg-red-50/50"),onClick:()=>n(k),children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:k.deal_name}),k.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[k.contact.first_name," ",k.contact.last_name]})]})}),r.jsx(yt,{onClick:A=>A.stopPropagation(),children:r.jsx(x$e,{stages:e,currentStageId:k.stage_id||"",onStageSelect:(A,D)=>s(k.id,A,D)})}),r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",className:$t("text-xs",C.color),children:C.label})}),r.jsx(yt,{children:r.jsx("span",{className:"font-medium",children:x(k.expected_price)})}),r.jsx(yt,{children:r.jsx("span",{className:"text-emerald-600",children:x(k.expected_commission)})}),r.jsx(yt,{children:k.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-sm",T&&"text-red-600",I&&!T&&"text-amber-600"),children:[T&&r.jsx(Ul,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:un(new Date(k.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",className:$t("text-xs capitalize",k.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",k.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",k.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",k.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:k.priority})})]},k.id)})})]})})}function kHt(){var oe;const t=SI(),{data:e,isLoading:n}=y0e(),{data:s,isLoading:i,refetch:o}=f$e(),{data:c,isLoading:a}=HVt(),h=h$e(),m=FVt(),[x,v]=P.useState("board"),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(null),[A,D]=P.useState(null),[$,F]=P.useState(null),[q,W]=P.useState(null),[K,Z]=P.useState(!1),[re,he]=P.useState(null);P.useEffect(()=>{!n&&e&&e.length===0&&h.mutate()},[n,e]);const ue=ae=>{I(ae),S(!0)},je=ae=>{D(ae||null),I(null),k(!0)},ne=ae=>{I(ae),S(!1),k(!0)},ye=(ae,Ne)=>{F(ae)},ie=(ae,Ne)=>{ae.preventDefault(),ae.dataTransfer.dropEffect="move",W(Ne)},me=async(ae,Ne)=>{if(ae.preventDefault(),W(null),!$)return;const Te=s==null?void 0:s.find(Le=>Le.id===$),Be=e==null?void 0:e.find(Le=>Le.id===Ne);if(!Te||!Be||Te.stage_id===Ne){F(null);return}try{if(await m.mutateAsync({dealId:$,stageId:Ne,stageName:Be.name}),He.success(`Moved to ${Be.name}`),Be.is_won_stage&&!Te.scorecard_transaction_id){const Le={...Te,stage_id:Ne};he(Le),Z(!0)}}catch{He.error("Failed to move deal")}F(null)},fe=P.useCallback(async(ae,Ne,Te)=>{const Be=s==null?void 0:s.find(Qe=>Qe.id===ae),Le=e==null?void 0:e.find(Qe=>Qe.id===Ne);if(!(!Be||!Le||Be.stage_id===Ne))try{if(await m.mutateAsync({dealId:ae,stageId:Ne,stageName:Te}),He.success(`Moved to ${Te}`),Le.is_won_stage&&!Be.scorecard_transaction_id){const Qe={...Be,stage_id:Ne};he(Qe),Z(!0)}}catch{He.error("Failed to move deal")}},[s,e,m]),ve=ae=>(s==null?void 0:s.filter(Ne=>Ne.stage_id===ae))||[],Ie=n||i,Se=t?"list":x;return r.jsxs(Dr,{children:[r.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[r.jsxs("div",{className:"shrink-0 p-4 md:p-6 pb-0 space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Deal Pipeline"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Track and manage your active deals"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Fl,{className:"h-4 w-4"})}),!t&&r.jsx(sI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:r.jsxs(te,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>v("board"),className:"px-3 gap-1.5",children:[r.jsx(im,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(dm,{children:"Kanban board view"})]}),r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:r.jsxs(te,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>v("list"),className:"px-3 gap-1.5",children:[r.jsx($f,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(dm,{children:"Grouped list view"})]}),r.jsxs(mg,{children:[r.jsx(gg,{asChild:!0,children:r.jsxs(te,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>v("table"),className:"px-3 gap-1.5",children:[r.jsx(zT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(dm,{children:"Sortable table view"})]})]})}),r.jsxs(te,{onClick:()=>je(),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(pHt,{stats:c||null,isLoading:a})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ie?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(ae=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Kr,{className:"h-full rounded-xl"})},ae))}):Se==="board"?r.jsxs(_l,{className:"h-full -mx-4 md:-mx-6 px-4 md:px-6",children:[r.jsx("div",{className:"flex gap-4 h-full pb-4",children:e==null?void 0:e.map(ae=>r.jsx(fHt,{stage:ae,deals:ve(ae.id),onDealClick:ue,onAddDeal:je,onDragStart:ye,onDragOver:ie,onDrop:me,isDragOver:q===ae.id,isWonStage:ae.is_won_stage},ae.id))}),r.jsx(kge,{orientation:"horizontal"})]}):Se==="table"?r.jsx(_l,{className:"h-full",children:r.jsx(jHt,{deals:s||[],stages:e||[],onDealClick:ue,onStageChange:fe})}):r.jsx(_l,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[e==null?void 0:e.map(ae=>{const Ne=ve(ae.id);return Ne.length===0?null:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ae.color}}),r.jsx("h3",{className:"font-semibold",children:ae.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",Ne.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Ne.map(Te=>r.jsx(y$e,{deal:Te,onClick:()=>ue(Te),stages:e,onStageChange:fe,showStagePicker:!0,isWonStage:ae.is_won_stage},Te.id))})]},ae.id)}),(s==null?void 0:s.length)===0&&r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-muted rounded-full flex items-center justify-center",children:r.jsx(im,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),r.jsxs(te,{onClick:()=>je(),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(xHt,{open:w,onOpenChange:k,deal:T,defaultStageId:A}),r.jsx(_Ht,{deal:T,open:C,onOpenChange:S,onEdit:ne,isWonStage:T?(oe=e==null?void 0:e.find(ae=>ae.id===T.stage_id))==null?void 0:oe.is_won_stage:!1,onAddToScorecard:ae=>{he(ae),Z(!0),S(!1)}}),r.jsx(bHt,{open:K,onOpenChange:Z,deal:re,onComplete:()=>{o(),he(null)}})]})}const v$e=new Date().getFullYear(),NHt=Array.from({length:5},(t,e)=>v$e-e);function SHt(){const[t,e]=P.useState(v$e),n=ts(),{data:s,isLoading:i}=lft();return i?r.jsx(Dr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Kr,{className:"h-24"},o))}),r.jsx(Kr,{className:"h-96"})]})}):r.jsx(Dr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Scorecard Admin"}),r.jsx("p",{className:"text-muted-foreground",children:"View agent performance and scorecards"})]}),r.jsxs(_n,{value:String(t),onValueChange:o=>e(Number(o)),children:[r.jsx(yn,{className:"w-[120px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:NHt.map(o=>r.jsx(tr,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Agents Tracking"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(nc,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Agents with Scorecards"}),r.jsx(In,{children:"Click to view individual agent scorecards"})]}),r.jsx(et,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(nc,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:s.map(o=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:o.name}),r.jsx(yt,{className:"text-muted-foreground",children:o.email}),r.jsx(yt,{className:"text-right",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const _$e=new Date().getFullYear(),CHt=Array.from({length:10},(t,e)=>_$e-e);function MHt(){var w;const{userId:t}=hd(),e=ts(),[n,s]=P.useState(_$e),{data:i,isLoading:o}=rr({queryKey:["agent-profile",t],queryFn:async()=>{const{data:k,error:C}=await ee.from("profiles").select("id, name, email").eq("id",t).single();if(C)throw C;return k},enabled:!!t}),{data:c,isLoading:a}=cxe(n,t),{yearStats:h,lifetimeStats:m,showCommission:x}=p8e(n,t),{data:v}=f8e(n,t);return o?r.jsx(Dr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(k=>r.jsx(Kr,{className:"h-24"},k))})]})}):r.jsx(Dr,{title:`${i==null?void 0:i.name}'s Scorecard`,children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>e("/admin/scorecard"),children:r.jsx(Ga,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i==null?void 0:i.name}),r.jsx("p",{className:"text-muted-foreground",children:i==null?void 0:i.email})]})]}),r.jsxs(_n,{value:String(n),onValueChange:k=>s(Number(k)),children:[r.jsx(yn,{className:"w-[120px]",children:r.jsx(bn,{})}),r.jsx(vn,{children:CHt.map(k=>r.jsx(tr,{value:String(k),children:k},k))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ui,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:h.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[m.totalTransactions," lifetime"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[h.buyerCount,"/",h.sellerCount]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ad,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Nd(h.totalVolume,!0)})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Nd(h.averagePrice,!0)})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ml,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((w=h.topLeadSource)==null?void 0:w.name)||"-"})]})})]}),v&&r.jsx(vze,{goals:v,stats:h,year:n,showCommission:x}),r.jsxs(Oa,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"transactions",children:"Transactions"}),r.jsx(xn,{value:"charts",children:"Charts"})]}),r.jsx(Un,{value:"transactions",children:r.jsx(yze,{transactions:c||[],showCommission:x,isLoading:a})}),r.jsx(Un,{value:"charts",children:r.jsx(c$e,{stats:h,year:n})})]})]})})}function THt(){const t=Qr(),[e,n]=P.useState(""),[s,i]=P.useState("all");r6e();const{data:o,refetch:c}=rr({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:A}=await ee.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(A==null?void 0:A.enabled)??!1}}),{data:a,isLoading:h}=rr({queryKey:["admin-listings"],queryFn:async()=>{const{data:A,error:D}=await ee.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(D)throw D;return A}}),{data:m}=rr({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:A}=await ee.from("listings").select("id, is_approved, status"),{data:D}=await ee.from("listing_shares").select("id"),{data:$}=await ee.from("listing_views").select("id");return{total:(A==null?void 0:A.length)||0,pending:(A==null?void 0:A.filter(F=>!F.is_approved).length)||0,active:(A==null?void 0:A.filter(F=>F.status==="active").length)||0,totalShares:(D==null?void 0:D.length)||0,totalViews:($==null?void 0:$.length)||0}}}),x=dr({mutationFn:async({id:A,approved:D})=>{const{error:$}=await ee.from("listings").update({is_approved:D}).eq("id",A);if($)throw $},onSuccess:(A,{approved:D})=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),He.success(D?"Listing approved":"Listing unapproved")}}),v=dr({mutationFn:async({id:A,featured:D})=>{const{error:$}=await ee.from("listings").update({is_featured:D}).eq("id",A);if($)throw $},onSuccess:(A,{featured:D})=>{t.invalidateQueries({queryKey:["admin-listings"]}),He.success(D?"Listing featured":"Listing unfeatured")}}),w=dr({mutationFn:async A=>{const{error:D}=await ee.from("listings").delete().eq("id",A);if(D)throw D},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),He.success("Listing deleted")}}),k=dr({mutationFn:async A=>{const{error:D}=await ee.from("feature_flags").update({enabled:A}).eq("key","listing_exchange_enabled");if(D)throw D},onSuccess:()=>{c(),He.success("Feature flag updated")}}),C=o??!1,S=a==null?void 0:a.filter(A=>{var F,q,W,K;const D=((F=A.city)==null?void 0:F.toLowerCase().includes(e.toLowerCase()))||((W=(q=A.agent)==null?void 0:q.name)==null?void 0:W.toLowerCase().includes(e.toLowerCase()))||((K=A.property_address)==null?void 0:K.toLowerCase().includes(e.toLowerCase())),$=s==="all"||s==="pending"&&!A.is_approved||s==="approved"&&A.is_approved;return D&&$}),T=A=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(A),I=A=>{const D={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 D[A]||D.active};return r.jsx(Dr,{title:"Listing Exchange Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage community listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Feature visible to agents"}),r.jsx(Js,{checked:C,onCheckedChange:A=>k.mutate(A)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Listings"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.total)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qf,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.active)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-4 w-4 text-amber-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Review"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.pending)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Al,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Views"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.totalViews)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xd,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Shares"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.totalShares)||0})]})})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by city, address, or agent...",value:e,onChange:A=>n(A.target.value),className:"pl-9"})]}),r.jsx(Oa,{value:s,onValueChange:A=>i(A),children:r.jsxs(Ta,{children:[r.jsx(xn,{value:"all",children:"All"}),r.jsx(xn,{value:"pending",children:"Pending"}),r.jsx(xn,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{children:["Listings (",(S==null?void 0:S.length)||0,")"]})}),r.jsx(et,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Property"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Price"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-center",children:"Approved"}),r.jsx(Mt,{className:"text-center",children:"Featured"}),r.jsx(Mt,{children:"Views"}),r.jsx(Mt,{children:"Shares"}),r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{})]})}),r.jsx(Vs,{children:h?r.jsx(Er,{children:r.jsx(yt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(S==null?void 0:S.length)===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):S==null?void 0:S.map(A=>{var D,$,F,q,W;return r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[($=(D=A.photos)==null?void 0:D[0])!=null&&$.photo_url?r.jsx("img",{src:A.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(na,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:A.property_address||`${A.city}, ${A.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(F=A.property_type)==null?void 0:F.replace("_"," ")})]})]})}),r.jsx(yt,{children:r.jsx("p",{className:"text-sm",children:((q=A.agent)==null?void 0:q.name)||"Unknown"})}),r.jsx(yt,{className:"font-medium",children:T(A.price)}),r.jsx(yt,{children:r.jsx(Ft,{variant:"outline",className:I(A.status),children:(W=A.status)==null?void 0:W.replace("_"," ")})}),r.jsx(yt,{className:"text-center",children:r.jsx(Js,{checked:A.is_approved??!1,onCheckedChange:K=>x.mutate({id:A.id,approved:K})})}),r.jsx(yt,{className:"text-center",children:r.jsx(Js,{checked:A.is_featured??!1,onCheckedChange:K=>v.mutate({id:A.id,featured:K})})}),r.jsx(yt,{children:A.view_count||0}),r.jsx(yt,{children:A.share_count||0}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:un(new Date(A.created_at),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsxs(xm,{children:[r.jsx(ym,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",children:r.jsx(Jm,{className:"h-4 w-4"})})}),r.jsxs(ep,{align:"end",children:[r.jsxs(co,{onClick:()=>window.open(`/mission-control/listings/${A.id}`,"_blank"),children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(co,{onClick:()=>v.mutate({id:A.id,featured:!A.is_featured}),children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),A.is_featured?"Unfeature":"Feature"]}),r.jsxs(co,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&w.mutate(A.id)},children:[r.jsx(Es,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},A.id)})})]})})})]})]})})}const AHt=()=>{var v,w;const[t,e]=P.useState(""),[n,s]=P.useState(null),{data:i,isLoading:o}=rr({queryKey:["membership-reviews"],queryFn:async()=>{const{data:k,error:C}=await ee.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(C)throw C;const S=(k==null?void 0:k.map(A=>A.user_id))||[],{data:T}=await ee.from("profiles").select("id, name, email").in("id",S);return k==null?void 0:k.map(A=>({...A,profiles:(T==null?void 0:T.find(D=>D.id===A.user_id))||null}))}}),c=i==null?void 0:i.filter(k=>{var S,T,I,A,D;const C=t.toLowerCase();return((T=(S=k.profiles)==null?void 0:S.name)==null?void 0:T.toLowerCase().includes(C))||((A=(I=k.profiles)==null?void 0:I.email)==null?void 0:A.toLowerCase().includes(C))||((D=k.review_text)==null?void 0:D.toLowerCase().includes(C))}),a=i!=null&&i.length?(i.reduce((k,C)=>k+C.rating,0)/i.length).toFixed(1):"0.0",h=i==null?void 0:i.reduce((k,C)=>(k[C.rating]=(k[C.rating]||0)+1,k),{}),m=(i==null?void 0:i.filter(k=>k.posted_to_google).length)||0,x=k=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(C=>r.jsx(Bs,{className:$t("h-4 w-4",k>=C?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},C))});return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Membership Reviews",description:"View and manage feedback from LevelUp members"}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(In,{children:"Total Reviews"}),r.jsx(Xt,{className:"text-3xl",children:(i==null?void 0:i.length)||0})]})}),r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(In,{children:"Average Rating"}),r.jsxs(Xt,{className:"flex items-center gap-2 text-3xl",children:[a,r.jsx(Bs,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(In,{children:"5-Star Reviews"}),r.jsx(Xt,{className:"text-3xl",children:(h==null?void 0:h[5])||0})]})}),r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(In,{children:"Posted to Google"}),r.jsxs(Xt,{className:"flex items-center gap-2 text-3xl",children:[m,r.jsx($s,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name, email, or review...",value:t,onChange:k=>e(k.target.value),className:"pl-9"})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Member"}),r.jsx(Mt,{children:"Rating"}),r.jsx(Mt,{className:"hidden md:table-cell",children:"Review"}),r.jsx(Mt,{children:"Google"}),r.jsx(Mt,{children:"Date"})]})}),r.jsx(Vs,{children:o?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(c==null?void 0:c.length)===0?r.jsx(Er,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):c==null?void 0:c.map(k=>{var C,S;return r.jsxs(Er,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(k),children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((C=k.profiles)==null?void 0:C.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(S=k.profiles)==null?void 0:S.email})]})}),r.jsx(yt,{children:x(k.rating)}),r.jsx(yt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:k.review_text||"-"})}),r.jsx(yt,{children:k.posted_to_google?r.jsx(Ft,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Ft,{variant:"outline",children:"No"})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:un(new Date(k.created_at),"MMM d, yyyy")})]},k.id)})})]})})}),r.jsx(Ur,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:"Review Details"})}),n&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:((v=n.profiles)==null?void 0:v.name)||"Unknown Member"}),((w=n.profiles)==null?void 0:w.email)&&r.jsxs("a",{href:`mailto:${n.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[r.jsx(oi,{className:"h-3 w-3"}),n.profiles.email]})]}),r.jsxs("div",{className:"text-right",children:[x(n.rating),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[n.rating," out of 5 stars"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Review"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:n.review_text||"No written review provided."})]}),r.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(li,{className:"h-4 w-4"}),un(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Ft,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx($s,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Ft,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},EHt=[{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"}],IHt=Array.from({length:24},(t,e)=>({value:String(e),label:e===0?"12:00 AM":e<12?`${e}:00 AM`:e===12?"12:00 PM":`${e-12}:00 PM`}));function PHt(){const t=Qr(),{user:e}=zr(),[n,s]=P.useState(!1),[i,o]=P.useState(!1),[c,a]=P.useState(!1),{data:h,isLoading:m}=rr({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("weekly_digest_settings").select("*").single();if(Z)throw Z;return K}}),{data:x,isLoading:v}=rr({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:K,error:Z}=await ee.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(Z)throw Z;return K}}),{data:w}=rr({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:K,error:Z}=await ee.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(Z)throw Z;return K||0}}),{data:k,refetch:C}=rr({queryKey:["digest-queue-status"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[Z,re,he,ue]=await Promise.all([ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",K.toISOString()),ee.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",K.toISOString())]);return{pending:Z.count||0,processing:re.count||0,sent:he.count||0,failed:ue.count||0,total:(Z.count||0)+(re.count||0)+(he.count||0)+(ue.count||0)}},refetchInterval:5e3});P.useEffect(()=>{if(k&&(k.pending>0||k.processing>0)){const K=setInterval(()=>{C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(K)}},[k,C,t]);const{data:S=0}=rr({queryKey:["digest-today-failed-count"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const{count:Z,error:re}=await ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString());if(re)throw re;return Z||0}}),T=dr({mutationFn:async K=>{const{error:Z}=await ee.from("weekly_digest_settings").update(K).eq("id",h==null?void 0:h.id);if(Z)throw Z},onSuccess:()=>{t.invalidateQueries({queryKey:["weekly-digest-settings"]}),He.success("Settings updated")},onError:K=>{He.error("Failed to update settings: "+K.message)}}),I=async()=>{s(!0);try{const{data:K,error:Z}=await ee.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(Z)throw Z;K.queued?He.success(`${K.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):K.sent!==void 0&&He.success(`Digest sent! ${K.sent} emails delivered, ${K.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(K){He.error("Failed to send digest: "+K.message)}finally{s(!1)}},A=async()=>{var K,Z,re,he,ue,je;if(!(e!=null&&e.email)){He.error("No email found for your account");return}o(!0);try{const{data:ne,error:ye}=await ee.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:e.email}});if(ye)throw ye;const ie=ne==null?void 0:ne.resendId,me=ne==null?void 0:ne.resendDetails,fe=me==null?void 0:me.status,ve=((K=me==null?void 0:me.body)==null?void 0:K.status)||((re=(Z=me==null?void 0:me.body)==null?void 0:Z.data)==null?void 0:re.status),Ie=((ue=(he=me==null?void 0:me.body)==null?void 0:he.error)==null?void 0:ue.message)||((je=me==null?void 0:me.body)==null?void 0:je.message);He.success(ie?`Preview accepted by email provider (id: ${ie})${fe?`, status check: ${fe}`:""}${ve?`, provider: ${ve}`:""}${Ie?` (${Ie})`:""}. 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){He.error("Failed to send preview: "+ne.message)}finally{o(!1)}},D=async()=>{a(!0);try{const{data:K,error:Z}=await ee.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(Z)throw Z;K.queued===0||K.sent===0&&K.failed===0&&!K.queued?He.info("No failed emails to retry"):K.queued?He.success(`${K.queued} emails queued for retry!`):He.success(`Retry complete! ${K.sent} emails delivered, ${K.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(K){He.error("Failed to retry: "+K.message)}finally{a(!1)}},$=k!=null&&k.total?Math.round((k.sent+k.failed)/k.total*100):0,F=((k==null?void 0:k.pending)||0)>0||((k==null?void 0:k.processing)||0)>0,{data:q}=rr({queryKey:["digest-delivery-stats"],queryFn:async()=>{var je,ne;const K=new Date;K.setUTCHours(0,0,0,0);const[Z,re,he,ue]=await Promise.all([ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",K.toISOString()),ee.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:Z.count||0,totalFailed:re.count||0,agentOsEngaged:he.count||0,lastSent:((ne=(je=ue.data)==null?void 0:je[0])==null?void 0:ne.sent_at)||null}},refetchInterval:F?5e3:!1}),W={totalSent:(q==null?void 0:q.totalSent)||0,totalFailed:(q==null?void 0:q.totalFailed)||0,lastSent:q==null?void 0:q.lastSent,agentOsEngaged:(q==null?void 0:q.agentOsEngaged)||0};return m?r.jsx(Dr,{title:"Weekly Digest",description:"Manage automated weekly email digests",children:r.jsxs("div",{className:"animate-pulse space-y-4",children:[r.jsx("div",{className:"h-32 bg-muted rounded-lg"}),r.jsx("div",{className:"h-64 bg-muted rounded-lg"})]})}):r.jsx(Dr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(Oa,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(Ta,{children:[r.jsxs(xn,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(od,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(xn,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(nc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Un,{value:"settings",className:"space-y-6",children:[F&&k&&r.jsx(Ze,{className:"border-primary/50 bg-primary/5",children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(sn,{className:"h-5 w-5 animate-spin text-primary"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:"Sending emails..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[k.sent.toLocaleString()," sent, ",k.pending.toLocaleString()," pending",k.failed>0&&`, ${k.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[$,"%"]})]}),r.jsx(Bc,{value:$,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Processing ~80 emails per minute. Estimated time remaining: ~",Math.ceil(k.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(fs,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:w}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:r.jsx(Ha,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:W.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(Oc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:W.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Gi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:W.lastSent?un(new Date(W.lastSent),"MMM d"):"Never"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Gi,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(In,{children:"Configure when the digest is sent"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Js,{checked:h==null?void 0:h.is_enabled,onCheckedChange:K=>T.mutate({is_enabled:K})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Cron Frequency"}),r.jsxs(_n,{value:(h==null?void 0:h.cron_frequency)||"daily",onValueChange:K=>T.mutate({cron_frequency:K}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(tr,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Day of Week"}),r.jsxs(_n,{value:String(h==null?void 0:h.send_day),onValueChange:K=>T.mutate({send_day:parseInt(K)}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:EHt.map(K=>r.jsx(tr,{value:K.value,children:K.label},K.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Time (UTC)"}),r.jsxs(_n,{value:String(h==null?void 0:h.send_hour),onValueChange:K=>T.mutate({send_hour:parseInt(K)}),disabled:(h==null?void 0:h.cron_frequency)==="daily",children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:IHt.map(K=>r.jsx(tr,{value:K.value,children:K.label},K.value))})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(te,{onClick:A,disabled:i,variant:"outline",className:"flex-1",children:[r.jsx(Al,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Preview to Me"]}),r.jsxs(te,{onClick:I,disabled:n,className:"flex-1",children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),S>0&&r.jsxs(te,{onClick:D,disabled:c,variant:"outline",className:"w-full",children:[r.jsx(Fl,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),c?"Retrying...":`Retry ${S} Failed`]})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(Si,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(In,{children:"Choose what to include in the digest"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Xe,{children:"New Resources"})]}),r.jsx(Js,{checked:h==null?void 0:h.include_new_resources,onCheckedChange:K=>T.mutate({include_new_resources:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Xe,{children:"Community Highlights"})]}),r.jsx(Js,{checked:h==null?void 0:h.include_community_posts,onCheckedChange:K=>T.mutate({include_community_posts:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Xe,{children:"Agent OS Stats"})]}),r.jsx(Js,{checked:h==null?void 0:h.include_agent_os_stats,onCheckedChange:K=>T.mutate({include_agent_os_stats:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(li,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Xe,{children:"Upcoming Events"})]}),r.jsx(Js,{checked:h==null?void 0:h.include_upcoming_events,onCheckedChange:K=>T.mutate({include_upcoming_events:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Xe,{children:"Goals Progress"})]}),r.jsx(Js,{checked:h==null?void 0:h.include_goals_progress,onCheckedChange:K=>T.mutate({include_goals_progress:K})})]})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Custom Introduction"}),r.jsx(In,{children:"Personalize the intro message (optional)"})]}),r.jsx(et,{children:r.jsx(gs,{placeholder:"Here's what's new this week to help you grow your business...",value:(h==null?void 0:h.custom_intro_text)||"",onChange:K=>T.mutate({custom_intro_text:K.target.value||null}),rows:3})})]})]}),r.jsx(Un,{value:"stats",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(oi,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(In,{children:"Recent digest emails sent to members"})]}),r.jsx(et,{children:v?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(K=>r.jsx("div",{className:"h-12 bg-muted rounded"},K))}):x&&x.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Sent At"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Resources"}),r.jsx(Mt,{children:"Agent OS"})]})}),r.jsx(Vs,{children:x.map(K=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:K.email_sent_to}),r.jsx(yt,{children:un(new Date(K.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(yt,{children:r.jsx(Ft,{variant:K.delivery_status==="sent"?"default":"destructive",children:K.delivery_status})}),r.jsx(yt,{children:K.resources_count}),r.jsx(yt,{children:K.has_agent_os_activity?r.jsx(Ft,{variant:"secondary",children:"Active"}):r.jsx(Ft,{variant:"outline",children:"Not Started"})})]},K.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(oi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No digests sent yet"}),r.jsx("p",{className:"text-sm",children:"Send your first digest to see delivery stats"})]})})]})})]})})}const LHt={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 OHt(){var oe,ae,Ne;const t=Qr(),[e,n]=P.useState(""),[s,i]=P.useState(null),[o,c]=P.useState(!1),[a,h]=P.useState(!1),[m,x]=P.useState(""),[v,w]=P.useState(""),[k,C]=P.useState(!0),[S,T]=P.useState(!1),[I,A]=P.useState(""),[D,$]=P.useState(null),{data:F,isLoading:q}=rr({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Te,error:Be}=await ee.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Be)throw Be;const Le=(Te==null?void 0:Te.map(Ce=>Ce.user_id))||[],{data:Qe}=await ee.from("profiles").select("id, name, email").in("id",Le),Fe=new Map((Qe==null?void 0:Qe.map(Ce=>[Ce.id,{name:Ce.name,email:Ce.email}]))||[]);return Te==null?void 0:Te.map(Ce=>({...Ce,profile:Fe.get(Ce.user_id)||null}))}}),{data:W}=rr({queryKey:["all-profiles-for-points",F],queryFn:async()=>{const{data:Te,error:Be}=await ee.from("profiles").select("id, name, email").order("name");if(Be)throw Be;return Te}}),Z=((W==null?void 0:W.filter(Te=>!(F!=null&&F.some(Be=>Be.user_id===Te.id))))||[]).filter(Te=>{var Le,Qe;if(!I)return!0;const Be=I.toLowerCase();return((Le=Te.name)==null?void 0:Le.toLowerCase().includes(Be))||((Qe=Te.email)==null?void 0:Qe.toLowerCase().includes(Be))}),{data:re,isLoading:he}=rr({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Te,error:Be}=await ee.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Be)throw Be;return Te},enabled:!!(s!=null&&s.user_id)&&a}),{data:ue}=rr({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Te,error:Be}=await ee.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Be)throw Be;return Te},enabled:!!(s!=null&&s.user_id)}),je=dr({mutationFn:async({userId:Te,points:Be,reason:Le})=>{const{error:Qe}=await ee.from("agent_points").insert({user_id:Te,points:Be,reason:Le});if(Qe)throw Qe;const{data:Fe}=await ee.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Te).maybeSingle(),Ce=((Fe==null?void 0:Fe.total_points)||0)+Be,Je=((Fe==null?void 0:Fe.spendable_points)||0)+Be,{error:Ae}=await ee.from("agent_attendance_stats").upsert({user_id:Te,total_points:Math.max(0,Ce),spendable_points:Math.max(0,Je),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Ae)throw Ae},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-agent-points"]}),t.invalidateQueries({queryKey:["agent-point-history"]}),c(!1),x(""),w(""),He.success(k?"Points awarded successfully!":"Points deducted successfully!")},onError:Te=>{console.error("Error modifying points:",Te),He.error("Failed to modify points")}}),ne=()=>{if(!s||!m||!v){He.error("Please fill in all fields");return}const Te=parseInt(m);if(isNaN(Te)||Te<=0){He.error("Please enter a valid positive number");return}je.mutate({userId:s.user_id,points:k?Te:-Te,reason:v})},ye=()=>{if(!D||!m||!v){He.error("Please fill in all fields");return}const Te=parseInt(m);if(isNaN(Te)||Te<=0){He.error("Please enter a valid positive number");return}je.mutate({userId:D.id,points:Te,reason:v},{onSuccess:()=>{T(!1),$(null),A("")}})},ie=(Te,Be)=>{i(Te),C(Be),c(!0)},me=Te=>{i(Te),h(!0)},fe=F==null?void 0:F.filter(Te=>{var Fe,Ce,Je,Ae;const Be=((Ce=(Fe=Te.profile)==null?void 0:Fe.name)==null?void 0:Ce.toLowerCase())||"",Le=((Ae=(Je=Te.profile)==null?void 0:Je.email)==null?void 0:Ae.toLowerCase())||"",Qe=e.toLowerCase();return Be.includes(Qe)||Le.includes(Qe)}),ve=(F==null?void 0:F.reduce((Te,Be)=>Te+Be.total_points,0))||0,Ie=(F==null?void 0:F.length)||0,Se=Ie>0?Math.round(ve/Ie):0;return q?r.jsx(Dr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Te=>r.jsx(Kr,{className:"h-24"},Te))}),r.jsx(Kr,{className:"h-96"})]})}):r.jsx(Dr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Agent Points Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Track, view, and manage agent gamification points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ie}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:ve.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Se}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search agents...",value:e,onChange:Te=>n(Te.target.value),className:"pl-10"})]}),r.jsxs(te,{onClick:()=>T(!0),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{children:"Agent Leaderboard"}),r.jsx(In,{children:"All agents with their points, events, and streaks"})]}),r.jsx(et,{children:!fe||fe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(qa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{className:"w-12",children:"#"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{className:"text-center",children:"Total Points"}),r.jsx(Mt,{className:"text-center",children:"Spendable"}),r.jsx(Mt,{className:"text-center",children:"Events"}),r.jsx(Mt,{className:"text-center",children:"Streak"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:fe.map((Te,Be)=>{var Le,Qe,Fe,Ce;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:Be<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Be===0?"bg-yellow-100 text-yellow-700":Be===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Be+1}):r.jsx("span",{className:"text-muted-foreground",children:Be+1})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{children:((Qe=(Le=Te.profile)==null?void 0:Le.name)==null?void 0:Qe.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Fe=Te.profile)==null?void 0:Fe.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(Ce=Te.profile)==null?void 0:Ce.email})]})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1"}),Te.total_points]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Ft,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Ua,{className:"h-3 w-3 mr-1"}),Te.spendable_points||0]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(li,{className:"h-3 w-3 text-muted-foreground"}),Te.total_events_attended]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(qh,{className:"h-3 w-3 text-orange-500"}),Te.current_streak]})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>ie(Te,!0),title:"Award points",children:r.jsx(Mn,{className:"h-4 w-4 text-green-600"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>ie(Te,!1),title:"Deduct points",children:r.jsx(s1,{className:"h-4 w-4 text-red-600"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>me(Te),title:"View history",children:r.jsx(ZS,{className:"h-4 w-4"})})]})})]},Te.user_id)})})]})})]}),r.jsx(Ur,{open:o,onOpenChange:c,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:k?"Award Points":"Deduct Points"}),r.jsxs(us,{children:[k?"Award":"Deduct"," points ",k?"to":"from"," ",((oe=s==null?void 0:s.profile)==null?void 0:oe.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"points",children:"Points Amount"}),r.jsx(xt,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Te=>x(Te.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"reason",children:"Reason"}),r.jsx(gs,{id:"reason",placeholder:"Enter reason for this adjustment...",value:v,onChange:Te=>w(Te.target.value)})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),r.jsx(te,{onClick:ne,disabled:je.isPending,className:k?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:je.isPending?"Saving...":k?"Award Points":"Deduct Points"})]})]})}),r.jsx(Ur,{open:a,onOpenChange:h,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{children:["Point History: ",(ae=s==null?void 0:s.profile)==null?void 0:ae.name]}),r.jsx(us,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(Oa,{defaultValue:"history",className:"w-full",children:[r.jsxs(Ta,{className:"grid w-full grid-cols-2",children:[r.jsx(xn,{value:"history",children:"Point History"}),r.jsx(xn,{value:"badges",children:"Badges"})]}),r.jsx(Un,{value:"history",className:"mt-4",children:he?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Te=>r.jsx(Kr,{className:"h-12"},Te))}):!re||re.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ZS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No point history yet"})]}):r.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:re.map(Te=>r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:Te.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:un(new Date(Te.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Ft,{variant:Te.points>=0?"default":"destructive",className:Te.points>=0?"bg-green-100 text-green-800":"",children:[Te.points>=0?"+":"",Te.points]})]},Te.id))})}),r.jsx(Un,{value:"badges",className:"mt-4",children:!ue||ue.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ml,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No badges earned yet"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:ue.map(Te=>r.jsxs("div",{className:`p-3 rounded-lg ${LHt[Te.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ml,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Te.badge_name})]}),Te.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Te.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",un(new Date(Te.earned_at),"MMM d, yyyy")]})]},Te.id))})})]})]})}),r.jsx(Ur,{open:S,onOpenChange:Te=>{T(Te),Te||($(null),A(""),x(""),w(""))},children:r.jsxs(Br,{className:"max-w-md",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Award Points to New Agent"}),r.jsx(us,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:D?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Di,{className:"h-10 w-10",children:r.jsx(Ri,{children:((Ne=D.name)==null?void 0:Ne.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:D.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:D.email})]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>$(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(xt,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Te=>x(Te.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"new-reason",children:"Reason"}),r.jsx(gs,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:v,onChange:Te=>w(Te.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(Ei,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(xt,{placeholder:"Search by name or email...",value:I,onChange:Te=>A(Te.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:Z.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(fs,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:I?"No matching agents found":"All agents already have points"})]}):Z.slice(0,20).map(Te=>{var Be;return r.jsxs("button",{onClick:()=>$(Te),className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors border-b last:border-b-0 text-left",children:[r.jsx(Di,{className:"h-8 w-8",children:r.jsx(Ri,{children:((Be=Te.name)==null?void 0:Be.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Te.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Te.email})]})]},Te.id)})})]})}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),D&&r.jsxs(te,{onClick:ye,disabled:je.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}const A4={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"},v0e={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 _0e(t=!0){return rr({queryKey:["marketplace-categories",t],queryFn:async()=>{let e=ee.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});t&&(e=e.eq("is_active",!0));const{data:n,error:s}=await e;if(s)throw s;return n}})}function DHt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),He.success("Category created successfully")},onError:e=>{He.error("Failed to create category: "+e.message)}})}function RHt(){const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("marketplace_categories").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),He.success("Category updated successfully")},onError:e=>{He.error("Failed to update category: "+e.message)}})}function FHt(){const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("marketplace_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),He.success("Category deleted successfully")},onError:e=>{He.error("Failed to delete category: "+e.message)}})}function b$e(t,e=!0){return rr({queryKey:["marketplace-products",t,e],queryFn:async()=>{let n=ee.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});t&&(n=n.eq("category_id",t)),e&&(n=n.eq("is_active",!0));const{data:s,error:i}=await n;if(i)throw i;return s}})}function zHt(t){return rr({queryKey:["marketplace-product",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function BHt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_products").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),He.success("Product created successfully")},onError:e=>{He.error("Failed to create product: "+e.message)}})}function $Ht(){const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("marketplace_products").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.id]}),He.success("Product updated successfully")},onError:e=>{He.error("Failed to update product: "+e.message)}})}function UHt(){const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("marketplace_products").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),He.success("Product deleted successfully")},onError:e=>{He.error("Failed to delete product: "+e.message)}})}function qHt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_product_images").insert([e]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.product_id]})}})}function VHt(){const t=Qr();return dr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await ee.from("marketplace_product_images").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),He.success("Image deleted successfully")},onError:e=>{He.error("Failed to delete image: "+e.message)}})}function HHt(){const t=Qr();return dr({mutationFn:async({imageId:e,productId:n})=>{const{error:s}=await ee.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:i}=await ee.from("marketplace_product_images").update({is_primary:!0}).eq("id",e);if(i)throw i;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),He.success("Primary image updated")},onError:e=>{He.error("Failed to set primary image: "+e.message)}})}function WHt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("marketplace_product_variants").insert([e]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.product_id]}),He.success("Variant added successfully")}})}function GHt(){const t=Qr();return dr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await ee.from("marketplace_product_variants").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),He.success("Variant deleted successfully")}})}function KHt(){const t=Qr();return dr({mutationFn:async({productId:e,videoUrl:n})=>{await ee.from("marketplace_product_videos").delete().eq("product_id",e);const{data:s,error:i}=await ee.from("marketplace_product_videos").insert({product_id:e,video_url:n}).select().single();if(i)throw i;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.productId]}),He.success("Video updated successfully")}})}function ZHt(t){const{isAdmin:e}=zr();return rr({queryKey:["marketplace-orders",t,e],queryFn:async()=>{let n=ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:i}=await n;if(i)throw i;if(e&&s){const o=[...new Set(s.map(h=>h.user_id))],{data:c}=await ee.from("profiles").select("id, name, email").in("id",o),a=new Map((c==null?void 0:c.map(h=>[h.id,h]))||[]);return s.map(h=>({...h,user:a.get(h.user_id)}))}return s}})}function YHt(){const{user:t}=zr();return rr({queryKey:["my-marketplace-orders",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function XHt(t){return rr({queryKey:["marketplace-order",t],queryFn:async()=>{const{data:e,error:n}=await ee.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function QHt(){const t=Qr(),{user:e}=zr();return dr({mutationFn:async({orderId:n,status:s,notes:i,trackingNumber:o,trackingUrl:c,previousStatus:a})=>{const h={status:s};o!==void 0&&(h.tracking_number=o),c!==void 0&&(h.tracking_url=c);const{error:m}=await ee.from("marketplace_orders").update(h).eq("id",n);if(m)throw m;const{error:x}=await ee.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:i,created_by:e==null?void 0:e.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==a)try{await ee.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:c}})}catch(w){console.error("Failed to send notification email:",w)}},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),He.success("Order status updated")},onError:n=>{He.error("Failed to update order: "+n.message)}})}function JHt(){const t=Qr();return dr({mutationFn:async({itemId:e,proofUrl:n,proofNotes:s,orderId:i})=>{const{error:o}=await ee.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",e);if(o)throw o;await ee.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",i);try{await ee.functions.invoke("marketplace-order-notify",{body:{orderId:i,notificationType:"proof_ready"}})}catch(c){console.error("Failed to send proof notification:",c)}return i},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),He.success("Proof uploaded & customer notified")}})}function eWt(){const t=Qr();return dr({mutationFn:async({itemId:e,orderId:n})=>{const{error:s}=await ee.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),He.success("Proof approved")}})}function tWt(){const t=Qr();return dr({mutationFn:async({itemId:e,orderId:n,reason:s})=>{const{error:i}=await ee.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",e);if(i)throw i;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),He.success("Proof rejected - please upload a new proof")}})}function rWt(){const{data:t,isLoading:e}=_0e(!1),n=DHt(),s=RHt(),i=FHt(),[o,c]=P.useState(!1),[a,h]=P.useState(null),[m,x]=P.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),v=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),h(null)},w=S=>{h(S),x({name:S.name,description:S.description||"",image_url:S.image_url||"",sort_order:S.sort_order,is_active:S.is_active}),c(!0)},k=async S=>{S.preventDefault(),a?await s.mutateAsync({id:a.id,...m}):await n.mutateAsync(m),c(!1),v()},C=async S=>{confirm("Are you sure you want to delete this category?")&&await i.mutateAsync(S)};return e?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Kr,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(S=>r.jsx(Kr,{className:"h-12 w-full"},S))})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"Categories"}),r.jsxs(Ur,{open:o,onOpenChange:S=>{c(S),S||v()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsx(Zr,{children:a?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:k,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Name"}),r.jsx(xt,{id:"name",value:m.name,onChange:S=>x({...m,name:S.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",value:m.description,onChange:S=>x({...m,description:S.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"image_url",children:"Image URL"}),r.jsx(xt,{id:"image_url",value:m.image_url,onChange:S=>x({...m,image_url:S.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(xt,{id:"sort_order",type:"number",value:m.sort_order,onChange:S=>x({...m,sort_order:parseInt(S.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"is_active",checked:m.is_active,onCheckedChange:S=>x({...m,is_active:S})}),r.jsx(Xe,{htmlFor:"is_active",children:"Active"})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:a?"Update Category":"Create Category"})]})]})]})]}),r.jsx(et,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Sort Order"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(S=>r.jsxs(Er,{children:[r.jsx(yt,{className:"font-medium",children:S.name}),r.jsx(yt,{className:"max-w-xs truncate",children:S.description}),r.jsx(yt,{children:S.sort_order}),r.jsx(yt,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${S.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:S.is_active?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>w(S),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>C(S.id),disabled:i.isPending,children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},S.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function nWt(){var Se,oe;const{data:t,isLoading:e}=b$e(void 0,!1),{data:n}=_0e(!1),s=BHt(),i=$Ht(),o=UHt(),c=qHt(),a=VHt(),h=HHt(),m=WHt(),x=GHt(),v=KHt(),[w,k]=P.useState(!1),[C,S]=P.useState(!1),[T,I]=P.useState(!1),[A,D]=P.useState(null),[$,F]=P.useState(null),[q,W]=P.useState(!1),[K,Z]=P.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}),[re,he]=P.useState({name:"",price_adjustment:0}),[ue,je]=P.useState(""),ne=()=>{Z({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),D(null)},ye=ae=>{D(ae),Z({name:ae.name,description:ae.description||"",base_price:Number(ae.base_price),shipping_fee:Number(ae.shipping_fee),category_id:ae.category_id||"",allow_artwork_upload:ae.allow_artwork_upload,requires_proof_approval:ae.requires_proof_approval,is_active:ae.is_active,sort_order:ae.sort_order}),k(!0)},ie=async ae=>{ae.preventDefault();const Ne={...K,category_id:K.category_id||null};A?await i.mutateAsync({id:A.id,...Ne}):await s.mutateAsync(Ne),k(!1),ne()},me=async ae=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ae)},fe=async ae=>{if(!$||!ae.target.files||ae.target.files.length===0)return;W(!0);const Ne=ae.target.files[0],Te=Ne.name.split(".").pop(),Be=`products/${$.id}/${Date.now()}.${Te}`;try{const{error:Le}=await ee.storage.from("marketplace").upload(Be,Ne);if(Le)throw Le;const{data:{publicUrl:Qe}}=ee.storage.from("marketplace").getPublicUrl(Be);await c.mutateAsync({product_id:$.id,image_url:Qe,is_primary:!$.images||$.images.length===0}),He.success("Image uploaded successfully")}catch(Le){He.error("Failed to upload image: "+Le.message)}finally{W(!1)}},ve=async ae=>{ae.preventDefault(),$&&(await m.mutateAsync({product_id:$.id,name:re.name,price_adjustment:re.price_adjustment}),he({name:"",price_adjustment:0}))},Ie=async()=>{!$||!ue||(await v.mutateAsync({productId:$.id,videoUrl:ue}),je(""))};return e?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Kr,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(ae=>r.jsx(Kr,{className:"h-64 w-full"},ae))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"Products"}),r.jsxs(Ur,{open:w,onOpenChange:ae=>{k(ae),ae||ne()},children:[r.jsx(Oo,{asChild:!0,children:r.jsxs(te,{children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Br,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsx(Zr,{children:A?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"name",children:"Product Name"}),r.jsx(xt,{id:"name",value:K.name,onChange:ae=>Z({...K,name:ae.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"category",children:"Category"}),r.jsxs(_n,{value:K.category_id,onValueChange:ae=>Z({...K,category_id:ae}),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select category"})}),r.jsx(vn,{children:n==null?void 0:n.map(ae=>r.jsx(tr,{value:ae.id,children:ae.name},ae.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"description",children:"Description"}),r.jsx(gs,{id:"description",value:K.description,onChange:ae=>Z({...K,description:ae.target.value}),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(xt,{id:"base_price",type:"number",step:"0.01",min:"0",value:K.base_price,onChange:ae=>Z({...K,base_price:parseFloat(ae.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(xt,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:K.shipping_fee,onChange:ae=>Z({...K,shipping_fee:parseFloat(ae.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(xt,{id:"sort_order",type:"number",value:K.sort_order,onChange:ae=>Z({...K,sort_order:parseInt(ae.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"allow_artwork_upload",checked:K.allow_artwork_upload,onCheckedChange:ae=>Z({...K,allow_artwork_upload:ae})}),r.jsx(Xe,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"requires_proof_approval",checked:K.requires_proof_approval,onCheckedChange:ae=>Z({...K,requires_proof_approval:ae})}),r.jsx(Xe,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"is_active",checked:K.is_active,onCheckedChange:ae=>Z({...K,is_active:ae})}),r.jsx(Xe,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(te,{type:"submit",className:"w-full",disabled:s.isPending||i.isPending,children:A?"Update Product":"Create Product"})]})]})]})]}),r.jsx(et,{children:t&&t.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(ae=>{var Ne,Te;return r.jsxs(Ze,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[ae.images&&ae.images.length>0?r.jsx("img",{src:((Ne=ae.images.find(Be=>Be.is_primary))==null?void 0:Ne.image_url)||ae.images[0].image_url,alt:ae.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No image"}),!ae.is_active&&r.jsx(Ft,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Te=ae.category)==null?void 0:Te.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(ae.base_price).toFixed(2)]}),Number(ae.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(ae.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[ae.allow_artwork_upload&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ae.requires_proof_approval&&r.jsx(Ft,{variant:"outline",className:"text-xs",children:"Proof Required"}),ae.variants&&ae.variants.length>0&&r.jsxs(Ft,{variant:"outline",className:"text-xs",children:[ae.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>ye(ae),children:[r.jsx(ya,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{F(ae),S(!0)},children:[r.jsx(YS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{F(ae),I(!0)},children:[r.jsx(aj,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>me(ae.id),children:r.jsx(es,{className:"h-3 w-3 text-destructive"})})]})]})]},ae.id)})}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No products yet. Create your first product to get started."})})]}),r.jsx(Ur,{open:C,onOpenChange:S,children:r.jsxs(Br,{className:"max-w-2xl",children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Manage Images - ",$==null?void 0:$.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(Se=$==null?void 0:$.images)==null?void 0:Se.map(ae=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:ae.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),ae.is_primary&&r.jsx(Ft,{className:"absolute top-2 left-2",variant:"default",children:"Primary"}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!ae.is_primary&&r.jsx(te,{variant:"secondary",size:"icon",onClick:async()=>{var Ne;await h.mutateAsync({imageId:ae.id,productId:$.id}),F({...$,images:(Ne=$.images)==null?void 0:Ne.map(Te=>({...Te,is_primary:Te.id===ae.id}))})},disabled:h.isPending,title:"Set as primary",children:r.jsx(Bs,{className:"h-4 w-4"})}),r.jsx(te,{variant:"destructive",size:"icon",onClick:async()=>{var Te;await a.mutateAsync({id:ae.id,productId:$.id});const Ne=t==null?void 0:t.find(Be=>Be.id===$.id);Ne&&F({...Ne,images:(Te=Ne.images)==null?void 0:Te.filter(Be=>Be.id!==ae.id)})},disabled:a.isPending,children:r.jsx(es,{className:"h-4 w-4"})})]})]},ae.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:fe,className:"hidden",id:"image-upload",disabled:q}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(YS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(Xe,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(xt,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:ue,onChange:ae=>je(ae.target.value)}),r.jsxs(te,{onClick:Ie,disabled:!ue,children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),($==null?void 0:$.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",$.video.video_url]})]})]})]})}),r.jsx(Ur,{open:T,onOpenChange:I,children:r.jsxs(Br,{children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Manage Variants - ",$==null?void 0:$.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:ve,className:"flex gap-2",children:[r.jsx(xt,{placeholder:"Variant name (e.g., 500 count)",value:re.name,onChange:ae=>he({...re,name:ae.target.value}),required:!0}),r.jsx(xt,{type:"number",step:"0.01",placeholder:"Price adj.",value:re.price_adjustment,onChange:ae=>he({...re,price_adjustment:parseFloat(ae.target.value)||0}),className:"w-32"}),r.jsx(te,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(oe=$==null?void 0:$.variants)==null?void 0:oe.map(ae=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:ae.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(ae.price_adjustment)>=0?"+":"","$",Number(ae.price_adjustment).toFixed(2)]})]}),r.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:ae.id,productId:$.id}),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]},ae.id)),(!($!=null&&$.variants)||$.variants.length===0)&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:'No variants yet. Add variants like "250 count", "500 count", etc.'})]})]})]})})]})}const sWt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function iWt(){var S,T,I;const{data:t,isLoading:e}=ZHt(),n=QHt(),s=JHt(),[i,o]=P.useState(null),[c,a]=P.useState(!1),[h,m]=P.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,v]=P.useState(!1),w=A=>{o(A),m({status:A.status,notes:"",trackingNumber:A.tracking_number||"",trackingUrl:A.tracking_url||""}),a(!0)},k=async()=>{i&&(await n.mutateAsync({orderId:i.id,status:h.status,notes:h.notes,trackingNumber:h.trackingNumber,trackingUrl:h.trackingUrl,previousStatus:i.status}),a(!1))},C=async(A,D)=>{if(!i||!A.target.files||A.target.files.length===0)return;v(!0);const $=A.target.files[0],F=$.name.split(".").pop(),q=`proofs/${i.id}/${D}/${Date.now()}.${F}`;try{const{error:W}=await ee.storage.from("marketplace").upload(q,$);if(W)throw W;const{data:{publicUrl:K}}=ee.storage.from("marketplace").getPublicUrl(q);await s.mutateAsync({itemId:D,proofUrl:K,orderId:i.id}),He.success("Proof uploaded successfully")}catch(W){He.error("Failed to upload proof: "+W.message)}finally{v(!1)}};return e?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Kr,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(A=>r.jsx(Kr,{className:"h-16 w-full"},A))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Orders"})}),r.jsx(et,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Order #"}),r.jsx(Mt,{children:"Customer"}),r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{children:"Total"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(A=>{var D,$;return r.jsxs(Er,{children:[r.jsx(yt,{className:"font-mono",children:A.order_number}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((D=A.user)==null?void 0:D.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:($=A.user)==null?void 0:$.email})]})}),r.jsx(yt,{children:un(new Date(A.created_at),"MMM d, yyyy")}),r.jsxs(yt,{className:"font-bold",children:["$",Number(A.total).toFixed(2)]}),r.jsx(yt,{children:r.jsx(Ft,{className:v0e[A.status],children:A4[A.status]})}),r.jsx(yt,{className:"text-right",children:r.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>w(A),children:[r.jsx(Al,{className:"h-4 w-4 mr-1"}),"View"]})})]},A.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx(Ur,{open:c,onOpenChange:a,children:r.jsxs(Br,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Yr,{children:r.jsxs(Zr,{children:["Order ",i==null?void 0:i.order_number]})}),i&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Customer"}),r.jsx("p",{children:(S=i.user)==null?void 0:S.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(T=i.user)==null?void 0:T.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:i.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.shipping_address,r.jsx("br",{}),i.shipping_city,", ",i.shipping_state," ",i.shipping_zip]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),r.jsx("div",{className:"space-y-3",children:(I=i.items)==null?void 0:I.map(A=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:A.product_name}),A.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:A.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(A.unit_price).toFixed(2)," x ",A.quantity]})]}),A.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:A.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(Ft,{variant:A.proof_status==="approved"?"default":"secondary",children:A.proof_status||"No proof yet"})]}),A.proof_url?r.jsx("a",{href:A.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):r.jsxs("div",{children:[r.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:D=>C(D,A.id),className:"hidden",id:`proof-${A.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${A.id}`,children:r.jsx(te,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(Ao,{className:"h-4 w-4 mr-1"}),x?"Uploading...":"Upload Proof"]})})})]})]})})]},A.id))})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(i.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(i.shipping_total).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between font-bold text-lg mt-2",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(i.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Update Order Status"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Status"}),r.jsxs(_n,{value:h.status,onValueChange:A=>m({...h,status:A}),children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsx(vn,{children:sWt.map(A=>r.jsx(tr,{value:A,children:A4[A]},A))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Tracking Number"}),r.jsx(xt,{value:h.trackingNumber,onChange:A=>m({...h,trackingNumber:A.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Tracking URL"}),r.jsx(xt,{value:h.trackingUrl,onChange:A=>m({...h,trackingUrl:A.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Notes (optional)"}),r.jsx(gs,{value:h.notes,onChange:A=>m({...h,notes:A.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(te,{onClick:k,disabled:n.isPending,className:"w-full",children:[r.jsx(El,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),i.status_history&&i.status_history.length>0&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Status History"}),r.jsx("div",{className:"space-y-2",children:i.status_history.map(A=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Ft,{variant:"outline",children:A4[A.status]}),A.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:A.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:un(new Date(A.created_at),"MMM d, h:mm a")})]},A.id))})]})]})]})})]})}function aWt(){const[t,e]=P.useState("products"),n=ts();return r.jsx(Dr,{title:"Marketplace Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Marketplace Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage products, categories, and orders"})]}),r.jsxs(te,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(Oa,{value:t,onValueChange:e,children:[r.jsxs(Ta,{className:"grid w-full grid-cols-3",children:[r.jsxs(xn,{value:"products",className:"flex items-center gap-2",children:[r.jsx(El,{className:"h-4 w-4"}),"Products"]}),r.jsxs(xn,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(Lx,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(xn,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(ah,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Un,{value:"products",children:r.jsx(nWt,{})}),r.jsx(Un,{value:"categories",children:r.jsx(rWt,{})}),r.jsx(Un,{value:"orders",children:r.jsx(iWt,{})})]})]})})}function w$e(){return rr({queryKey:["reward-categories"],queryFn:async()=>{const{data:t,error:e}=await ee.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(e)throw e;return t}})}function oWt(t){return rr({queryKey:["reward-items",t],queryFn:async()=>{let e=ee.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:n,error:s}=await e;if(s)throw s;return n}})}function lWt(t){return rr({queryKey:["active-reward-items",t],queryFn:async()=>{let e=ee.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});t&&(e=e.eq("category_id",t));const{data:n,error:s}=await e;if(s)throw s;return n}})}function cWt(t){return rr({queryKey:["user-purchases",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await ee.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",t).order("purchased_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function dWt(){return rr({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:t,error:e}=await ee.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(e)throw e;if(!t||t.length===0)return[];const n=[...new Set(t.map(c=>c.user_id))],{data:s,error:i}=await ee.from("profiles").select("id, name, email").in("id",n);if(i)throw i;const o=new Map((s==null?void 0:s.map(c=>[c.id,c]))||[]);return t.map(c=>({...c,user:o.get(c.user_id)||null}))}})}function uWt(t){return rr({queryKey:["spendable-points",t],queryFn:async()=>{if(!t)return 0;const{data:e,error:n}=await ee.from("agent_attendance_stats").select("spendable_points").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return(e==null?void 0:e.spendable_points)||0},enabled:!!t})}function hWt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.rpc("purchase_reward_item",{p_item_id:e});if(s)throw s;const i=n;if(!i.success)throw new Error(i.error||"Purchase failed");return i},onSuccess:()=>{t.invalidateQueries({queryKey:["user-purchases"]}),t.invalidateQueries({queryKey:["spendable-points"]}),t.invalidateQueries({queryKey:["active-reward-items"]}),t.invalidateQueries({queryKey:["reward-items"]})}})}function fWt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("reward_store_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function pWt(){const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("reward_store_categories").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function mWt(){const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("reward_store_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function gWt(){const t=Qr();return dr({mutationFn:async e=>{const{data:n,error:s}=await ee.from("reward_store_items").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function xWt(){const t=Qr();return dr({mutationFn:async({id:e,...n})=>{const{data:s,error:i}=await ee.from("reward_store_items").update(n).eq("id",e).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function yWt(){const t=Qr();return dr({mutationFn:async e=>{const{error:n}=await ee.from("reward_store_items").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function vWt(t){const e=t.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return e?{bucket:e[1],path:e[2]}:null}async function nde(t,e){const n=vWt(t);if(n)try{const{data:s,error:i}=await ee.storage.from(n.bucket).download(n.path);if(i){console.error("Error downloading file:",i),He.error("Failed to download file");return}const o=URL.createObjectURL(s),c=document.createElement("a");c.href=o,c.download=e||n.path.split("/").pop()||"download",document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("Download error:",s),He.error("Failed to download file")}else try{const i=await(await fetch(t)).blob(),o=URL.createObjectURL(i),c=document.createElement("a");c.href=o,c.download=e||t.split("/").pop()||"download",document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("External download error:",s),He.error("Failed to download file")}}function j$e(){return rr({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:t,error:e}=await ee.from("point_reward_settings").select("*").order("action_name");if(e)throw e;return t}})}function _Wt(){const t=Qr();return dr({mutationFn:async({id:e,points:n,is_active:s})=>{const i={points:n};s!==void 0&&(i.is_active=s);const{data:o,error:c}=await ee.from("point_reward_settings").update(i).eq("id",e).select().single();if(c)throw c;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["point-reward-settings"]})}})}function bWt(){const{user:t}=zr(),[e,n]=P.useState("items"),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,h]=P.useState(""),[m,x]=P.useState(""),[v,w]=P.useState(""),[k,C]=P.useState(null),[S,T]=P.useState(!1),[I,A]=P.useState(null),[D,$]=P.useState(""),[F,q]=P.useState(""),[W,K]=P.useState(null),[Z,re]=P.useState(""),[he,ue]=P.useState("file"),[je,ne]=P.useState(""),[ye,ie]=P.useState(""),[me,fe]=P.useState(""),[ve,Ie]=P.useState(!0),[Se,oe]=P.useState(null),[ae,Ne]=P.useState(!1),[Te,Be]=P.useState(!1),Le=P.useRef(null),Qe=P.useRef(null),{data:Fe,isLoading:Ce}=w$e(),{data:Je,isLoading:Ae}=oWt(),{data:Ye,isLoading:ge}=dWt(),{data:ft,isLoading:nt}=j$e(),Ve=fWt(),Me=pWt(),rt=mWt(),Re=gWt(),Ge=xWt(),tt=yWt(),Et=_Wt(),[Lt,Ot]=P.useState({}),Dt=_r=>{_r?(c(_r),h(_r.name),x(_r.description||""),w(_r.icon||"")):(c(null),h(""),x(""),w("")),i(!0)},kt=async()=>{if(!a.trim()){He.error("Please enter a category name");return}try{o?(await Me.mutateAsync({id:o.id,name:a,description:m||null,icon:v||null}),He.success("Category updated successfully")):(await Ve.mutateAsync({name:a,description:m||null,icon:v||null,sort_order:((Fe==null?void 0:Fe.length)||0)+1}),He.success("Category created successfully")),i(!1)}catch(_r){console.error("Error saving category:",_r),He.error("Failed to save category")}},sr=async()=>{if(k)try{await rt.mutateAsync(k),He.success("Category deleted successfully"),C(null)}catch(_r){console.error("Error deleting category:",_r),He.error("Failed to delete category")}},Pr=_r=>{var js;_r?(A(_r),$(_r.name),q(_r.description||""),K(_r.category_id),re(_r.points_cost.toString()),ue(_r.item_type),ne(_r.file_url||""),ie(_r.preview_image_url||""),fe(((js=_r.max_quantity)==null?void 0:js.toString())||""),Ie(_r.is_active)):(A(null),$(""),q(""),K(null),re(""),ue("file"),ne(""),ie(""),fe(""),Ie(!0)),T(!0)},wn=async(_r,js)=>{js==="file"?Ne(!0):Be(!0);try{const Ii=_r.name.split(".").pop(),fi=`${Date.now()}-${Math.random().toString(36).substring(7)}.${Ii}`,Aa=`${js==="file"?"items":"previews"}/${fi}`,{error:ca}=await ee.storage.from("reward-store").upload(Aa,_r);if(ca)throw ca;const{data:{publicUrl:Yo}}=ee.storage.from("reward-store").getPublicUrl(Aa);js==="file"?ne(Yo):ie(Yo),He.success("File uploaded successfully")}catch(Ii){console.error("Error uploading file:",Ii),He.error("Failed to upload file")}finally{js==="file"?Ne(!1):Be(!1)}},kn=async()=>{if(!D.trim()){He.error("Please enter an item name");return}if(!Z||parseInt(Z)<0){He.error("Please enter a valid points cost");return}try{const _r={name:D,description:F||null,category_id:W,points_cost:parseInt(Z),item_type:he,file_url:je||null,preview_image_url:ye||null,max_quantity:me?parseInt(me):null,current_quantity:me?parseInt(me):null,is_active:ve,created_by:t==null?void 0:t.id};I?(await Ge.mutateAsync({id:I.id,..._r,current_quantity:I.max_quantity!==(me?parseInt(me):null)?me?parseInt(me):null:I.current_quantity}),He.success("Item updated successfully")):(await Re.mutateAsync(_r),He.success("Item created successfully")),T(!1)}catch(_r){console.error("Error saving item:",_r),He.error("Failed to save item")}},pn=async()=>{if(Se)try{await tt.mutateAsync(Se),He.success("Item deleted successfully"),oe(null)}catch(_r){console.error("Error deleting item:",_r),He.error("Failed to delete item")}},qn=async(_r,js)=>{const Ii=Lt[_r];if(Ii===void 0||Ii===js.toString())return;const fi=parseInt(Ii);if(isNaN(fi)||fi<0){He.error("Please enter a valid positive number");return}try{await Et.mutateAsync({id:_r,points:fi}),He.success("Points updated successfully"),Ot(Aa=>{const ca={...Aa};return delete ca[_r],ca})}catch(Aa){console.error("Error updating points:",Aa),He.error("Failed to update points")}};return Ce||Ae||ge||nt?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-8 w-64"}),r.jsx(Kr,{className:"h-96"})]})}):r.jsxs(Dr,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Reward Store Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage store items that agents can purchase with their points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(El,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Items"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Je==null?void 0:Je.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(Je==null?void 0:Je.filter(_r=>_r.is_active).length)||0," active"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Lx,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Fe==null?void 0:Fe.length)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg. Cost"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[Je&&Je.length>0?Math.round(Je.reduce((_r,js)=>_r+js.points_cost,0)/Je.length):0," pts"]})]})})]}),r.jsxs(Oa,{value:e,onValueChange:n,children:[r.jsxs(Ta,{children:[r.jsx(xn,{value:"items",children:"Items"}),r.jsx(xn,{value:"categories",children:"Categories"}),r.jsx(xn,{value:"purchases",children:"Purchases"}),r.jsx(xn,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Un,{value:"items",className:"mt-4",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Store Items"}),r.jsx(In,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(te,{onClick:()=>Pr(),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(et,{children:!Je||Je.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ua,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No items yet. Add your first reward item!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Item"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{className:"text-center",children:"Cost"}),r.jsx(Mt,{className:"text-center",children:"Type"}),r.jsx(Mt,{className:"text-center",children:"Quantity"}),r.jsx(Mt,{className:"text-center",children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:Je.map(_r=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[_r.preview_image_url?r.jsx("img",{src:_r.preview_image_url,alt:_r.name,className:"h-10 w-10 rounded object-cover"}):r.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ua,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:_r.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:_r.description||"No description"})]})]})}),r.jsx(yt,{children:_r.category?r.jsx(Ft,{variant:"outline",children:_r.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1"}),_r.points_cost]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[_r.item_type==="file"?r.jsx(Si,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(bo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:_r.item_type})]})}),r.jsx(yt,{className:"text-center",children:_r.max_quantity!==null?r.jsxs("span",{className:_r.current_quantity===0?"text-red-500":"",children:[_r.current_quantity,"/",_r.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(yt,{className:"text-center",children:r.jsx(Ft,{variant:_r.is_active?"default":"secondary",children:_r.is_active?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Pr(_r),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>oe(_r.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},_r.id))})]})})]})}),r.jsx(Un,{value:"categories",className:"mt-4",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Xt,{children:"Categories"}),r.jsx(In,{children:"Organize your store items into categories"})]}),r.jsxs(te,{onClick:()=>Dt(),children:[r.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(et,{children:!Fe||Fe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Lx,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"text-center",children:"Items"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:Fe.map(_r=>r.jsxs(Er,{children:[r.jsxs(yt,{className:"font-medium",children:[_r.icon&&r.jsx("span",{className:"mr-2",children:_r.icon}),_r.name]}),r.jsx(yt,{className:"text-muted-foreground",children:_r.description||"—"}),r.jsx(yt,{className:"text-center",children:(Je==null?void 0:Je.filter(js=>js.category_id===_r.id).length)||0}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Dt(_r),children:r.jsx(ya,{className:"h-4 w-4"})}),r.jsx(te,{variant:"ghost",size:"sm",onClick:()=>C(_r.id),children:r.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},_r.id))})]})})]})}),r.jsx(Un,{value:"purchases",className:"mt-4",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(ah,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(In,{children:"View all reward redemptions by agents"})]}),r.jsx(et,{children:!Ye||Ye.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ah,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Item"}),r.jsx(Mt,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Vs,{children:Ye.map(_r=>{var js,Ii,fi,Aa;return r.jsxs(Er,{children:[r.jsx(yt,{className:"text-muted-foreground",children:un(new Date(_r.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:r.jsx(jc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((js=_r.user)==null?void 0:js.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((Ii=_r.user)==null?void 0:Ii.email)||"—"})]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(fi=_r.item)!=null&&fi.preview_image_url?r.jsx("img",{src:_r.item.preview_image_url,alt:_r.item.name,className:"h-8 w-8 rounded object-cover"}):r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center",children:r.jsx(Ua,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((Aa=_r.item)==null?void 0:Aa.name)||"Deleted item"})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1"}),_r.points_spent]})})]},_r.id)})})]})})]})})]})]}),r.jsx(Ur,{open:s,onOpenChange:i,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:o?"Edit Category":"Add Category"}),r.jsx(us,{children:o?"Update the category details":"Create a new category for your store items"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"categoryName",children:"Name"}),r.jsx(xt,{id:"categoryName",value:a,onChange:_r=>h(_r.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(gs,{id:"categoryDescription",value:m,onChange:_r=>x(_r.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(xt,{id:"categoryIcon",value:v,onChange:_r=>w(_r.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(te,{onClick:kt,disabled:Ve.isPending||Me.isPending,children:Ve.isPending||Me.isPending?"Saving...":"Save"})]})]})}),r.jsx(Ur,{open:S,onOpenChange:T,children:r.jsxs(Br,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:I?"Edit Item":"Add Item"}),r.jsx(us,{children:I?"Update the item details":"Create a new reward item for agents to purchase"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"itemName",children:"Name *"}),r.jsx(xt,{id:"itemName",value:D,onChange:_r=>$(_r.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"itemDescription",children:"Description"}),r.jsx(gs,{id:"itemDescription",value:F,onChange:_r=>q(_r.target.value),placeholder:"Describe the item..."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(_n,{value:W||"none",onValueChange:_r=>K(_r==="none"?null:_r),children:[r.jsx(yn,{children:r.jsx(bn,{placeholder:"Select category"})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"none",children:"No category"}),Fe==null?void 0:Fe.map(_r=>r.jsxs(tr,{value:_r.id,children:[_r.icon&&`${_r.icon} `,_r.name]},_r.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(xt,{id:"itemPointsCost",type:"number",min:"0",value:Z,onChange:_r=>re(_r.target.value),placeholder:"e.g., 100"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"itemType",children:"Type"}),r.jsxs(_n,{value:he,onValueChange:ue,children:[r.jsx(yn,{children:r.jsx(bn,{})}),r.jsxs(vn,{children:[r.jsx(tr,{value:"file",children:"File Download"}),r.jsx(tr,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(xt,{id:"itemMaxQuantity",type:"number",min:"1",value:me,onChange:_r=>fe(_r.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:je,onChange:_r=>ne(_r.target.value),placeholder:he==="file"?"Upload a file or paste URL":"Paste external link"}),he==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>{var _r;return(_r=Le.current)==null?void 0:_r.click()},disabled:ae,children:r.jsx(Ao,{className:"h-4 w-4"})}),r.jsx("input",{ref:Le,type:"file",className:"hidden",onChange:_r=>{var Ii;const js=(Ii=_r.target.files)==null?void 0:Ii[0];js&&wn(js,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(xt,{value:ye,onChange:_r=>ie(_r.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(te,{type:"button",variant:"outline",size:"icon",onClick:()=>{var _r;return(_r=Qe.current)==null?void 0:_r.click()},disabled:Te,children:r.jsx(Wo,{className:"h-4 w-4"})}),r.jsx("input",{ref:Qe,type:"file",accept:"image/*",className:"hidden",onChange:_r=>{var Ii;const js=(Ii=_r.target.files)==null?void 0:Ii[0];js&&wn(js,"preview")}})]}),ye&&r.jsx("img",{src:ye,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Js,{id:"itemIsActive",checked:ve,onCheckedChange:Ie}),r.jsx(Xe,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(te,{onClick:kn,disabled:Re.isPending||Ge.isPending,children:Re.isPending||Ge.isPending?"Saving...":"Save"})]})]})}),r.jsx(oh,{open:!!k,onOpenChange:()=>C(null),children:r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Delete Category"}),r.jsx(ju,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:sr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(oh,{open:!!Se,onOpenChange:()=>oe(null),children:r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Delete Item"}),r.jsx(ju,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:pn,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e==="point-settings"&&r.jsxs(Ze,{className:"mt-4",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(od,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Xt,{children:"Point Reward Settings"}),r.jsx(In,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(et,{children:!ft||ft.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(od,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Er,{children:[r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"text-center w-32",children:"Points"}),r.jsx(Mt,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Vs,{children:ft.map(_r=>r.jsxs(Er,{children:[r.jsx(yt,{children:r.jsx("p",{className:"font-medium",children:_r.action_name})}),r.jsx(yt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:_r.description})}),r.jsx(yt,{className:"text-center",children:r.jsx(xt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:Lt[_r.id]??_r.points.toString(),onChange:js=>Ot(Ii=>({...Ii,[_r.id]:js.target.value}))})}),r.jsx(yt,{className:"text-right",children:r.jsx(te,{size:"sm",variant:"outline",disabled:Lt[_r.id]===void 0||Lt[_r.id]===_r.points.toString()||Et.isPending,onClick:()=>qn(_r.id,_r.points),children:r.jsx(hg,{className:"h-4 w-4"})})})]},_r.id))})]})})]})]})}function wWt(){const t=Qr(),[e,n]=P.useState(!1),{data:s,isLoading:i}=rr({queryKey:["social-accounts"],queryFn:async()=>{const{data:m,error:x}=await ee.from("social_accounts").select("*").order("created_at",{ascending:!1});if(x)throw x;return m}}),o=dr({mutationFn:async m=>{const{error:x}=await ee.from("social_accounts").delete().eq("id",m);if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),He.success("Account disconnected successfully")},onError:()=>{He.error("Failed to disconnect account")}}),c=async()=>{n(!0);try{const{data:m,error:x}=await ee.functions.invoke("meta-oauth",{body:{action:"get_auth_url"}});if(x)throw x;if(m!=null&&m.authUrl)window.location.href=m.authUrl;else throw new Error("Failed to get authorization URL")}catch(m){console.error("Meta OAuth error:",m),He.error("Failed to start connection. Make sure Meta App credentials are configured."),n(!1)}},a=(s==null?void 0:s.filter(m=>m.platform==="facebook"))||[],h=(s==null?void 0:s.filter(m=>m.platform==="instagram"))||[];return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Ru,{title:"Integrations",description:"Connect your social media accounts to post directly from the dashboard"}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-2",children:r.jsx(Td,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Facebook"}),r.jsx(In,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[a.length>0?r.jsx("div",{className:"space-y-3",children:a.map(m=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:m.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(Td,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:m.page_name||m.platform_username||"Facebook Page"}),r.jsx(Ft,{variant:m.is_active?"default":"secondary",className:"text-xs",children:m.is_active?"Connected":"Inactive"})]})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Disconnect Facebook?"}),r.jsx(ju,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>o.mutate(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},m.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Facebook accounts connected"}),r.jsxs(te,{onClick:c,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Fl,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-2",children:r.jsx(Zd,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Instagram"}),r.jsx(In,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[h.length>0?r.jsx("div",{className:"space-y-3",children:h.map(m=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:m.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(Zd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",m.platform_username||"Instagram Account"]}),r.jsx(Ft,{variant:m.is_active?"default":"secondary",className:"text-xs",children:m.is_active?"Connected":"Inactive"})]})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Disconnect Instagram?"}),r.jsx(ju,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>o.mutate(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},m.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Instagram accounts connected"}),r.jsxs(te,{onClick:c,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Fl,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4"}),"Connect Instagram Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Instagram Business accounts must be connected to a Facebook Page"})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Xt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(In,{children:"Follow these steps to set up Meta integration"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Create a Meta App"}),r.jsx("p",{className:"text-muted-foreground",children:"Go to developers.facebook.com and create a new app"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Add Facebook Login Product"}),r.jsx("p",{className:"text-muted-foreground",children:"Enable Facebook Login and configure OAuth redirect URLs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Configure API Keys"}),r.jsx("p",{className:"text-muted-foreground",children:"Add META_APP_ID and META_APP_SECRET to your environment"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"4"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Request Permissions"}),r.jsx("p",{className:"text-muted-foreground",children:"Request pages_manage_posts, pages_read_engagement, instagram_basic, and instagram_content_publish"})]})]})]}),r.jsx(te,{variant:"outline",className:"gap-2",asChild:!0,children:r.jsxs("a",{href:"https://developers.facebook.com/apps",target:"_blank",rel:"noopener noreferrer",children:[r.jsx($s,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const jWt={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 KM(t,e=18,n=10){return t.length<=e+n+3?t:`${t.slice(0,e)}…${t.slice(-n)}`}function kWt(){var he,ue,je,ne,ye;const t=Qr(),[e,n]=P.useState("Test Push"),[s,i]=P.useState("Testing web push notification"),[o,c]=P.useState("/community"),[a,h]=P.useState(!1),[m,x]=P.useState(!1),[v,w]=P.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[k,C]=P.useState(null),[S,T]=P.useState(null),{data:I,isLoading:A}=rr({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:ie,error:me}=await ee.from("push_notification_settings").select("*").order("setting_key");if(me)throw me;return ie}}),{data:D,isLoading:$}=rr({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:ie,error:me}=await ee.from("push_subscriptions").select("*",{count:"exact",head:!0});if(me)throw me;return{totalSubscriptions:ie||0}}}),F=dr({mutationFn:async({settingKey:ie,isEnabled:me})=>{const{error:fe}=await ee.from("push_notification_settings").update({is_enabled:me}).eq("setting_key",ie);if(fe)throw fe},onSuccess:()=>{t.invalidateQueries({queryKey:["push-notification-settings"]}),He.success("Notification setting updated")},onError:ie=>{He.error("Failed to update setting: "+ie.message)}}),q=P.useMemo(()=>{var ie,me;return v.isSupported?`perm=${v.permission??"unknown"} · controller=${v.controllerPresent?"yes":"no"} · sw=${((ie=v.serviceWorker)==null?void 0:ie.activeState)??"unknown"} · sub=${(me=v.subscription)!=null&&me.endpoint?"yes":"no"}`:"Push not supported in this browser."},[v]);P.useEffect(()=>{let ie=!0;const me=async()=>{var Se,oe,ae,Ne,Te,Be,Le;const ve="serviceWorker"in navigator&&"PushManager"in window,Ie={isSupported:ve,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((Se=navigator.serviceWorker)!=null&&Se.controller)};if(!ve){ie&&w(Ie);return}try{const{data:Qe,error:Fe}=await ee.functions.invoke("get-vapid-public-key",{body:{}});if(Fe)throw Fe;Ie.vapidPublicKey=Qe==null?void 0:Qe.vapidPublicKey;const Je=(await navigator.serviceWorker.getRegistrations()).find(Ae=>{var ge,ft,nt;return(((ge=Ae.active)==null?void 0:ge.scriptURL)||((ft=Ae.waiting)==null?void 0:ft.scriptURL)||((nt=Ae.installing)==null?void 0:nt.scriptURL)||"").includes("/sw.js")});if(Je){Ie.pushWorkerScriptUrl=((oe=Je.active)==null?void 0:oe.scriptURL)||((ae=Je.waiting)==null?void 0:ae.scriptURL)||((Ne=Je.installing)==null?void 0:Ne.scriptURL),Ie.serviceWorker={scope:Je.scope,activeState:(Te=Je.active)==null?void 0:Te.state};const Ae=await Je.pushManager.getSubscription();if(Ae){const Ye=Ae.toJSON();Ie.subscription={endpoint:Ye.endpoint,p256dh:(Be=Ye.keys)==null?void 0:Be.p256dh,auth:(Le=Ye.keys)==null?void 0:Le.auth}}}}catch(Qe){Ie.error=(Qe==null?void 0:Qe.message)||String(Qe)}ie&&w(Ie)};me();const fe=window.setInterval(me,4e3);return()=>{ie=!1,window.clearInterval(fe)}},[]);const W=async()=>{if(typeof Notification>"u"){He.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){He.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),He.success("Triggered a local notification (not push).")}catch(ie){He.error(`Local notification failed: ${(ie==null?void 0:ie.message)||String(ie)}`)}},K=async()=>{h(!0),C(null);try{const{data:ie,error:me}=await ee.functions.invoke("send-push-notification",{body:{title:e,body:s,url:o}});if(me)throw me;C({sent:ie==null?void 0:ie.sent,failed:ie==null?void 0:ie.failed,expiredCleaned:ie==null?void 0:ie.expiredCleaned,vapidPublicKey:ie==null?void 0:ie.vapidPublicKey}),(ie==null?void 0:ie.sent)>0?He.success(`Test notification sent to ${ie.sent} subscriber(s)`):(ie==null?void 0:ie.failed)>0?He.warning(`Notification failed for ${ie.failed} subscriber(s). ${ie.expired||0} expired subscriptions cleaned up.`):He.info("No active subscriptions to send to")}catch(ie){console.error("Error sending test notification:",ie),C({error:(ie==null?void 0:ie.message)||String(ie)}),He.error("Failed to send test notification: "+(ie.message||"Unknown error"))}finally{h(!1)}},Z=async()=>{x(!0),T(null);try{const{data:ie,error:me}=await ee.functions.invoke("generate-vapid-keys",{body:{}});if(me)throw me;const fe=ie==null?void 0:ie.publicKey,ve=ie==null?void 0:ie.privateKey;if(!fe||!ve)throw new Error("generate-vapid-keys did not return keys");T({publicKey:fe,privateKey:ve}),He.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(ie){console.error("Error generating VAPID keys:",ie),He.error("Failed to generate VAPID keys: "+((ie==null?void 0:ie.message)||"Unknown error"))}finally{x(!1)}},re=dr({mutationFn:async()=>{const{error:ie}=await ee.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(ie)throw ie},onSuccess:()=>{He.success("All subscriptions cleared. Users will need to re-enable notifications."),t.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:ie=>{He.error("Failed to clear subscriptions: "+ie.message)}});return r.jsx(Dr,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ru,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(In,{children:"Current active push notification subscriptions"})]}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:$?"...":(D==null?void 0:D.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(od,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(In,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(et,{children:A?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:I==null?void 0:I.map(ie=>{const me=jWt[ie.setting_key]||{label:ie.setting_key,icon:"🔔"};return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-2xl",children:me.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:me.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:ie.description})]})]}),r.jsx(Js,{checked:ie.is_enabled,onCheckedChange:fe=>F.mutate({settingKey:ie.setting_key,isEnabled:fe}),disabled:F.isPending})]},ie.id)})})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(dg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(In,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:q}),v.error&&r.jsx("div",{className:"mt-2 text-destructive",children:v.error}),r.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:v.vapidPublicKey?KM(v.vapidPublicKey):"(not loaded)"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Service worker"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["scope: ",(he=v.serviceWorker)!=null&&he.scope?KM(v.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((ue=v.serviceWorker)==null?void 0:ue.activeState)??"none"]})]})]}),r.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["endpoint: ",(je=v.subscription)!=null&&je.endpoint?KM(v.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ne=v.subscription)!=null&&ne.p256dh?KM(v.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(ye=v.subscription)!=null&&ye.auth?KM(v.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(te,{variant:"outline",onClick:W,children:"Local notification test"}),r.jsx(te,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(xt,{id:"test-title",value:e,onChange:ie=>n(ie.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(gs,{id:"test-body",value:s,onChange:ie=>i(ie.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(xt,{id:"test-url",value:o,onChange:ie=>c(ie.target.value),placeholder:"/community or full URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),r.jsxs(te,{onClick:K,disabled:a||!e||!s,className:"w-full sm:w-auto",children:[r.jsx(To,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Test Notification"]}),k&&r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Last send debug"}),k.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",k.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",k.sent??0," sent, ",k.failed??0," failed, ",k.expiredCleaned??0," expired cleaned"]}),k.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:k.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Xt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(es,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(In,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(te,{variant:"destructive",onClick:()=>re.mutate(),disabled:re.isPending,children:[r.jsx(es,{className:"h-4 w-4 mr-2"}),re.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(te,{variant:"outline",onClick:Z,disabled:m,children:m?"Generating…":"Generate VAPID keys"})}),S&&r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"text-muted-foreground",children:["Copy these into backend secrets ",r.jsx("span",{className:"font-mono",children:"VAPID_PUBLIC_KEY"})," and ",r.jsx("span",{className:"font-mono",children:"VAPID_PRIVATE_KEY"}),"."]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:S.publicKey})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Private key (keep secret)"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:S.privateKey})]})]})]})]})]})]})})}function NWt(){const[t]=Pd(),e=ts(),[n,s]=P.useState("loading"),[i,o]=P.useState("Processing connection...");return P.useEffect(()=>{(async()=>{const a=t.get("code"),h=t.get("error"),m=t.get("error_description"),x=t.get("state");if(h){s("error"),o(m||"Authorization was denied"),He.error("Failed to connect: "+(m||h));return}if(!a){s("error"),o("No authorization code received"),He.error("Failed to connect: No authorization code");return}try{const{data:v,error:w}=await ee.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:x}});if(w)throw w;if(v!=null&&v.success)s("success"),o(v.message||"Accounts connected successfully!"),He.success(v.message||"Social accounts connected!");else throw new Error((v==null?void 0:v.error)||"Failed to connect accounts")}catch(v){console.error("Callback error:",v),s("error"),o(v.message||"Failed to complete connection"),He.error(v.message||"Failed to connect accounts")}})()},[t]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(sn,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(Ba,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(Oc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Xt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(In,{children:i})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(te,{onClick:()=>e("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function SWt(){const t=ts(),e=Qr(),{isAdmin:n}=zr(),[s,i]=P.useState(!1),[o,c]=P.useState(null),[a,h]=P.useState(null),{data:m,isLoading:x}=rr({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:F},error:q}=await ee.auth.getUser();if(q)throw q;if(!F)return[];const{data:W,error:K}=await ee.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(K)throw K;return W}}),v=dr({mutationFn:async F=>{const{data:{user:q},error:W}=await ee.auth.getUser();if(W)throw W;if(!q)throw new Error("Not authenticated");const{error:K}=await ee.from("social_accounts").delete().eq("id",F).eq("user_id",q.id);if(K)throw K},onSuccess:()=>{e.invalidateQueries({queryKey:["my-social-accounts"]}),e.invalidateQueries({queryKey:["social-accounts-for-post"]}),He.success("Account disconnected successfully")},onError:()=>{He.error("Failed to disconnect account")}}),w=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),He.error("Failed to start connection. Please try again."),i(!1)}},k=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),He.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},C=async()=>{i(!0);try{const{data:F,error:q}=await ee.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(F){console.error("Google OAuth error:",F),He.error("Failed to start Google connection. Please try again."),i(!1)}},S=(m==null?void 0:m.filter(F=>F.platform==="facebook"))||[],T=(m==null?void 0:m.filter(F=>F.platform==="instagram"))||[],I=(m==null?void 0:m.filter(F=>F.platform==="linkedin"))||[],A=(m==null?void 0:m.filter(F=>F.platform==="google_business"))||[],D=((m==null?void 0:m.length)||0)>0,$=async(F,q)=>{c(F),h(null);try{const{data:W,error:K}=await ee.functions.invoke("meta-api-test",{body:{testType:"all",accountId:F}});if(K)throw K;h(W.results||[]),He.success(W.summary||"API tests completed")}catch(W){console.error("Meta API test error:",W),He.error("Failed to run API tests")}finally{c(null)}};return r.jsx(Dr,{title:"Social Connections",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-pink-500 via-purple-500 to-blue-500 p-6 md:p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs(Ft,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),r.jsx("p",{className:"text-white/90 max-w-xl",children:"Link your Facebook Pages and Instagram Business accounts to post content directly from Social Swag with one click."})]})]}),r.jsxs(te,{variant:"ghost",onClick:()=>t("/social-swag-2"),className:"gap-2",children:[r.jsx(Ga,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(Ze,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Gi,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Ft,{variant:"secondary",className:"mb-3 bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Social Connections Coming Soon!"}),r.jsx("p",{className:"text-muted-foreground max-w-md",children:"We're putting the finishing touches on this feature. Soon you'll be able to connect your social accounts and post directly from Social Swag with one click."})]})}),n&&r.jsxs(r.Fragment,{children:[D&&r.jsx(Ze,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(et,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(Ba,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-200",children:"You're all set!"}),r.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"You can now post directly to your connected accounts from Social Swag."})]})]})}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:r.jsx(Td,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Facebook"}),r.jsx(In,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Fl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):S.length>0?r.jsx("div",{className:"space-y-3",children:S.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:F.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(Td,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Facebook Page"}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Disconnect Facebook?"}),r.jsx(ju,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(te,{onClick:w,disabled:s,className:"w-full gap-2",variant:S.length>0?"outline":"default",children:[s?r.jsx(Fl,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4"}),S.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:r.jsx(Zd,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Instagram"}),r.jsx(In,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Fl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:F.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(Zd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",F.platform_username||"Instagram Account"]}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Disconnect Instagram?"}),r.jsx(ju,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(te,{onClick:w,disabled:s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Fl,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4"}),T.length>0?"Connect Another Account":"Connect Instagram"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:r.jsx(am,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"LinkedIn"}),r.jsx(In,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Fl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):I.length>0?r.jsx("div",{className:"space-y-3",children:I.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:F.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(am,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.platform_username||"LinkedIn Account"}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Disconnect LinkedIn?"}),r.jsx(ju,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(te,{onClick:k,disabled:s,className:"w-full gap-2",variant:I.length>0?"outline":"default",children:[s?r.jsx(Fl,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4"}),I.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),r.jsxs(Ze,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Ft,{variant:"secondary",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"})}),n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Ft,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:r.jsx(cl,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Google Business"}),r.jsx(In,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Fl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?r.jsx("div",{className:"space-y-3",children:A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Di,{className:"h-10 w-10",children:[r.jsx(Po,{src:F.profile_picture_url||""}),r.jsx(Ri,{children:r.jsx(cl,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Google Business"}),r.jsx(Ft,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(oh,{children:[r.jsx(O0,{asChild:!0,children:r.jsx(te,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(es,{className:"h-4 w-4"})})}),r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Disconnect Google Business?"}),r.jsx(ju,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:()=>v.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:n?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(te,{onClick:n?C:void 0,disabled:!n||s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(Fl,{className:"h-4 w-4 animate-spin"}):r.jsx(Mn,{className:"h-4 w-4"}),A.length>0?"Reconnect Google Business":"Connect Google Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),n&&(S.length>0||T.length>0)&&r.jsxs(Ze,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:r.jsx(ej,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(In,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[S.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Td,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:F.page_name||"Facebook Page"})]}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>$(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ej,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${F.id}`)),T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zd,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",F.platform_username||"Instagram"]})]}),r.jsx(te,{size:"sm",variant:"outline",onClick:()=>$(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ej,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${F.id}`))]}),a&&a.length>0&&r.jsxs("div",{className:"mt-4 rounded-lg border bg-background p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Test Results"}),r.jsx("div",{className:"space-y-2",children:a.map((F,q)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[F.status==="success"?r.jsx(Ha,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):F.status==="pending"?r.jsx(sn,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(Oc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:F.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:F.details})]})]},q))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Facebook posts are auto-deleted. Instagram posts will remain and should be manually deleted. Allow up to 24 hours for Meta to register the API calls."})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{className:"text-lg",children:"How it works"})}),r.jsx(et,{children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Connect your accounts"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Post with one click"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function CWt(){const[t]=Pd(),e=ts(),[n,s]=P.useState("loading"),[i,o]=P.useState("Processing your connection...");return P.useEffect(()=>{(async()=>{var v;const a=t.get("code"),h=t.get("error"),m=t.get("error_description"),x=t.get("state");if(h){s("error"),o(m||"Authorization was denied"),He.error("Connection failed: "+(m||h));return}if(!a){s("error"),o("No authorization code received"),He.error("No authorization code received");return}try{const{data:w,error:k}=await ee.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:x,callbackPath:"/social-connections/callback"}});if(k)throw k;if(w!=null&&w.success)s("success"),o(`Successfully connected ${((v=w.accounts)==null?void 0:v.length)||0} account(s)!`),He.success("Social accounts connected successfully!");else throw new Error((w==null?void 0:w.error)||"Unknown error")}catch(w){console.error("OAuth callback error:",w),s("error"),o(w instanceof Error?w.message:"Failed to connect accounts"),He.error("Failed to connect: "+(w instanceof Error?w.message:"Unknown error"))}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(sn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Ba,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Oc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Xt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(In,{children:i})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function MWt(){const[t]=Pd(),e=ts(),[n,s]=P.useState("loading"),[i,o]=P.useState("Connecting your Google Business Profile...");return P.useEffect(()=>{(async()=>{const a=t.get("code"),h=t.get("error"),m=t.get("error_description"),x=t.get("state");if(h){s("error"),o(m||"Authorization was denied"),He.error("Connection failed: "+(m||h));return}if(!a){s("error"),o("No authorization code received"),He.error("No authorization code received");return}try{const{data:v,error:w}=await ee.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:a,state:x}});if(w)throw w;if(v!=null&&v.success)s("success"),o(v.message||"Successfully connected Google Business Profile!"),He.success("Google Business Profile connected!");else throw new Error((v==null?void 0:v.error)||"Unknown error")}catch(v){console.error("Google OAuth callback error:",v),s("error"),o(v instanceof Error?v.message:"Failed to connect Google Business Profile"),He.error("Failed to connect: "+(v instanceof Error?v.message:"Unknown error"))}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(sn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Ba,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(Oc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Xt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(In,{children:i})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(te,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function TWt(){const[t]=Pd(),e=ts(),[n,s]=P.useState("loading"),[i,o]=P.useState("Connecting your LinkedIn account...");return P.useEffect(()=>{(async()=>{var v;const a=t.get("code"),h=t.get("state"),m=t.get("error"),x=t.get("error_description");if(m){console.error("LinkedIn OAuth error:",m,x),s("error"),o(x||"Failed to connect LinkedIn account"),He.error(x||"Failed to connect LinkedIn");return}if(!a){s("error"),o("No authorization code received"),He.error("No authorization code received");return}try{const{data:w,error:k}=await ee.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:a,state:h,callbackPath:"/social-connections/linkedin-callback"}});if(k)throw k;if(w!=null&&w.success)s("success"),o(`Successfully connected ${((v=w.accounts)==null?void 0:v.length)||1} LinkedIn account`),He.success("LinkedIn connected successfully!");else throw new Error((w==null?void 0:w.error)||"Failed to connect LinkedIn account")}catch(w){console.error("LinkedIn callback error:",w),s("error"),o(w instanceof Error?w.message:"Failed to connect LinkedIn account"),He.error("Failed to connect LinkedIn")}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[n==="loading"&&r.jsx(sn,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(Ba,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(Oc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Xt,{className:"flex items-center justify-center gap-2",children:[r.jsx(am,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(In,{children:i})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(te,{onClick:()=>e("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function AWt(){const t=ts(),[e,n]=P.useState(null),{data:s,isLoading:i}=b$e(e||void 0,!0),{data:o,isLoading:c}=_0e(!0),{cartItems:a}=dse(),h=a.reduce((x,v)=>x+v.quantity,0),m=x=>{t(`/marketplace/${x.id}`)};return i||c?r.jsx(Dr,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3].map(x=>r.jsx(Kr,{className:"h-10 w-24 flex-shrink-0"},x))}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[1,2,3,4].map(x=>r.jsx(Kr,{className:"h-72 w-full"},x))})]})}):r.jsx(Dr,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Marketplace"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Shop exclusive products for LevelUp members"})]}),r.jsxs(te,{variant:"outline",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(ah,{className:"h-4 w-4 mr-2"}),"Cart",h>0&&r.jsx(Ft,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:h})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(te,{variant:e===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(te,{variant:e===x.id?"default":"outline",size:"sm",onClick:()=>n(x.id),children:x.name},x.id))]}),s&&s.length>0?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(x=>{var v;return r.jsxs(Ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>m(x),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[x.images&&x.images.length>0?r.jsx("img",{src:((v=x.images.find(w=>w.is_primary))==null?void 0:v.image_url)||x.images[0].image_url,alt:x.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(El,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Ft,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No products available yet."})]})]})})}const k$e=P.forwardRef(({...t},e)=>r.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));k$e.displayName="Breadcrumb";const N$e=P.forwardRef(({className:t,...e},n)=>r.jsx("ol",{ref:n,className:$t("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));N$e.displayName="BreadcrumbList";const dee=P.forwardRef(({className:t,...e},n)=>r.jsx("li",{ref:n,className:$t("inline-flex items-center gap-1.5",t),...e}));dee.displayName="BreadcrumbItem";const Tpe=P.forwardRef(({asChild:t,className:e,...n},s)=>{const i=t?Mme:"a";return r.jsx(i,{ref:s,className:$t("transition-colors hover:text-foreground",e),...n})});Tpe.displayName="BreadcrumbLink";const S$e=P.forwardRef(({className:t,...e},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:$t("font-normal text-foreground",t),...e}));S$e.displayName="BreadcrumbPage";const Ape=({children:t,className:e,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:$t("[&>svg]:size-3.5",e),...n,children:t??r.jsx(Ka,{})});Ape.displayName="BreadcrumbSeparator";function EWt(){var je,ne;const{productId:t}=hd(),e=ts(),{data:n,isLoading:s}=zHt(t||""),{addToCart:i,cartItems:o}=dse(),[c,a]=P.useState(null),[h,m]=P.useState(1),[x,v]=P.useState(0),[w,k]=P.useState(null),[C,S]=P.useState(!1),[T,I]=P.useState(!1),A=(je=n==null?void 0:n.variants)==null?void 0:je.find(ye=>ye.id===c),D=((ne=n==null?void 0:n.variants)==null?void 0:ne.filter(ye=>ye.is_active))||[],$=Number((n==null?void 0:n.base_price)||0),F=A?Number(A.price_adjustment):0,q=$+F,W=Number((n==null?void 0:n.shipping_fee)||0),K=o.reduce((ye,ie)=>ye+ie.quantity,0),Z=async ye=>{if(!ye.target.files||ye.target.files.length===0)return;S(!0);const ie=ye.target.files[0],me=ie.name.split(".").pop(),fe=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${me}`;try{const{error:ve}=await ee.storage.from("marketplace").upload(fe,ie);if(ve)throw ve;const{data:{publicUrl:Ie}}=ee.storage.from("marketplace").getPublicUrl(fe);k(Ie),He.success("Artwork uploaded successfully")}catch(ve){He.error("Failed to upload artwork: "+ve.message)}finally{S(!1)}},re=()=>{if(n){if(D.length>0&&!c){He.error("Please select an option");return}i(n,A||void 0,h,w||void 0),I(!0),He.success("Added to cart!"),setTimeout(()=>I(!1),2e3)}},he=()=>{n!=null&&n.images&&v(ye=>(ye+1)%n.images.length)},ue=()=>{n!=null&&n.images&&v(ye=>(ye-1+n.images.length)%n.images.length)};return s?r.jsx(Dr,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Kr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Kr,{className:"h-8 w-3/4"}),r.jsx(Kr,{className:"h-6 w-1/4"}),r.jsx(Kr,{className:"h-24 w-full"}),r.jsx(Kr,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Dr,{title:n.name,children:[r.jsx(k$e,{className:"mb-6",children:r.jsxs(N$e,{children:[r.jsx(dee,{children:r.jsx(Tpe,{asChild:!0,children:r.jsx(io,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(Ape,{}),r.jsx(dee,{children:r.jsx(Tpe,{asChild:!0,children:r.jsx(io,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(Ape,{}),r.jsx(dee,{children:r.jsx(S$e,{children:n.name})})]})}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:n.images&&n.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:n.images[x].image_url,alt:n.name,className:"max-w-full max-h-full object-contain"}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(te,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ue,children:r.jsx(id,{className:"h-6 w-6"})}),r.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:he,children:r.jsx(Ka,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(El,{className:"h-24 w-24 text-muted-foreground"})})}),n.images&&n.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:n.images.map((ye,ie)=>r.jsx("button",{onClick:()=>v(ie),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${ie===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:ye.image_url,alt:"",className:"w-full h-full object-cover"})},ye.id))}),n.video&&r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:n.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[n.category&&r.jsx(Ft,{variant:"secondary",className:"mb-2",children:n.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",q.toFixed(2)]}),W>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",W.toFixed(2)," shipping"]})]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})}),D.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(ye=>r.jsxs(te,{variant:c===ye.id?"default":"outline",onClick:()=>a(ye.id),children:[ye.name,Number(ye.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(ye.price_adjustment)>0?"+":"","$",Number(ye.price_adjustment).toFixed(2),")"]})]},ye.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Upload Your Artwork (Optional)"}),w?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:w,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(te,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>k(null),children:"×"})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6",children:[r.jsx("input",{type:"file",accept:"image/*,.pdf,.ai,.eps",onChange:Z,className:"hidden",id:"artwork-upload",disabled:C}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(Ao,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:C?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Xe,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(ye=>Math.max(1,ye-1)),children:"-"}),r.jsx(xt,{type:"number",value:h,onChange:ye=>m(Math.max(1,parseInt(ye.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(ye=>ye+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(te,{size:"lg",className:"flex-1",onClick:re,disabled:T,children:T?r.jsxs(r.Fragment,{children:[r.jsx($a,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(ah,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(te,{variant:"outline",size:"lg",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(ah,{className:"h-5 w-5"}),K>0&&r.jsx(Ft,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:K})]})]}),n.requires_proof_approval&&r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-lg",children:"📋 This product requires proof approval before production. You'll receive a proof to review after your order is placed."})]})]})]}):r.jsx(Dr,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),r.jsx(te,{onClick:()=>e("/marketplace"),children:"Back to Marketplace"})]})})}function IWt(){const t=ts(),{cartItems:e,removeFromCart:n,updateQuantity:s,getItemPrice:i,getSubtotal:o,getShippingTotal:c,getTotal:a,clearCart:h}=dse(),[m,x]=P.useState(!1),[v,w]=P.useState(""),k=async()=>{if(e.length===0){He.error("Your cart is empty");return}x(!0);try{const{data:C,error:S}=await ee.functions.invoke("marketplace-checkout",{body:{items:e.map(T=>{var I;return{product_id:T.product.id,variant_id:((I=T.variant)==null?void 0:I.id)||null,quantity:T.quantity,artwork_url:T.artworkUrl||null}}),notes:v.trim()||null}});if(S)throw S;if(C!=null&&C.url)h(),window.open(C.url,"_blank");else throw new Error("No checkout URL received")}catch(C){He.error("Checkout failed: "+C.message)}finally{x(!1)}};return e.length===0?r.jsx(Dr,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(fg,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),r.jsx(te,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Dr,{title:"Shopping Cart",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.map(C=>{var S,T;return r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:C.product.images&&C.product.images.length>0?r.jsx("img",{src:((S=C.product.images.find(I=>I.is_primary))==null?void 0:S.image_url)||C.product.images[0].image_url,alt:C.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(fg,{className:"h-8 w-8 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold line-clamp-1",children:C.product.name}),C.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:C.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",i(C).toFixed(2),Number(C.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(C.product.shipping_fee).toFixed(2)," shipping"]})]}),C.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return n(C.product.id,(I=C.variant)==null?void 0:I.id)},children:r.jsx(es,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return s(C.product.id,(I=C.variant)==null?void 0:I.id,C.quantity-1)},disabled:C.quantity<=1,children:r.jsx(s1,{className:"h-3 w-3"})}),r.jsx(xt,{type:"number",value:C.quantity,onChange:I=>{var A;return s(C.product.id,(A=C.variant)==null?void 0:A.id,parseInt(I.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(te,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return s(C.product.id,(I=C.variant)==null?void 0:I.id,C.quantity+1)},children:r.jsx(Mn,{className:"h-3 w-3"})})]})]})]})})},`${C.product.id}-${((T=C.variant)==null?void 0:T.id)||"base"}`)}),r.jsx(te,{variant:"ghost",className:"text-destructive",onClick:h,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ze,{className:"sticky top-4",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",e.reduce((C,S)=>C+S.quantity,0)," items)"]}),r.jsxs("span",{children:["$",o().toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",c().toFixed(2)]})]}),r.jsx(Gd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",a().toFixed(2)]})]}),r.jsx(Gd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Xe,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(gs,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:v,onChange:C=>w(C.target.value),rows:3,className:"resize-none"})]}),r.jsx(te,{className:"w-full",size:"lg",onClick:k,disabled:m,children:m?r.jsxs(r.Fragment,{children:[r.jsx(sn,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(Ho,{className:"h-5 w-5 ml-2"})]})}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Secure checkout powered by Stripe"})]})]})})]})})}function PWt(){const t=ts(),{data:e,isLoading:n}=YHt();return n?r.jsx(Dr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Kr,{className:"h-32 w-full"},s))})}):!e||e.length===0?r.jsx(Dr,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(El,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),r.jsx(te,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Dr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:e.map(s=>{var i,o,c;return r.jsx(Ze,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t(`/marketplace/orders/${s.id}`),children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:s.order_number}),r.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:un(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Ft,{className:v0e[s.status],children:A4[s.status]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex -space-x-2",children:[(i=s.items)==null?void 0:i.slice(0,3).map((a,h)=>r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",style:{zIndex:3-h},children:[a.quantity,"×"]},a.id)),s.items&&s.items.length>3&&r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",s.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=s.items)==null?void 0:o.length)===1?s.items[0].product_name:`${(c=s.items)==null?void 0:c.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(s.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.tracking_url&&r.jsxs(te,{variant:"outline",size:"sm",onClick:a=>{a.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx($s,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Ka,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const t3e=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function LWt({currentStatus:t,statusHistory:e}){const n=t3e.indexOf(t);return r.jsx("div",{className:"space-y-3",children:t3e.map((s,i)=>{const o=e==null?void 0:e.find(m=>m.status===s),c=in;return r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`mt-0.5 flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center ${c?"bg-green-500 text-white":a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:c?r.jsx(Ha,{className:"h-4 w-4"}):a?r.jsx(Gi,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:i+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${h?"text-muted-foreground":""}`,children:A4[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[un(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function OWt(){var I;const{orderId:t}=hd(),e=ts(),{data:n,isLoading:s,refetch:i}=XHt(t||""),o=eWt(),c=tWt(),[a,h]=P.useState(!1),[m,x]=P.useState(null),[v,w]=P.useState(""),[k,C]=P.useState(null),S=async A=>{C(A);try{await o.mutateAsync({orderId:t,itemId:A}),He.success("Proof approved!"),i()}catch{He.error("Failed to approve proof")}finally{C(null)}},T=async()=>{if(m){C(m);try{await c.mutateAsync({orderId:t,itemId:m,reason:v}),He.success("Revision requested"),h(!1),w(""),x(null),i()}catch{He.error("Failed to request revision")}finally{C(null)}}};return s?r.jsx(Dr,{title:"Order Details",children:r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsx(Kr,{className:"h-64 w-full"}),r.jsx(Kr,{className:"h-48 w-full"})]}),r.jsx(Kr,{className:"h-96 w-full"})]})}):n?r.jsxs(Dr,{title:`Order ${n.order_number}`,children:[r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Xt,{children:"Order Status"}),r.jsx(Ft,{className:v0e[n.status],children:A4[n.status]})]}),r.jsx(et,{children:r.jsx(LWt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Items"})}),r.jsx(et,{className:"space-y-4",children:(I=n.items)==null?void 0:I.map(A=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:A.product_name}),A.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:A.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",A.quantity," × $",Number(A.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(A.unit_price)*A.quantity).toFixed(2)]})]}),A.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:A.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Q0,{className:"h-4 w-4"}),"View Artwork",r.jsx($s,{className:"h-3 w-3"})]})]}),A.proof_url&&r.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),r.jsxs("a",{href:A.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(Q0,{className:"h-4 w-4"}),"View Proof",r.jsx($s,{className:"h-3 w-3"})]}),A.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(te,{size:"sm",onClick:()=>S(A.id),disabled:k===A.id,children:[k===A.id?r.jsx(sn,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(Ad,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(te,{size:"sm",variant:"outline",onClick:()=>{x(A.id),h(!0)},disabled:k===A.id,children:[r.jsx(BT,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),A.proof_status==="approved"&&r.jsxs(Ft,{className:"bg-green-100 text-green-800",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),A.proof_status==="rejected"&&A.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Ft,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:A.proof_notes})]})]})]},A.id))})]}),n.shipping_name&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Xt,{className:"flex items-center gap-2",children:[r.jsx(UT,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(te,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx($s,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ze,{className:"sticky top-4",children:[r.jsx(Wt,{children:r.jsx(Xt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",un(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Gd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(n.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(n.shipping_total).toFixed(2)]})]})]}),r.jsx(Gd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(n.total).toFixed(2)]})]}),n.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Gd,{}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Order Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.notes})]})]})]})]})})]}),r.jsx(Ur,{open:a,onOpenChange:h,children:r.jsxs(Br,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Request Changes"}),r.jsx(us,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(gs,{placeholder:"Describe the changes needed...",value:v,onChange:A=>w(A.target.value),rows:4}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(te,{onClick:T,disabled:!v.trim()||k!==null,children:[k?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Dr,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(El,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),r.jsx(te,{onClick:()=>e("/marketplace/orders"),children:"View All Orders"})]})})}function DWt(){const t=ts(),[e]=Pd();return e.get("session_id"),P.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Dr,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(Ze,{children:r.jsxs(et,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(Ha,{className:"h-8 w-8 text-green-600"})}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You for Your Order!"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Your order has been confirmed and is being processed. You'll receive an email confirmation shortly."}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 mb-6 text-left",children:[r.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(El,{className:"h-4 w-4"}),"What happens next?"]}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("li",{children:"• We'll review your order and prepare it for production"}),r.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),r.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),r.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(te,{className:"flex-1",onClick:()=>t("/marketplace/orders"),children:["View My Orders",r.jsx(Ho,{className:"h-4 w-4 ml-2"})]}),r.jsx(te,{variant:"outline",className:"flex-1",onClick:()=>t("/marketplace"),children:"Continue Shopping"})]})]})})})})}function RWt(){const{user:t}=zr(),[e,n]=P.useState("store"),[s,i]=P.useState(null),[o,c]=P.useState(null),[a,h]=P.useState(!1),[m,x]=P.useState(5),[v,w]=P.useState(""),[k,C]=P.useState(!1),[S,T]=P.useState(!1),[I,A]=P.useState(""),[D,$]=P.useState(null),[F,q]=P.useState(!1),{hasSubmittedReview:W,submitReview:K,markPostedToGoogle:Z}=ROe(),{data:re}=j$e(),{data:he,isLoading:ue}=w$e(),{data:je,isLoading:ne}=lWt(s),{data:ye,isLoading:ie}=cWt(t==null?void 0:t.id),{data:me=0}=uWt(t==null?void 0:t.id),fe=hWt(),ve=new Set((ye==null?void 0:ye.map(Be=>Be.item_id))||[]),Ie=async()=>{if(o)try{await fe.mutateAsync(o.id),He.success(`Successfully purchased "${o.name}"!`),c(null)}catch(Be){He.error(Be.message||"Failed to purchase item")}},Se=async()=>{if(!v.trim()){He.error("Please write a review");return}C(!0);const Be=await K(m,v);C(!1),Be.success?(He.success("Thank you for your review! You earned 25 points!"),A(v),T(!0),w(""),x(5)):He.error(Be.error||"Failed to submit review")},oe=()=>{navigator.clipboard.writeText(I),He.success("Review copied to clipboard!")},ae=()=>{Z(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},Ne=()=>{T(!1),h(!1),A("")};return ue||ne||ie?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-24 w-full"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(Be=>r.jsx(Kr,{className:"h-64"},Be))})]})}):r.jsxs(Dr,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Reward Store"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Redeem your points for exclusive rewards"})]}),r.jsx(Ze,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(Bs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),r.jsx("p",{className:"text-3xl font-bold text-primary",children:me.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qa,{className:"h-4 w-4"}),r.jsx("span",{children:"Earn points by attending events"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(y4,{open:F,onOpenChange:q,children:r.jsxs(Ze,{className:"border-primary/20",children:[r.jsx(v4,{asChild:!0,children:r.jsx(Wt,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(qa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Xt,{className:"text-base",children:"How to Earn Points"}),r.jsx(In,{children:"See all the ways you can earn spendable points"})]})]}),F?r.jsx(K0,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Tu,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(_4,{children:r.jsx(et,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[re==null?void 0:re.filter(Be=>Be.is_active).map(Be=>{const Le=Qe=>{switch(Qe){case"event_attendance":return r.jsx(li,{className:"h-5 w-5"});case"leave_review":return r.jsx(Bs,{className:"h-5 w-5"});case"add_listing":return r.jsx(ui,{className:"h-5 w-5"});case"first_contact":return r.jsx(fs,{className:"h-5 w-5"});case"first_video":return r.jsx(Wi,{className:"h-5 w-5"});case"first_community_post":return r.jsx(vl,{className:"h-5 w-5"});default:return r.jsx(Ua,{className:"h-5 w-5"})}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Le(Be.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Be.action_name}),Be.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Be.description})]}),r.jsxs(Ft,{variant:"secondary",className:"font-bold shrink-0",children:["+",Be.points]})]},Be.id)}),r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center text-orange-500 shrink-0",children:r.jsx(qh,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Streak Bonuses"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Attend consecutive weeks for bonus points!"})]}),r.jsx(Ft,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!W&&r.jsx(Ze,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:r.jsx(vl,{className:"h-6 w-6 text-yellow-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),r.jsxs(te,{onClick:()=>h(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(Bs,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(Oa,{value:e,onValueChange:n,children:[r.jsxs(Ta,{children:[r.jsxs(xn,{value:"store",className:"flex items-center gap-2",children:[r.jsx(fg,{className:"h-4 w-4"}),"Store"]}),r.jsxs(xn,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(El,{className:"h-4 w-4"}),"My Rewards",ye&&ye.length>0&&r.jsx(Ft,{variant:"secondary",className:"ml-1",children:ye.length})]})]}),r.jsxs(Un,{value:"store",className:"mt-6",children:[he&&he.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(te,{variant:s===null?"default":"outline",size:"sm",onClick:()=>i(null),children:"All"}),he.map(Be=>r.jsxs(te,{variant:s===Be.id?"default":"outline",size:"sm",onClick:()=>i(Be.id),children:[Be.icon&&`${Be.icon} `,Be.name]},Be.id))]}),!je||je.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Ua,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No items available"}),r.jsx("p",{className:"text-sm",children:"Check back later for new rewards!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:je.map(Be=>{const Le=ve.has(Be.id),Qe=Be.max_quantity!==null&&Be.current_quantity===0,Fe=me>=Be.points_cost;return r.jsxs(Ze,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Le?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>$(Be),children:[Be.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Be.preview_image_url,alt:Be.name,className:"w-full h-full object-cover"}),Le&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Qe&&!Le&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ft,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Ua,{className:"h-12 w-12 text-muted-foreground/50"}),Le&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ft,{className:"bg-green-500 text-white",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Xt,{className:"text-lg",children:Be.name}),r.jsxs(Ft,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1"}),Be.points_cost]})]}),Be.category&&r.jsxs(Ft,{variant:"outline",className:"w-fit",children:[Be.category.icon&&`${Be.category.icon} `,Be.category.name]})]}),r.jsxs(et,{children:[r.jsx(In,{className:"mb-4 line-clamp-2",children:Be.description||"No description available"}),Be.max_quantity!==null&&!Le&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Be.current_quantity," of ",Be.max_quantity," remaining"]}),Le?r.jsx(te,{className:"w-full",onClick:Ce=>{Ce.stopPropagation(),Be.file_url&&nde(Be.file_url,Be.name)},disabled:!Be.file_url,children:Be.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(te,{className:"w-full",onClick:Ce=>{Ce.stopPropagation(),c(Be)},disabled:Qe||!Fe,children:Qe?"Sold Out":Fe?r.jsxs(r.Fragment,{children:[r.jsx(fg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Be.points_cost-me} more pts`})]})]},Be.id)})})]}),r.jsx(Un,{value:"my-rewards",className:"mt-6",children:!ye||ye.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(El,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ye.map(Be=>{var Le,Qe,Fe,Ce,Je;return r.jsxs(Ze,{className:"overflow-hidden",children:[(Le=Be.item)!=null&&Le.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Be.item.preview_image_url,alt:((Qe=Be.item)==null?void 0:Qe.name)||"Reward",className:"w-full h-full object-cover"})}):r.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:r.jsx(Ua,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Xt,{className:"text-lg",children:((Fe=Be.item)==null?void 0:Fe.name)||"Unknown Item"}),r.jsxs(In,{className:"text-xs",children:["Purchased for ",Be.points_spent," points • ",new Date(Be.purchased_at).toLocaleDateString()]})]}),r.jsx(et,{children:r.jsx(te,{className:"w-full",onClick:()=>{var Ae,Ye;(Ae=Be.item)!=null&&Ae.file_url&&nde(Be.item.file_url,(Ye=Be.item)==null?void 0:Ye.name)},disabled:!((Ce=Be.item)!=null&&Ce.file_url),children:((Je=Be.item)==null?void 0:Je.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Be.id)})})})]})]}),r.jsx(oh,{open:!!o,onOpenChange:()=>c(null),children:r.jsxs(vu,{children:[r.jsxs(_u,{children:[r.jsx(wu,{children:"Confirm Purchase"}),r.jsxs(ju,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",r.jsx("br",{}),r.jsx("br",{}),"You currently have ",r.jsxs("strong",{children:[me," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[me-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(bu,{children:[r.jsx(ku,{children:"Cancel"}),r.jsx(Kd,{onClick:Ie,disabled:fe.isPending,children:fe.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Ur,{open:a,onOpenChange:Be=>{!Be&&S?Ne():h(Be)},children:r.jsx(Br,{children:S?r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[r.jsx(Ha,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(us,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),r.jsxs("p",{className:"text-sm italic",children:['"',I,'"']})]}),r.jsxs(te,{variant:"outline",className:"w-full",onClick:oe,children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(ai,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(te,{variant:"outline",onClick:Ne,children:"Maybe Later"}),r.jsxs(te,{onClick:ae,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Yr,{children:[r.jsx(Zr,{children:"Leave a Review"}),r.jsx(us,{children:"Share your experience with LevelUp and earn 25 spendable points!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Rating"}),r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(Be=>r.jsx("button",{type:"button",onClick:()=>x(Be),className:"focus:outline-none",children:r.jsx(Bs,{className:`h-8 w-8 transition-colors ${m>=Be?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Be))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(gs,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:v,onChange:Be=>w(Be.target.value),rows:4})]})]}),r.jsxs(ai,{children:[r.jsx(te,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(te,{onClick:Se,disabled:k,className:"bg-yellow-600 hover:bg-yellow-700",children:k?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Ur,{open:!!D,onOpenChange:()=>$(null),children:r.jsxs(Br,{className:"max-w-lg",children:[r.jsxs(Yr,{children:[r.jsxs(Zr,{className:"flex items-center gap-2",children:[D==null?void 0:D.name,r.jsxs(Ft,{variant:"secondary",className:"font-bold",children:[r.jsx(Bs,{className:"h-3 w-3 mr-1"}),D==null?void 0:D.points_cost]})]}),(D==null?void 0:D.category)&&r.jsxs(Ft,{variant:"outline",className:"w-fit",children:[D.category.icon&&`${D.category.icon} `,D.category.name]})]}),(D==null?void 0:D.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:D.preview_image_url,alt:D.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(D==null?void 0:D.description)||"No description available"}),(D==null?void 0:D.max_quantity)!==null&&!ve.has((D==null?void 0:D.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[D==null?void 0:D.current_quantity," of ",D==null?void 0:D.max_quantity," remaining"]})]}),r.jsx(ai,{children:D&&ve.has(D.id)?r.jsx(te,{className:"w-full",onClick:()=>{D.file_url&&nde(D.file_url,D.name)},disabled:!D.file_url,children:D.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx($s,{className:"h-4 w-4 mr-2"}),"Access"]})}):D&&r.jsx(te,{className:"w-full",onClick:()=>{$(null),c(D)},disabled:D.max_quantity!==null&&D.current_quantity===0||me{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function w1(t){const e=[];for(let n=0,s=t.length;nMh||t.height>Mh)&&(t.width>Mh&&t.height>Mh?t.width>t.height?(t.height*=Mh/t.width,t.width=Mh):(t.width*=Mh/t.height,t.height=Mh):t.width>Mh?(t.height*=Mh/t.width,t.width=Mh):(t.width*=Mh/t.height,t.height=Mh))}function sne(t){return new Promise((e,n)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>e(s))})},s.onerror=n,s.crossOrigin="anonymous",s.decoding="async",s.src=t})}async function VWt(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function HWt(t,e,n){const s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(t),VWt(i)}const mh=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||mh(n,e)};function WWt(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function GWt(t,e){return C$e(e).map(n=>{const s=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function KWt(t,e,n,s){const i=`.${t}:${e}`,o=n.cssText?WWt(n):GWt(n,s);return document.createTextNode(`${i}{${o}}`)}function r3e(t,e,n,s){const i=window.getComputedStyle(t,n),o=i.getPropertyValue("content");if(o===""||o==="none")return;const c=zWt();try{e.className=`${e.className} ${c}`}catch{return}const a=document.createElement("style");a.appendChild(KWt(c,n,i,s)),e.appendChild(a)}function ZWt(t,e,n){r3e(t,e,":before",n),r3e(t,e,":after",n)}const n3e="application/font-woff",s3e="image/jpeg",YWt={woff:n3e,woff2:n3e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:s3e,jpeg:s3e,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function XWt(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function b0e(t){const e=XWt(t).toLowerCase();return YWt[e]||""}function QWt(t){return t.split(/,/)[1]}function Epe(t){return t.search(/^(data:)/)!==-1}function JWt(t,e){return`data:${e};base64,${t}`}async function T$e(t,e,n){const s=await fetch(t,e);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const i=await s.blob();return new Promise((o,c)=>{const a=new FileReader;a.onerror=c,a.onloadend=()=>{try{o(n({res:s,result:a.result}))}catch(h){c(h)}},a.readAsDataURL(i)})}const sde={};function eGt(t,e,n){let s=t.replace(/\?.*/,"");return n&&(s=t),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),e?`[${e}]${s}`:s}async function w0e(t,e,n){const s=eGt(t,e,n.includeQueryParams);if(sde[s]!=null)return sde[s];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const o=await T$e(t,n.fetchRequestInit,({res:c,result:a})=>(e||(e=c.headers.get("Content-Type")||""),QWt(a)));i=JWt(o,e)}catch(o){i=n.imagePlaceholder||"";let c=`Failed to fetch resource: ${t}`;o&&(c=typeof o=="string"?o:o.message),c&&console.warn(c)}return sde[s]=i,i}async function tGt(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):sne(e)}async function rGt(t,e){if(t.currentSrc){const o=document.createElement("canvas"),c=o.getContext("2d");o.width=t.clientWidth,o.height=t.clientHeight,c==null||c.drawImage(t,0,0,o.width,o.height);const a=o.toDataURL();return sne(a)}const n=t.poster,s=b0e(n),i=await w0e(n,s,e);return sne(i)}async function nGt(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await Lie(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function sGt(t,e){return mh(t,HTMLCanvasElement)?tGt(t):mh(t,HTMLVideoElement)?rGt(t,e):mh(t,HTMLIFrameElement)?nGt(t,e):t.cloneNode(A$e(t))}const iGt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",A$e=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function aGt(t,e,n){var s,i;if(A$e(e))return e;let o=[];return iGt(t)&&t.assignedNodes?o=w1(t.assignedNodes()):mh(t,HTMLIFrameElement)&&(!((s=t.contentDocument)===null||s===void 0)&&s.body)?o=w1(t.contentDocument.body.childNodes):o=w1(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),o.length===0||mh(t,HTMLVideoElement)||await o.reduce((c,a)=>c.then(()=>Lie(a,n)).then(h=>{h&&e.appendChild(h)}),Promise.resolve()),e}function oGt(t,e,n){const s=e.style;if(!s)return;const i=window.getComputedStyle(t);i.cssText?(s.cssText=i.cssText,s.transformOrigin=i.transformOrigin):C$e(n).forEach(o=>{let c=i.getPropertyValue(o);o==="font-size"&&c.endsWith("px")&&(c=`${Math.floor(parseFloat(c.substring(0,c.length-2)))-.1}px`),mh(t,HTMLIFrameElement)&&o==="display"&&c==="inline"&&(c="block"),o==="d"&&e.getAttribute("d")&&(c=`path(${e.getAttribute("d")})`),s.setProperty(o,c,i.getPropertyPriority(o))})}function lGt(t,e){mh(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),mh(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function cGt(t,e){if(mh(t,HTMLSelectElement)){const n=e,s=Array.from(n.children).find(i=>t.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function dGt(t,e,n){return mh(e,Element)&&(oGt(t,e,n),ZWt(t,e,n),lGt(t,e),cGt(t,e)),e}async function uGt(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const s={};for(let o=0;osGt(s,e)).then(s=>aGt(t,s,e)).then(s=>dGt(t,s,e)).then(s=>uGt(s,e))}const E$e=/url\((['"]?)([^'"]+?)\1\)/g,hGt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,fGt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function pGt(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function mGt(t){const e=[];return t.replace(E$e,(n,s,i)=>(e.push(i),n)),e.filter(n=>!Epe(n))}async function gGt(t,e,n,s,i){try{const o=n?FWt(e,n):e,c=b0e(e);let a;return i||(a=await w0e(o,c,s)),t.replace(pGt(e),`$1${a}$3`)}catch{}return t}function xGt(t,{preferredFontFormat:e}){return e?t.replace(fGt,n=>{for(;;){const[s,,i]=hGt.exec(n)||[];if(!i)return"";if(i===e)return`src: ${s};`}}):t}function I$e(t){return t.search(E$e)!==-1}async function P$e(t,e,n){if(!I$e(t))return t;const s=xGt(t,n);return mGt(s).reduce((o,c)=>o.then(a=>gGt(a,c,e,n)),Promise.resolve(s))}async function aS(t,e,n){var s;const i=(s=e.style)===null||s===void 0?void 0:s.getPropertyValue(t);if(i){const o=await P$e(i,null,n);return e.style.setProperty(t,o,e.style.getPropertyPriority(t)),!0}return!1}async function yGt(t,e){await aS("background",t,e)||await aS("background-image",t,e),await aS("mask",t,e)||await aS("-webkit-mask",t,e)||await aS("mask-image",t,e)||await aS("-webkit-mask-image",t,e)}async function vGt(t,e){const n=mh(t,HTMLImageElement);if(!(n&&!Epe(t.src))&&!(mh(t,SVGImageElement)&&!Epe(t.href.baseVal)))return;const s=n?t.src:t.href.baseVal,i=await w0e(s,b0e(s),e);await new Promise((o,c)=>{t.onload=o,t.onerror=e.onImageErrorHandler?(...h)=>{try{o(e.onImageErrorHandler(...h))}catch(m){c(m)}}:c;const a=t;a.decode&&(a.decode=o),a.loading==="lazy"&&(a.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function _Gt(t,e){const s=w1(t.childNodes).map(i=>L$e(i,e));await Promise.all(s).then(()=>t)}async function L$e(t,e){mh(t,Element)&&(await yGt(t,e),await vGt(t,e),await _Gt(t,e))}function bGt(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const s=e.style;return s!=null&&Object.keys(s).forEach(i=>{n[i]=s[i]}),t}const i3e={};async function a3e(t){let e=i3e[t];if(e!=null)return e;const s=await(await fetch(t)).text();return e={url:t,cssText:s},i3e[t]=e,e}async function o3e(t,e){let n=t.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async c=>{let a=c.replace(s,"$1");return a.startsWith("https://")||(a=new URL(a,t.url).href),T$e(a,e.fetchRequestInit,({result:h})=>(n=n.replace(c,`url(${h})`),[c,h]))});return Promise.all(o).then(()=>n)}function l3e(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let s=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const h=i.exec(s);if(h===null)break;e.push(h[0])}s=s.replace(i,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,c="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(c,"gi");for(;;){let h=o.exec(s);if(h===null){if(h=a.exec(s),h===null)break;o.lastIndex=a.lastIndex}else a.lastIndex=o.lastIndex;e.push(h[0])}return e}async function wGt(t,e){const n=[],s=[];return t.forEach(i=>{if("cssRules"in i)try{w1(i.cssRules||[]).forEach((o,c)=>{if(o.type===CSSRule.IMPORT_RULE){let a=c+1;const h=o.href,m=a3e(h).then(x=>o3e(x,e)).then(x=>l3e(x).forEach(v=>{try{i.insertRule(v,v.startsWith("@import")?a+=1:i.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:v,error:w})}})).catch(x=>{console.error("Error loading remote css",x.toString())});s.push(m)}})}catch(o){const c=t.find(a=>a.href==null)||document.styleSheets[0];i.href!=null&&s.push(a3e(i.href).then(a=>o3e(a,e)).then(a=>l3e(a).forEach(h=>{c.insertRule(h,c.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",o)}}),Promise.all(s).then(()=>(t.forEach(i=>{if("cssRules"in i)try{w1(i.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),n))}function jGt(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>I$e(e.style.getPropertyValue("src")))}async function kGt(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=w1(t.ownerDocument.styleSheets),s=await wGt(n,e);return jGt(s)}function O$e(t){return t.trim().replace(/["']/g,"")}function NGt(t){const e=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(o=>{e.add(O$e(o))}),Array.from(s.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(t),e}async function SGt(t,e){const n=await kGt(t,e),s=NGt(t);return(await Promise.all(n.filter(o=>s.has(O$e(o.style.fontFamily))).map(o=>{const c=o.parentStyleSheet?o.parentStyleSheet.href:null;return P$e(o.cssText,c,e)}))).join(` `)}async function CGt(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await SGt(t,e);if(n){const s=document.createElement("style"),i=document.createTextNode(n);s.appendChild(i),t.firstChild?t.insertBefore(s,t.firstChild):t.appendChild(s)}}async function MGt(t,e={}){const{width:n,height:s}=M$e(t,e),i=await Lie(t,e,!0);return await CGt(i,e),await L$e(i,e),bGt(i,e),await HWt(i,n,s)}async function TGt(t,e={}){const{width:n,height:s}=M$e(t,e),i=await MGt(t,e),o=await sne(i),c=document.createElement("canvas"),a=c.getContext("2d"),h=e.pixelRatio||UWt(),m=e.canvasWidth||n,x=e.canvasHeight||s;return c.width=m*h,c.height=x*h,e.skipAutoScale||qWt(c),c.style.width=`${m}`,c.style.height=`${x}`,e.backgroundColor&&(a.fillStyle=e.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(o,0,0,c.width,c.height),c}async function AGt(t,e={}){return(await TGt(t,e)).toDataURL()}function EGt(){return rr({queryKey:["listing-swag-categories"],queryFn:async()=>{const{data:t,error:e}=await ee.from("listing_swag_categories").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}})}function IGt(){return rr({queryKey:["listing-swag-styles"],queryFn:async()=>{const{data:t,error:e}=await ee.from("listing_swag_styles").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}})}function PGt(){const{user:t}=zr(),e=Qr();return dr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{error:s}=await ee.from("listing_swag_generations").insert({user_id:t.id,category_id:n.categoryId,style_id:n.styleId,listing_id:n.listingId||null,property_address:n.propertyAddress,property_city:n.propertyCity,property_state:n.propertyState,property_price:n.propertyPrice,bedrooms:n.bedrooms,bathrooms:n.bathrooms,square_feet:n.squareFeet,photo_url:n.photoUrl,formats_downloaded:n.formatsDownloaded});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-swag-generations"]})}})}const LGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function c3e(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function d3e({data:t,format:e}){var w,k;const n=LGt[e],s=.4,i=t.primaryColor||"#1e3a5f",o=t.secondaryColor||"#ffffff",c=c3e(i)?"#0f172a":"#ffffff",a=c3e(o)?"#0f172a":"#ffffff",h=i+"33",m=C=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(C),x=e==="story",v=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"relative",style:{height:x?"38%":v?"35%":"36%"},children:[t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e5e7eb"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:28*s},children:"Add Property Photo"})}),r.jsx("div",{className:"absolute",style:{top:20*s,left:20*s,backgroundColor:i,padding:`${18*s}px ${36*s}px`,borderRadius:6*s},children:r.jsx("span",{style:{color:c,fontSize:28*s,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.1em"},children:t.categoryName})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:o,padding:`${20*s}px ${32*s}px`,borderRadius:6*s,boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,marginBottom:4*s},children:"Listed at"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:i},children:m(t.propertyPrice)})]})]}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:i,padding:`${28*s}px ${36*s}px`,gap:16*s},children:[r.jsx(cl,{style:{width:36*s,height:36*s,color:c,opacity:.8,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:800,color:c,marginBottom:4*s},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:c,opacity:.8,fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{backgroundColor:o},children:[{icon:zf,value:t.bedrooms,label:"Bedrooms"},{icon:Ff,value:t.bathrooms,label:"Bathrooms"},{icon:n1,value:((w=t.squareFeet)==null?void 0:w.toLocaleString())||"—",label:"Sq Ft"}].map((C,S)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,borderRight:S<2?`2px solid ${h}`:"none",backgroundColor:S===1?h:o},children:[r.jsx(C.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:i},children:C.value}),r.jsx("div",{style:{fontSize:18*s,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:C.label})]},S))}),r.jsxs("div",{className:"flex items-center",style:{padding:`${48*s}px`,backgroundColor:o,gap:36*s,flex:1},children:[t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"object-cover",style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:220*s,height:220*s,borderRadius:"50%",backgroundColor:i,color:c,fontSize:88*s,fontWeight:700,flexShrink:0},children:((k=t.agentName)==null?void 0:k.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:i,marginBottom:8*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:28*s,color:"#64748b",marginBottom:24*s,fontWeight:600},children:"Real Estate Professional"}),r.jsxs("div",{className:"flex flex-col",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ma,{style:{width:28*s,height:28*s,color:c}})}),r.jsx("span",{style:{fontSize:36*s,color:a,fontWeight:800},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(oi,{style:{width:28*s,height:28*s,color:c}})}),r.jsx("span",{style:{fontSize:30*s,color:"#475569",fontWeight:600},children:t.agentEmail})]})]})]})]})]})}const OGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function u3e(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function DGt({data:t,format:e}){var w,k;const n=OGt[e],s=.4,i=t.primaryColor||"#0f766e",o=t.secondaryColor||"#ffffff",c=u3e(i)?"#0f172a":"#ffffff",a=u3e(o)?"#0f172a":"#ffffff",h=i+"22",m=C=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(C),x=e==="story",v=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:o,padding:`${28*s}px ${36*s}px`},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18*s,color:i,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",marginBottom:4*s},children:"Just"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i,textTransform:"uppercase"},children:t.categoryName})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",marginBottom:4*s},children:"Price"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i},children:m(t.propertyPrice)})]})]}),r.jsx("div",{className:"relative",style:{height:x?"32%":"28%",margin:`0 ${24*s}px`,borderRadius:16*s,overflow:"hidden",border:`6px solid ${o}`},children:t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:h},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})})}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,padding:`${24*s}px ${32*s}px`,borderRadius:16*s,gap:18*s},children:[r.jsx("div",{className:"flex items-center justify-center",style:{width:64*s,height:64*s,backgroundColor:i,borderRadius:"50%",flexShrink:0},children:r.jsx(cl,{style:{width:32*s,height:32*s,color:c}})}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:a},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:"#64748b",fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:20*s,padding:`0 ${24*s}px`},children:[{icon:zf,value:t.bedrooms,label:"Beds"},{icon:Ff,value:t.bathrooms,label:"Baths"},{icon:n1,value:((w=t.squareFeet)==null?void 0:w.toLocaleString())||"—",label:"Sq Ft"}].map((C,S)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center",style:{backgroundColor:o,padding:`${24*s}px`,borderRadius:16*s},children:[r.jsx(C.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:900,color:a},children:C.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:C.label})]},S))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,marginBottom:24*s,padding:`${40*s}px`,borderRadius:20*s,gap:36*s,flex:1},children:[t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:i,color:c,fontSize:80*s,fontWeight:700,flexShrink:0},children:((k=t.agentName)==null?void 0:k.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:900,color:a,marginBottom:8*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:24*s,color:i,fontWeight:700,marginBottom:20*s},children:"Licensed Real Estate Agent"}),r.jsxs("div",{className:"flex flex-col",style:{gap:14*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ma,{style:{width:26*s,height:26*s,color:c}})}),r.jsx("span",{style:{fontSize:34*s,color:a,fontWeight:800},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(oi,{style:{width:26*s,height:26*s,color:c}})}),r.jsx("span",{style:{fontSize:28*s,color:"#475569",fontWeight:600},children:t.agentEmail})]})]})]})]})]})}const RGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function h3e(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function FGt({data:t,format:e}){var v,w;const n=RGt[e],s=.4,i=t.primaryColor||"#2c3e50",o=t.secondaryColor||"#c9a962",c=h3e(i)?"#0f172a":"#ffffff",a=h3e(o)?"#0f172a":"#ffffff",h=k=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(k),m=e==="story",x=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Georgia', serif",backgroundColor:i},children:[r.jsxs("div",{className:"text-center",style:{backgroundColor:i,padding:`${32*s}px`,borderBottom:`6px solid ${o}`},children:[r.jsx("div",{style:{fontSize:20*s,color:o,textTransform:"uppercase",letterSpacing:"0.3em",marginBottom:8*s},children:"Just"}),r.jsx("div",{style:{fontSize:56*s,fontWeight:400,color:c,textTransform:"uppercase",letterSpacing:"0.15em"},children:t.categoryName})]}),r.jsxs("div",{className:"relative",style:{height:m?"30%":"26%",margin:`${24*s}px`,border:`4px solid ${o}`,borderRadius:6*s,overflow:"hidden"},children:[t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e8e4de"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:i,padding:`${18*s}px ${32*s}px`,borderRadius:6*s,border:`3px solid ${o}`},children:[r.jsx("div",{style:{fontSize:14*s,color:o,textTransform:"uppercase",letterSpacing:"0.1em"},children:"Offered at"}),r.jsx("div",{style:{fontSize:42*s,fontWeight:400,color:c},children:h(t.propertyPrice)})]})]}),r.jsxs("div",{className:"text-center",style:{padding:`${20*s}px ${36*s}px`,backgroundColor:"#faf8f5"},children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:400,color:i,marginBottom:8*s},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:o,letterSpacing:"0.1em",fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:48*s,padding:`${28*s}px`,backgroundColor:"#faf8f5",borderTop:"2px solid #e8e4de",borderBottom:"2px solid #e8e4de"},children:[{icon:zf,value:t.bedrooms,label:"Bedrooms"},{icon:Ff,value:t.bathrooms,label:"Bathrooms"},{icon:n1,value:((v=t.squareFeet)==null?void 0:v.toLocaleString())||"—",label:"Sq Ft"}].map((k,C)=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(k.icon,{style:{width:32*s,height:32*s,color:o,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:400,color:i},children:k.value}),r.jsx("div",{style:{fontSize:16*s,color:"#7c8798",textTransform:"uppercase",letterSpacing:"0.08em"},children:k.label})]},C))}),r.jsxs("div",{className:"flex items-center justify-center",style:{backgroundColor:i,padding:`${48*s}px`,gap:40*s,borderTop:`6px solid ${o}`,flex:1},children:[t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`6px solid ${o}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:o,color:a,fontSize:80*s,fontWeight:400,fontStyle:"italic",flexShrink:0},children:((w=t.agentName)==null?void 0:w.charAt(0))||"A"}),r.jsxs("div",{className:"text-center flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:400,color:c,fontStyle:"italic",marginBottom:10*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:22*s,color:o,textTransform:"uppercase",letterSpacing:"0.2em",marginBottom:24*s},children:"Real Estate Advisor"}),r.jsxs("div",{className:"flex flex-col items-center",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ma,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:32*s,color:c,fontWeight:600},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(oi,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:26*s,color:"#94a3b8"},children:t.agentEmail})]})]})]})]})]})}const zGt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function BGt(t){const e=t.substring(1),n=parseInt(e,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function $Gt({data:t,format:e}){var v,w;const n=zGt[e],s=.4,i=t.primaryColor||"#dc2626",o=t.secondaryColor||"#ffffff",c=BGt(i)?"#0f172a":"#ffffff",a=i+"22",h=k=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(k),m=e==="story",x=e==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:"#0f172a"},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:i,padding:`${32*s}px ${40*s}px`},children:[r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:c,textTransform:"uppercase",letterSpacing:"0.05em"},children:t.categoryName}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:c,opacity:.8,marginBottom:4*s},children:"Asking"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:c},children:h(t.propertyPrice)})]})]}),r.jsxs("div",{className:"relative",style:{height:m?"30%":x?"28%":"26%"},children:[t.photoUrl?r.jsx("img",{src:t.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:a},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:0,left:0,right:0,backgroundColor:"rgba(0,0,0,0.9)",padding:`${24*s}px ${32*s}px`},children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:"#ffffff"},children:t.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:i,fontWeight:600},children:[t.propertyCity,", ",t.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{borderBottom:`6px solid ${i}`},children:[{icon:zf,value:t.bedrooms,label:"Beds"},{icon:Ff,value:t.bathrooms,label:"Baths"},{icon:n1,value:((v=t.squareFeet)==null?void 0:v.toLocaleString())||"—",label:"Sq Ft"}].map((k,C)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,backgroundColor:C===1?a:o,borderRight:C<2?`2px solid ${a}`:"none"},children:[r.jsx(k.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:"#0f172a"},children:k.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:k.label})]},C))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:"#0f172a",padding:`${48*s}px`,gap:40*s,flex:1},children:[r.jsx("div",{style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,padding:6*s,backgroundColor:"#1e293b",flexShrink:0},children:t.agentPhoto?r.jsx("img",{src:t.agentPhoto,alt:t.agentName,className:"w-full h-full object-cover",style:{borderRadius:"50%"},crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{borderRadius:"50%",backgroundColor:i,color:c,fontSize:88*s,fontWeight:700},children:((w=t.agentName)==null?void 0:w.charAt(0))||"A"})}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:"#ffffff",marginBottom:10*s,lineHeight:1.1},children:t.agentName}),r.jsx("div",{style:{fontSize:28*s,color:i,fontWeight:700,marginBottom:24*s},children:"Your Real Estate Expert"}),r.jsxs("div",{className:"flex flex-col",style:{gap:18*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ma,{style:{width:30*s,height:30*s,color:c}})}),r.jsx("span",{style:{fontSize:38*s,color:"#ffffff",fontWeight:800},children:t.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(oi,{style:{width:30*s,height:30*s,color:c}})}),r.jsx("span",{style:{fontSize:30*s,color:"#94a3b8",fontWeight:600},children:t.agentEmail})]})]})]})]})]})}function UGt({templateKey:t,data:e,format:n}){switch(t){case"modern-minimal":return r.jsx(d3e,{data:e,format:n});case"bold-impact":return r.jsx(DGt,{data:e,format:n});case"classic-elegant":return r.jsx(FGt,{data:e,format:n});case"vibrant-energy":return r.jsx($Gt,{data:e,format:n});default:return r.jsx(d3e,{data:e,format:n})}}const qGt={Home:r.jsx(ui,{className:"h-6 w-6"}),DoorOpen:r.jsx(X0,{className:"h-6 w-6"}),TrendingDown:r.jsx(c1,{className:"h-6 w-6"}),CheckCircle:r.jsx(Ba,{className:"h-6 w-6"}),FileText:r.jsx(Si,{className:"h-6 w-6"})},ZM={portrait:{label:"Portrait",icon:r.jsx(Wo,{className:"h-5 w-5"}),dimensions:"1080×1350",ratio:"4:5"},square:{label:"Square",icon:r.jsx(cm,{className:"h-5 w-5"}),dimensions:"1080×1080",ratio:"1:1"},story:{label:"Story",icon:r.jsx(a1,{className:"h-5 w-5"}),dimensions:"1080×1920",ratio:"9:16"}};function VGt(){const{user:t}=zr(),{data:e,isLoading:n}=EGt(),{data:s,isLoading:i}=IGt(),{data:o}=lxe(),{avatarUrl:c}=xge(t==null?void 0:t.id),a=PGt(),[h,m]=P.useState(null);P.useEffect(()=>{(async()=>{if(!t)return;const{data:Ne}=await ee.from("profiles").select("name, phone").eq("id",t.id).single();Ne&&m(Ne)})()},[t]);const[x,v]=P.useState("category"),[w,k]=P.useState(null),[C,S]=P.useState(null),[T,I]=P.useState("portrait"),[A,D]=P.useState(!1),[$,F]=P.useState(""),[q,W]=P.useState("#1e3a5f"),[K,Z]=P.useState("#ffffff"),[re,he]=P.useState({propertyAddress:"",propertyCity:"",propertyState:"",propertyPrice:"",bedrooms:"",bathrooms:"",squareFeet:"",openHouseDate:"",openHouseTime:"",originalPrice:""}),ue=P.useRef(null),je=ae=>{var Te;const Ne=(Te=ae.target.files)==null?void 0:Te[0];if(Ne){const Be=new FileReader;Be.onloadend=()=>{F(Be.result)},Be.readAsDataURL(Ne)}},ne=ae=>{var Te,Be,Le,Qe,Fe,Ce;const Ne=o==null?void 0:o.find(Je=>Je.id===ae);Ne&&(he({propertyAddress:Ne.property_address||"",propertyCity:Ne.city||"",propertyState:Ne.state||"",propertyPrice:((Te=Ne.price)==null?void 0:Te.toString())||"",bedrooms:((Be=Ne.bedrooms)==null?void 0:Be.toString())||"",bathrooms:((Le=Ne.bathrooms)==null?void 0:Le.toString())||"",squareFeet:((Qe=Ne.square_footage)==null?void 0:Qe.toString())||"",openHouseDate:"",openHouseTime:"",originalPrice:""}),(Ce=(Fe=Ne.photos)==null?void 0:Fe[0])!=null&&Ce.photo_url&&F(Ne.photos[0].photo_url))},ye=()=>({categoryId:(w==null?void 0:w.id)||"",categoryName:(w==null?void 0:w.name)||"",styleId:(C==null?void 0:C.id)||"",templateKey:(C==null?void 0:C.template_key)||"modern-minimal",primaryColor:q,secondaryColor:K,accentColor:q,fontFamily:(C==null?void 0:C.font_family)||"Inter",propertyAddress:re.propertyAddress,propertyCity:re.propertyCity,propertyState:re.propertyState,propertyPrice:parseFloat(re.propertyPrice)||0,bedrooms:parseInt(re.bedrooms)||0,bathrooms:parseFloat(re.bathrooms)||0,squareFeet:parseInt(re.squareFeet)||0,photoUrl:$,agentName:(h==null?void 0:h.name)||"Agent Name",agentPhone:(h==null?void 0:h.phone)||"",agentEmail:(t==null?void 0:t.email)||"",agentPhoto:c||"",brokerageName:"",openHouseDate:re.openHouseDate,openHouseTime:re.openHouseTime,originalPrice:re.originalPrice?parseFloat(re.originalPrice):void 0}),ie=async ae=>{if(ue.current){D(!0);try{const Ne=ue.current.querySelector("[data-template]");if(!Ne)throw new Error("Template not found");const Te={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}},Be=.3,Le=Te[ae],Qe=await AGt(Ne,{width:Le.width*Be,height:Le.height*Be,pixelRatio:1/Be,cacheBust:!0}),Fe=document.createElement("a");Fe.download=`listing-${w==null?void 0:w.slug}-${ae}-${Date.now()}.png`,Fe.href=Qe,Fe.click(),w&&C&&a.mutate({categoryId:w.id,styleId:C.id,propertyAddress:re.propertyAddress,propertyCity:re.propertyCity,propertyState:re.propertyState,propertyPrice:parseFloat(re.propertyPrice)||void 0,bedrooms:parseInt(re.bedrooms)||void 0,bathrooms:parseFloat(re.bathrooms)||void 0,squareFeet:parseInt(re.squareFeet)||void 0,photoUrl:$,formatsDownloaded:[ae]}),He.success(`Downloaded ${ZM[ae].label} format!`)}catch(Ne){console.error("Download error:",Ne),He.error("Failed to download image")}finally{D(!1)}}},me=async()=>{const ae=["portrait","square","story"];for(const Ne of ae)I(Ne),await new Promise(Te=>setTimeout(Te,500)),await ie(Ne)},fe=()=>{switch(x){case"category":return!!w;case"style":return!!C;case"details":return re.propertyAddress&&re.propertyPrice&&$;default:return!0}},ve=()=>{const ae=["category","style","details","preview"],Ne=ae.indexOf(x);Ne{const ae=["category","style","details","preview"],Ne=ae.indexOf(x);Ne>0&&v(ae[Ne-1])},Se=()=>r.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:["category","style","details","preview"].map((ae,Ne)=>r.jsxs(lt.Fragment,{children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${x===ae?"bg-primary text-primary-foreground":oe.indexOf(x)>Ne?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"}`,children:Ne+1}),Ne<3&&r.jsx("div",{className:`w-12 h-0.5 ${oe.indexOf(x)>Ne?"bg-primary":"bg-muted"}`})]},ae))}),oe=["category","style","details","preview"];return n||i?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Kr,{className:"h-8 w-64 mx-auto"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[1,2,3,4,5].map(ae=>r.jsx(Kr,{className:"h-32"},ae))})]}):r.jsxs("div",{className:"max-w-4xl mx-auto",children:[Se(),x==="category"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"What type of announcement?"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose the category that matches your listing status"})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:e==null?void 0:e.map(ae=>r.jsx(Ze,{className:`cursor-pointer transition-all hover:shadow-md ${(w==null?void 0:w.id)===ae.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>k(ae),children:r.jsxs(et,{className:"p-6 text-center",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:qGt[ae.icon||"Home"]}),r.jsx("h3",{className:"font-semibold",children:ae.name})]})},ae.id))})]}),x==="style"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose your layout & colors"}),r.jsx("p",{className:"text-muted-foreground",children:"Select a layout style and customize your brand colors"})]}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-6",children:[r.jsx("h3",{className:"font-semibold mb-4",children:"Your Brand Colors"}),r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx(Xe,{className:"mb-2 block",children:"Primary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:q,onChange:ae=>W(ae.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(xt,{value:q,onChange:ae=>W(ae.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for headers, badges, and accents"})]}),r.jsxs("div",{children:[r.jsx(Xe,{className:"mb-2 block",children:"Secondary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:K,onChange:ae=>Z(ae.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(xt,{value:K,onChange:ae=>Z(ae.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for backgrounds and contrast"})]})]}),r.jsxs("div",{className:"mt-4 p-4 rounded-lg border flex items-center gap-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-lg flex items-center justify-center text-sm font-bold",style:{backgroundColor:q,color:K},children:"Preview"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This is how your primary and secondary colors will look together"})]})]})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-4 text-center",children:"Choose Layout Style"}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:s==null?void 0:s.map(ae=>r.jsxs(Ze,{className:`cursor-pointer transition-all hover:shadow-md overflow-hidden ${(C==null?void 0:C.id)===ae.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>S(ae),children:[r.jsx("div",{className:"h-32 flex items-center justify-center text-white font-bold",style:{background:`linear-gradient(135deg, ${q} 0%, ${q}cc 100%)`},children:r.jsx("span",{className:"text-lg",children:ae.name})}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:ae.description})]})]},ae.id))})]})]}),x==="details"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Add listing details"}),r.jsx("p",{className:"text-muted-foreground",children:"Enter the property information and upload a photo"})]}),o&&o.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Xe,{className:"mb-2 block",children:"Quick fill from your listings"}),r.jsxs("select",{className:"w-full p-2 border rounded-md",onChange:ae=>ne(ae.target.value),defaultValue:"",children:[r.jsx("option",{value:"",children:"Select a listing..."}),o.map(ae=>r.jsxs("option",{value:ae.id,children:[ae.property_address,", ",ae.city]},ae.id))]})]})}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Xe,{className:"mb-2 block",children:"Property Photo *"}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var ae;return(ae=document.getElementById("photo-upload"))==null?void 0:ae.click()},children:[$?r.jsx("img",{src:$,alt:"Preview",className:"w-full h-48 object-cover rounded"}):r.jsxs("div",{className:"py-8",children:[r.jsx(Ao,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload photo"})]}),r.jsx("input",{id:"photo-upload",type:"file",accept:"image/*",className:"hidden",onChange:je})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Street Address *"}),r.jsx(xt,{value:re.propertyAddress,onChange:ae=>he({...re,propertyAddress:ae.target.value}),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"City"}),r.jsx(xt,{value:re.propertyCity,onChange:ae=>he({...re,propertyCity:ae.target.value}),placeholder:"Austin"})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"State"}),r.jsx(xt,{value:re.propertyState,onChange:ae=>he({...re,propertyState:ae.target.value}),placeholder:"TX"})]})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Price *"}),r.jsx(xt,{type:"number",value:re.propertyPrice,onChange:ae=>he({...re,propertyPrice:ae.target.value}),placeholder:"450000"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Beds"}),r.jsx(xt,{type:"number",value:re.bedrooms,onChange:ae=>he({...re,bedrooms:ae.target.value}),placeholder:"3"})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Baths"}),r.jsx(xt,{type:"number",step:"0.5",value:re.bathrooms,onChange:ae=>he({...re,bathrooms:ae.target.value}),placeholder:"2"})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Sq Ft"}),r.jsx(xt,{type:"number",value:re.squareFeet,onChange:ae=>he({...re,squareFeet:ae.target.value}),placeholder:"2000"})]})]}),(w==null?void 0:w.slug)==="open-house"&&r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Xe,{children:"Open House Date"}),r.jsx(xt,{type:"date",value:re.openHouseDate,onChange:ae=>he({...re,openHouseDate:ae.target.value})})]}),r.jsxs("div",{children:[r.jsx(Xe,{children:"Time"}),r.jsx(xt,{value:re.openHouseTime,onChange:ae=>he({...re,openHouseTime:ae.target.value}),placeholder:"2-4 PM"})]})]}),(w==null?void 0:w.slug)==="price-drop"&&r.jsxs("div",{children:[r.jsx(Xe,{children:"Original Price"}),r.jsx(xt,{type:"number",value:re.originalPrice,onChange:ae=>he({...re,originalPrice:ae.target.value}),placeholder:"500000"})]})]})})]})]}),x==="preview"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Preview & Download"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose your format and download your listing graphic"})]}),r.jsx(Oa,{value:T,onValueChange:ae=>I(ae),className:"w-full",children:r.jsx(Ta,{className:"grid w-full grid-cols-4",children:Object.entries(ZM).map(([ae,Ne])=>r.jsxs(xn,{value:ae,className:"gap-2",children:[Ne.icon,r.jsx("span",{className:"hidden sm:inline",children:Ne.label})]},ae))})}),r.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[r.jsx(Ft,{variant:"secondary",children:ZM[T].dimensions}),r.jsx(Ft,{variant:"outline",children:ZM[T].ratio})]}),r.jsx("div",{className:"flex justify-center",ref:ue,children:r.jsx("div",{"data-template":!0,className:"shadow-2xl rounded-lg overflow-hidden",children:r.jsx(UGt,{templateKey:(C==null?void 0:C.template_key)||"modern-minimal",data:ye(),format:T})})}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(te,{size:"lg",onClick:()=>ie(T),disabled:A,children:[A?r.jsx(sn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download ",ZM[T].label]}),r.jsxs(te,{size:"lg",variant:"outline",onClick:me,disabled:A,children:[r.jsx(Mo,{className:"h-4 w-4 mr-2"}),"Download All Formats"]})]})]}),r.jsxs("div",{className:"flex justify-between mt-8 pt-6 border-t",children:[r.jsxs(te,{variant:"outline",onClick:Ie,disabled:x==="category",children:[r.jsx(Ga,{className:"h-4 w-4 mr-2"}),"Back"]}),x!=="preview"&&r.jsxs(te,{onClick:ve,disabled:!fe(),children:["Continue",r.jsx(Ho,{className:"h-4 w-4 ml-2"})]})]})]})}function HGt(){const{isAdmin:t}=zr();return t?r.jsxs(Dr,{children:[r.jsxs(Ag,{children:[r.jsx("title",{children:"Listing Swag | LevelUp"}),r.jsx("meta",{name:"description",content:"Create stunning listing graphics for your properties"})]}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/90 to-primary/80 p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('/placeholder.svg')] opacity-5"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(As,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm font-medium uppercase tracking-wider opacity-90",children:"Marketing Tools"})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Listing Swag"}),r.jsx("p",{className:"text-lg opacity-90 max-w-2xl mb-6",children:"Create beautiful, professional listing graphics in seconds. Choose from stunning templates and download in multiple formats."}),r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Yd,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Unique Styles"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Wo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Export Formats"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Mo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"Instant Download"})]})]})]})]}),r.jsx(VGt,{})]})]}):r.jsx(ZJ,{to:"/dashboard",replace:!0})}const WGt=()=>{const t=Tg();return P.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-100",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),r.jsx("p",{className:"mb-4 text-xl text-gray-600",children:"Oops! Page not found"}),r.jsx("a",{href:"/",className:"text-blue-500 underline hover:text-blue-700",children:"Return to Home"})]})})},GGt=new iQe,KGt=()=>{const t=window.location.hostname;return t==="listings.relevelup.com"||t.startsWith("listings.")},ZGt=()=>r.jsx(dQe,{client:GGt,children:r.jsx(TEe,{children:r.jsxs(sI,{children:[r.jsx(NZe,{}),r.jsx(nYe,{}),r.jsx(jJe,{children:r.jsx(Art,{children:r.jsxs(Ert,{children:[r.jsx(Irt,{}),r.jsx(znt,{}),KGt()?r.jsx(Nst,{}):r.jsxs(mJe,{children:[r.jsx(ln,{path:"/",element:r.jsx(Fst,{})}),r.jsx(ln,{path:"/privacy-policy",element:r.jsx(zst,{})}),r.jsx(ln,{path:"/terms-of-service",element:r.jsx(Bst,{})}),r.jsx(ln,{path:"/data-deletion",element:r.jsx($st,{})}),r.jsx(ln,{path:"/public/listings",element:r.jsx(KPe,{})}),r.jsx(ln,{path:"/public/listing/:slugOrId",element:r.jsx(uht,{})}),r.jsx(ln,{path:"/auth",element:r.jsx(xit,{})}),r.jsx(ln,{path:"/subscription-success",element:r.jsx(yit,{})}),r.jsx(ln,{path:"/subscription",element:r.jsx(Cn,{children:r.jsx(vut,{})})}),r.jsx(ln,{path:"/share/video",element:r.jsx(oht,{}),children:r.jsx(ln,{path:":shareToken",element:r.jsx(aht,{})})}),r.jsx(ln,{path:"/og/video/:token",element:r.jsx(lht,{})}),r.jsx(ln,{path:"/setup-brokerage",element:r.jsx(Cn,{children:r.jsx(_ut,{})})}),r.jsx(ln,{path:"/claim-account",element:r.jsx(eke,{})}),r.jsx(ln,{path:"/claim",element:r.jsx(eke,{})}),r.jsx(ln,{path:"/join",element:r.jsx(but,{})}),r.jsx(ln,{path:"/trial",element:r.jsx(Iut,{})}),r.jsx(ln,{path:"/trial/success",element:r.jsx(Put,{})}),r.jsx(ln,{path:"/dashboard",element:r.jsx(Cn,{children:r.jsx(pft,{})})}),r.jsx(ln,{path:"/profile",element:r.jsx(Cn,{children:r.jsx(Zft,{})})}),r.jsx(ln,{path:"/apps",element:r.jsx(Cn,{children:r.jsx(lpt,{})})}),r.jsx(ln,{path:"/admin",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(axt,{})})}),r.jsx(ln,{path:"/admin/apps",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(cxt,{})})}),r.jsx(ln,{path:"/admin/members",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(hxt,{})})}),r.jsx(ln,{path:"/admin/invite-codes",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(fxt,{})})}),r.jsx(ln,{path:"/admin/events",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(obt,{})})}),r.jsx(ln,{path:"/events",element:r.jsx(Cn,{children:r.jsx(ipt,{})})}),r.jsx(ln,{path:"/events/:eventId",element:r.jsx(Cn,{children:r.jsx(opt,{})})}),r.jsx(ln,{path:"/templates",element:r.jsx(Cn,{children:r.jsx(cpt,{})})}),r.jsx(ln,{path:"/templates/:templateId",element:r.jsx(Cn,{children:r.jsx(fpt,{})})}),r.jsx(ln,{path:"/admin/templates",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(lbt,{})})}),r.jsx(ln,{path:"/academy",element:r.jsx(Cn,{children:r.jsx(ppt,{})})}),r.jsx(ln,{path:"/academy/:videoId",element:r.jsx(Cn,{children:r.jsx(gpt,{})})}),r.jsx(ln,{path:"/admin/academy",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(dbt,{})})}),r.jsx(ln,{path:"/toolbox",element:r.jsx(Cn,{children:r.jsx(xpt,{})})}),r.jsx(ln,{path:"/toolbox/:kitId",element:r.jsx(Cn,{children:r.jsx(ypt,{})})}),r.jsx(ln,{path:"/admin/toolbox",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(ubt,{})})}),r.jsx(ln,{path:"/social-swag",element:r.jsx(Cn,{children:r.jsx(vpt,{})})}),r.jsx(ln,{path:"/social-swag-2",element:r.jsx(Cn,{children:r.jsx(Agt,{})})}),r.jsx(ln,{path:"/social-swag/:swagId",element:r.jsx(Cn,{children:r.jsx(Egt,{})})}),r.jsx(ln,{path:"/social-connections",element:r.jsx(Cn,{children:r.jsx(SWt,{})})}),r.jsx(ln,{path:"/social-connections/callback",element:r.jsx(Cn,{children:r.jsx(CWt,{})})}),r.jsx(ln,{path:"/social-connections/linkedin-callback",element:r.jsx(Cn,{children:r.jsx(TWt,{})})}),r.jsx(ln,{path:"/social-connections/google-callback",element:r.jsx(Cn,{children:r.jsx(MWt,{})})}),r.jsx(ln,{path:"/admin/social-swag",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(hbt,{})})}),r.jsx(ln,{path:"/admin/social-swag-2",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(fbt,{})})}),r.jsx(ln,{path:"/community",element:r.jsx(Cn,{children:r.jsx(Ygt,{})})}),r.jsx(ln,{path:"/support",element:r.jsx(Cn,{children:r.jsx(Xgt,{})})}),r.jsx(ln,{path:"/admin/community",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(pbt,{})})}),r.jsx(ln,{path:"/admin/support-tickets",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(wbt,{})})}),r.jsx(ln,{path:"/admin/email-templates",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Nbt,{})})}),r.jsx(ln,{path:"/admin/analytics",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(vbt,{})})}),r.jsx(ln,{path:"/admin/brokerage-resources",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(_bt,{})})}),r.jsx(ln,{path:"/admin/dashboard-management",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(bbt,{})})}),r.jsx(ln,{path:"/brokerage/dashboard",element:r.jsx(Cn,{requireBrokerageManager:!0,children:r.jsx(Dbt,{})})}),r.jsx(ln,{path:"/my-brokerage",element:r.jsx(Cn,{children:r.jsx(Ubt,{})})}),r.jsx(ln,{path:"/brokerage-resources",element:r.jsx(Cn,{requireBrokerageManager:!0,children:r.jsx(nxt,{})})}),r.jsx(ln,{path:"/brokerage-resources/:resourceId",element:r.jsx(Cn,{requireBrokerageManager:!0,children:r.jsx(sxt,{})})}),r.jsx(ln,{path:"/newsletters",element:r.jsx(Cn,{children:r.jsx(qbt,{})})}),r.jsx(ln,{path:"/newsletters/:id",element:r.jsx(Cn,{children:r.jsx(Vbt,{})})}),r.jsx(ln,{path:"/wishlist",element:r.jsx(Cn,{children:r.jsx(Wbt,{})})}),r.jsx(ln,{path:"/wishlist/:itemId",element:r.jsx(Cn,{children:r.jsx(Gbt,{})})}),r.jsx(ln,{path:"/admin/wishlist",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Kbt,{})})}),r.jsx(ln,{path:"/admin/levelup-brief",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Zbt,{})})}),r.jsx(ln,{path:"/admin/newsletters",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Hbt,{})})}),r.jsx(ln,{path:"/admin/additional-services",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Ybt,{})})}),r.jsx(ln,{path:"/admin/discounts",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Xbt,{})})}),r.jsx(ln,{path:"/admin/subscriptions",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Qbt,{})})}),r.jsx(ln,{path:"/admin/referrals",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Jbt,{})})}),r.jsx(ln,{path:"/admin/onboarding-checklist",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(twt,{})})}),r.jsx(ln,{path:"/admin/marketplace",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(aWt,{})})}),r.jsx(ln,{path:"/admin/agent-points",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(OHt,{})})}),r.jsx(ln,{path:"/admin/reward-store",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(bWt,{})})}),r.jsx(ln,{path:"/admin/integrations",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(wWt,{})})}),r.jsx(ln,{path:"/admin/integrations/callback",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(NWt,{})})}),r.jsx(ln,{path:"/reward-store",element:r.jsx(Cn,{children:r.jsx(RWt,{})})}),r.jsx(ln,{path:"/additional-services",element:r.jsx(Cn,{children:r.jsx(hwt,{})})}),r.jsx(ln,{path:"/additional-services/:serviceId",element:r.jsx(Cn,{children:r.jsx(fwt,{})})}),r.jsx(ln,{path:"/ai-toolkit",element:r.jsx(Cn,{children:r.jsx(pwt,{})})}),r.jsx(ln,{path:"/listing-swag",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(HGt,{})})}),r.jsx(ln,{path:"/mission-control",element:r.jsx(Cn,{children:r.jsx(jwt,{})})}),r.jsx(ln,{path:"/mission-control/contacts",element:r.jsx(Cn,{children:r.jsx(Pwt,{})})}),r.jsx(ln,{path:"/mission-control/contacts/:contactId",element:r.jsx(Cn,{children:r.jsx(Kwt,{})})}),r.jsx(ln,{path:"/mission-control/plans",element:r.jsx(Cn,{children:r.jsx(Zwt,{})})}),r.jsx(ln,{path:"/mission-control/popbys",element:r.jsx(Cn,{children:r.jsx(Qwt,{})})}),r.jsx(ln,{path:"/mission-control/popbys/map",element:r.jsx(Cn,{children:r.jsx(ejt,{})})}),r.jsx(ln,{path:"/admin/notification-settings",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(kWt,{})})}),r.jsx(ln,{path:"/admin/agent-os",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(nwt,{})})}),r.jsx(ln,{path:"/mission-control/listings",element:r.jsx(Cn,{children:r.jsx(RVt,{})})}),r.jsx(ln,{path:"/mission-control/listings/new",element:r.jsx(Cn,{children:r.jsx(J5e,{})})}),r.jsx(ln,{path:"/mission-control/listings/:listingId",element:r.jsx(Cn,{children:r.jsx(QVt,{})})}),r.jsx(ln,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Cn,{children:r.jsx(J5e,{})})}),r.jsx(ln,{path:"/admin/listing-exchange",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(THt,{})})}),r.jsx(ln,{path:"/mission-control/pipeline",element:r.jsx(Cn,{children:r.jsx(kHt,{})})}),r.jsx(ln,{path:"/mission-control/scorecard",element:r.jsx(Cn,{children:r.jsx(TVt,{})})}),r.jsx(ln,{path:"/admin/scorecard",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(SHt,{})})}),r.jsx(ln,{path:"/admin/scorecard/:userId",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(MHt,{})})}),r.jsx(ln,{path:"/admin/membership-reviews",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(AHt,{})})}),r.jsx(ln,{path:"/admin/weekly-digest",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(PHt,{})})}),r.jsx(ln,{path:"/mission-control/video/record",element:r.jsx(Cn,{children:r.jsx(aHt,{})})}),r.jsx(ln,{path:"/mission-control/video-library",element:r.jsx(Cn,{children:r.jsx(dHt,{})})}),r.jsx(ln,{path:"/marketplace",element:r.jsx(Cn,{children:r.jsx(AWt,{})})}),r.jsx(ln,{path:"/marketplace/:productId",element:r.jsx(Cn,{children:r.jsx(EWt,{})})}),r.jsx(ln,{path:"/marketplace/cart",element:r.jsx(Cn,{children:r.jsx(IWt,{})})}),r.jsx(ln,{path:"/marketplace/orders",element:r.jsx(Cn,{children:r.jsx(PWt,{})})}),r.jsx(ln,{path:"/marketplace/orders/:orderId",element:r.jsx(Cn,{children:r.jsx(OWt,{})})}),r.jsx(ln,{path:"/marketplace/success",element:r.jsx(Cn,{children:r.jsx(DWt,{})})}),r.jsx(ln,{path:"*",element:r.jsx(WGt,{})})]})]})})})]})})});DTe(document.getElementById("root")).render(r.jsx(ZGt,{}));